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>2015-01-09 08:29:19 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-01-09 08:29:19 +0300
commita9e84fd1bb48faff834716132181cb6c6a0ed999 (patch)
tree1859255b03162669ac6db28c9d935ec617cec726
parentd41cf29cf5e98034470193df9fd4bf18f9b5aeda (diff)
code style
-rw-r--r--lib/storage.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/storage.js b/lib/storage.js
index 4a3588e..570ae08 100644
--- a/lib/storage.js
+++ b/lib/storage.js
@@ -132,23 +132,24 @@ 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()
- })
+ return
}
+ var expectedHash
+ sha1(buffer, function (_expectedHash) {
+ expectedHash = _expectedHash
+ self.verified = (expectedHash === self.hash)
+ onResult()
+ })
+
function onResult () {
if (self.verified) {
self.emit('done')
} else {
- self.emit('warning', new Error('piece ' + self.index + ' failed verification; ' + expected_hash + ' expected ' + self.hash))
+ self.emit('warning', new Error('piece ' + self.index + ' failed verification; ' + expectedHash + ' expected ' + self.hash))
self._reset()
}
}