diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2014-03-03 11:21:42 +0400 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2014-03-03 11:21:42 +0400 |
commit | de465f37d4cd35a8a4879c2caefc8994730f3bad (patch) | |
tree | 3b1fe4a6499e5c4fb3ad38f2720e805acc7f05f6 /lib/storage.js | |
parent | 07013a122d6ea7e4ee066998467993315fd39e49 (diff) |
fix progress bar
Diffstat (limited to 'lib/storage.js')
-rw-r--r-- | lib/storage.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/storage.js b/lib/storage.js index 1192e8f..40bcc1e 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -220,9 +220,9 @@ Object.defineProperty(Storage.prototype, 'progress', { Object.defineProperty(Storage.prototype, 'numMissing', { get: function () { var self = this - var numMissing = 0 + var numMissing = self.pieces.length for (var index = 0, len = self.pieces.length; index < len; index++) { - numMissing += (self.bitfield.get(index) === 0) + numMissing -= self.bitfield.get(index) } return numMissing } @@ -262,6 +262,7 @@ Storage.prototype.deselectBlock = function (index, offset) { Storage.prototype._onPieceDone = function (piece) { var self = this + console.log('PIECE DONE', self.progress, self.numMissing) self.bitfield.set(piece.index) self.emit('piece', piece) } |