diff options
author | Anthony MOI <anthony@totems.co> | 2015-01-08 19:33:11 +0300 |
---|---|---|
committer | Anthony MOI <anthony@totems.co> | 2015-01-08 19:33:11 +0300 |
commit | f3b84a6bc5fa72b67a62f91033bd3baf68cb4fda (patch) | |
tree | 4d4681d7b420c965faf71a5eab5b8b0c9075d02e /lib | |
parent | 5c3227d3f12e7ea649f8e0cdb4b23d3a4e7f08c5 (diff) |
fix Piece.verify method and update README with options available when adding a torrent
Diffstat (limited to 'lib')
-rw-r--r-- | lib/storage.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/storage.js b/lib/storage.js index cfaa825..4a3588e 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -132,12 +132,14 @@ Piece.prototype.verify = function (buffer) { return } + var expected_hash if (self.noVerify) { self.verified = true onResult() } else { sha1(buffer, function (hash) { self.verified = (hash === self.hash) + expected_hash = hash onResult() }) } @@ -146,7 +148,7 @@ Piece.prototype.verify = function (buffer) { if (self.verified) { self.emit('done') } else { - self.emit('warning', new Error('piece ' + self.index + ' failed verification; ' + sha1(buffer) + ' expected ' + self.hash)) + self.emit('warning', new Error('piece ' + self.index + ' failed verification; ' + expected_hash + ' expected ' + self.hash)) self._reset() } } |