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
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2014-03-03 11:02:46 +0400
committerFeross Aboukhadijeh <feross@feross.org>2014-03-03 11:02:46 +0400
commit07013a122d6ea7e4ee066998467993315fd39e49 (patch)
treedd58cc538c1e262c61691cf9200d77f40a0e203f /lib/storage.js
parent8375be8c1ceb5cadf3f0c67eb6150e2bf9860f67 (diff)
torrent successfully fetched over the net!
Diffstat (limited to 'lib/storage.js')
-rw-r--r--lib/storage.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/storage.js b/lib/storage.js
index 03dd8e3..1192e8f 100644
--- a/lib/storage.js
+++ b/lib/storage.js
@@ -155,7 +155,7 @@ function File (file, buffer, pieces) {
File.prototype._checkDone = function () {
var self = this
self.done = self.pieces.every(function (piece) {
- return piece.done
+ return piece.verified
})
if (self.done)
self.emit('done')
@@ -222,7 +222,7 @@ Object.defineProperty(Storage.prototype, 'numMissing', {
var self = this
var numMissing = 0
for (var index = 0, len = self.pieces.length; index < len; index++) {
- numMissing += self.bitfield.get(index)
+ numMissing += (self.bitfield.get(index) === 0)
}
return numMissing
}
@@ -269,6 +269,9 @@ Storage.prototype._onPieceDone = function (piece) {
Storage.prototype._onFileDone = function (file) {
var self = this
self.emit('file', file)
+
+ // TODO
+ self.emit('done')
}
function sha1 (buf) {