-
-
Notifications
You must be signed in to change notification settings - Fork 335
Refactor the server-side code #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
drops capability to pass a *hex* infoHash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why no reply for udp parse errors? We reply for http parse errors. Can we keep this consistent unless there's a good reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sending a full reply for a request with just an invalid byte can become a vector for traffic amplification. Be careful with UDP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
|
This is an excellent PR! The shorter functions are much easier to understand and will likely be easier for V8 to optimize since it has a pretty small maximum size for functions which it will consider for optimization. The de-duplication was something I planned to do, but I love the way you accomplished it. Once you address my comments, I'll merge and do a release. My comments are mostly small style things or questions to clarify why you did things a certain way. |
|
As for consistent binary identifiers, I agree that hex is the clearest and most likely to work without encountering difficult-to-understand utf8 issues. I wonder if issues like this one (webtorrent/webtorrent#196) are caused by binary string utf8 issues. The reason I went with binary strings initially was to avoid converting the binary strings that http clients send in order to do a |
|
Thank you for the kind words and the useful feedback. I stepped through your suggestions and committed/commented on each of them. I'm looking forward to the merge. |
Hi
For these big changes I'm not going to use my commit bit but want you to review. If accepted, I'm going to push future fixes and review incoming PRs. If not, I will probably start maintaining my own fork.
Notes:
getSwarm()getSwarm()and Swarm objects can now be implemented by users, allowing for custom logicNext up
completedevents for scraping thedownloadedcountConsistent formatting of binary identifiers
In the process I dropped the capability of passing hex info_hashes to
getSwarm()because that would put an additional requirement to anyone implementing the function themselves. It would be really helpful to have consistent conventions for info_hashes and peer_ids in the Webtorrent scope.The options are: