Skip to content

Conversation

@sidd
Copy link
Contributor

@sidd sidd commented Dec 4, 2016

This fixes an issue I was running into with traditional BitTorrent clients. The tracker was marking seeders as leechers, even though this was not the case.

When starting a new transfer with all of the files already downloaded, a started event is sent out with left=0 (at least this is the case in Deluge and Transmission). A completed event is explicitly not sent out (FTA https://wiki.theory.org/BitTorrentSpecification):

completed: Must be sent to the tracker when the download completes. However, must not be sent if the download was already 100% complete when the client started. Presumably, this is to allow the tracker to increment the "completed downloads" metric based solely on this event.

Currently params.left is set to Infinity even if it was supplied as left=0 in the querystring. This fixes that issue, and retains the behavior of setting params.left to Infinity when it is unparseable.

@feross
Copy link
Member

feross commented Dec 5, 2016

Looks good to me. I'm just going to swap isNaN for Number.isNaN since I usually try to avoid isNaN's automatic coercion. Doesn't make a difference in this case, though.

@feross feross merged commit a32ae8f into webtorrent:master Dec 5, 2016
@feross
Copy link
Member

feross commented Dec 5, 2016

8.0.13

feross added a commit that referenced this pull request Feb 3, 2017
feross added a commit that referenced this pull request Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants