mafintosh / torrent-stream

The low level streaming torrent engine that peerflix uses
MIT License
1.94k stars 227 forks source link

fix race condition involving engine.destroy() and `ready` event #199

Closed Trott closed 4 years ago

Trott commented 4 years ago

The 'ready' event sets up an interval timer that is cleared in destroy(). However, in some situations, it is possible to for the interval to be created after destroy() has run, resulting in an interval timer that is never cleared, and thus an app that does not exit when it is supposed to. This change fixes the issue and adds a test for it.

Refs: https://github.com/mafintosh/torrent-stream/issues/198

Trott commented 4 years ago

@mafintosh Sorry for the ping, but any chance this or some other equivalent change can get in soon and be released? This is a race condition that is sometimes triggered in CITGM.

mafintosh commented 4 years ago

It’s on my todo for tmw now

Trott commented 4 years ago

/re-ping! We're down to just three errors in CITGM on the upcoming LTS branch and this is one of them. Would love to get it fixed soon!

mafintosh commented 4 years ago

Thanks @Trott ! I didn't realise you actually sent a PR and not just the issue until I pushed a similar fix.

Anyways should be fixed now