webtorrent / bittorrent-tracker

🌊 Simple, robust, BitTorrent tracker (client & server) implementation
https://webtorrent.io
MIT License
1.77k stars 317 forks source link

fix: connection leaks #420

Closed lookis closed 2 years ago

lookis commented 2 years ago

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update [X] Bug fix [ ] New feature [ ] Other, please explain:

What changes did you make? (Give an overview) clear up the peer resources when destroy

Which issue (if any) does this pull request address? this PR MAY related to these issue: https://github.com/webtorrent/webtorrent/issues/1079 https://github.com/webtorrent/webtorrent-hybrid/issues/119

Is there anything you'd like reviewers to focus on? There is another connection leak when tracker(WebRTC mode) interval is too small, for example 5 seconds, when webtorrent-hybrid as a seeder will announce too fast, and every time hybrid announce, It will create 5 offer peers here: https://github.com/webtorrent/bittorrent-tracker/blob/master/lib/client/websocket-tracker.js#L63

and these peers only get destroy after 50 seconds: https://github.com/webtorrent/bittorrent-tracker/blob/master/lib/client/websocket-tracker.js#L392

in this case, there will be more than 50 Peers, and make the hybrid hang forever (osx 12.2.1)

welcome[bot] commented 2 years ago

🙌 Thanks for opening this pull request! You're awesome.

lookis commented 2 years ago

are these changes OK for merge? @DiegoRBaquero @feross

welcome[bot] commented 2 years ago

🎉 Congrats on getting your first pull request landed!

webtorrent-bot commented 2 years ago

:tada: This PR is included in version 9.18.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket: