Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upFix infinite loop bug #1786
Open
Fix infinite loop bug #1786
+40
−10
Conversation
The wire request may fail due to choking or wire closed. This results in an infinite loop.
Do not calculate the rarest piece unless it is needed. It is an expensive operation.
Add custom verifier so reading the entire torrent file(s) is not necessary on startup.
Queue torrent updates once per second, as it is an expensive operation. Before, this would cause updates to happen nearly every tick.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
koush commentedDec 6, 2019
•
edited
The wire request may fail due to choking or wire closed. This results in an infinite loop.
Here is where "false" is expected, otherwise it loops infinitely:
https://github.com/koush/webtorrent/blob/master/lib/torrent.js#L1316
The failure is reported in the callback, but not as a return value:
https://github.com/webtorrent/bittorrent-protocol/blob/master/index.js#L316
Alternatively, the peer choking check can be done in the while loop.
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)
Watch for a failed wire request (number of requests does not change), and return false.
Which issue (if any) does this pull request address?
Is there anything you'd like reviewers to focus on?