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 upRegression: File.downloaded becomes negative once the first piece is fully downloaded #1515
Comments
This comment has been minimized.
This comment has been minimized.
|
I was able to patch the problem by replacing |
This comment has been minimized.
This comment has been minimized.
|
Is this where it happened? #1479 |
This comment has been minimized.
This comment has been minimized.
|
@KayleePop Yes, this seems so. I think the author of that push request only considered the case where there is only one large file and that this file starts at the first piece of the torrent. When there are multiple videos, for instance, and the video starts at a high-index piece (e.g. 1000), it does not make sense to initialize the size to |
This comment has been minimized.
This comment has been minimized.
|
I'm affected. @DiegoRBaquero what about you ? |
This comment has been minimized.
This comment has been minimized.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This comment has been minimized.
This comment has been minimized.
|
Any news about this? Seems like a pretty simple fix. |
This comment has been minimized.
This comment has been minimized.
|
I'll review a PR if you a willing to take on this :) |
This comment has been minimized.
This comment has been minimized.
|
Sure, you got it. |
What version of WebTorrent?
0.102.4
What operating system and Node.js version?
macOS 10.13.6
Node.js 10.0.0
What browser and version? (if using WebTorrent in the browser)
What did you expect to happen?
File.downloadproperty should always be a nonnegative integer.What actually happened?
After the first piece (
_startPiece) of the file has finished downloaded, the file'soffsetis subtracted from the downloaded size, causing it to be a (sometimes quite large) negative.This occurs in
file.js, line 46 (https://github.com/webtorrent/webtorrent/blob/master/lib/file.js#L46), as of revision 6fbef8e.I noticed the negative values after upgrading from version 0.98.24, which did not have this issue.