File tree Expand file tree Collapse file tree 2 files changed +18
-13
lines changed
Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -84,20 +84,20 @@ async function runExample() {
8484
8585 // Re-announce all files every 5 seconds
8686 let announceCount = 0 ;
87- const announceInterval = setInterval ( async ( ) => {
88- try {
89- announceCount ++ ;
90- console . log ( `📢 Re-announcing ${ sharedFiles . length } files #${ announceCount } at ${ new Date ( ) . toLocaleTimeString ( ) } ` ) ;
87+ // const announceInterval = setInterval(async () => {
88+ // try {
89+ // announceCount++;
90+ // console.log(`📢 Re-announcing ${sharedFiles.length} files #${announceCount} at ${new Date().toLocaleTimeString()}`);
9191
92- // Re-share all files to trigger re-announcement
93- for ( const fileInfo of sharedFiles ) {
94- await host . shareFile ( fileInfo . path ) ;
95- }
96- console . log ( `✅ All ${ sharedFiles . length } files re-announced` ) ;
97- } catch ( error ) {
98- console . error ( '❌ Error re-announcing files:' , error . message ) ;
99- }
100- } , 5000 ) ; // Every 5 seconds
92+ // // Re-share all files to trigger re-announcement
93+ // for (const fileInfo of sharedFiles) {
94+ // await host.shareFile(fileInfo.path);
95+ // }
96+ // console.log(`✅ All ${sharedFiles.length} files re-announced`);
97+ // } catch (error) {
98+ // console.error('❌ Error re-announcing files:', error.message);
99+ // }
100+ // }, 5000); // Every 5 seconds
101101
102102 // Handle graceful shutdown
103103 process . on ( 'SIGINT' , async ( ) => {
Original file line number Diff line number Diff line change @@ -337,6 +337,11 @@ export class FileHost implements IFileHost {
337337 this . logger . debug ( `🔄 Initializing WebTorrent client...` ) ;
338338 this . webTorrentClient = new WebTorrent ( ) ;
339339
340+ // Fix EventEmitter warning when seeding multiple torrents
341+ // WebTorrent reuses a single DHT instance, causing listener count to exceed default limit
342+ this . webTorrentClient . setMaxListeners ( 0 ) ; // Disable limit
343+ this . logger . debug ( `🔧 Set WebTorrent maxListeners to unlimited for multiple torrents` ) ;
344+
340345 // Add error handling for the WebTorrent client
341346 this . webTorrentClient . on ( "error" , ( err : string | Error ) => {
342347 this . logger . error ( "❌ WebTorrent client error:" , err ) ;
You can’t perform that action at this time.
0 commit comments