Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorShachar Itzhaky <corwin.amber@gmail.com>2019-03-11 17:44:15 +0300
committerShachar Itzhaky <corwin.amber@gmail.com>2019-03-11 17:44:15 +0300
commit88b4f5454329a8ad5dcad805fce1997d46b7637c (patch)
treef7b9349c540a038ff43c5db4f99a99b9b5c1ad5c /lib
parent1829dc225b7786cad4340d211b65012f974e4a6a (diff)
Fixes #1515 and #1552.
Diffstat (limited to 'lib')
-rw-r--r--lib/file.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/file.js b/lib/file.js
index e5624cd..8bcfe22 100644
--- a/lib/file.js
+++ b/lib/file.js
@@ -43,7 +43,7 @@ class File extends EventEmitter {
// Calculate first piece diffrently, it sometimes have a offset
let downloaded = bitfield.get(start)
- ? pieceLength - this.offset
+ ? pieceLength - (this.offset % pieceLength)
: Math.max(piece.length - piece.missing - this.offset, 0)
for (let index = start + 1; index <= end; ++index) {