diff options
author | fisch0920 <fisch0920@gmail.com> | 2014-05-31 08:38:13 +0400 |
---|---|---|
committer | fisch0920 <fisch0920@gmail.com> | 2014-05-31 08:38:13 +0400 |
commit | 831ede0b798da55047fb10b13b11fdc8fc531160 (patch) | |
tree | 91b7317688066d1bf7b5238099eee1efdf12aa0e /lib/fs_storage.js | |
parent | 32bac0c2cd3a2b2af99c9caf90b0d68db0c1b42b (diff) |
changes to support resuming torrents via initial piece verification; also includes a slight optimization to separate opening an fs file for reading vs writing
Diffstat (limited to 'lib/fs_storage.js')
-rw-r--r-- | lib/fs_storage.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/fs_storage.js b/lib/fs_storage.js index ae0232e..a2bdcd0 100644 --- a/lib/fs_storage.js +++ b/lib/fs_storage.js @@ -149,10 +149,16 @@ FSStorage.prototype._onPieceDone = function (piece) { var end = targets.length var i = 0 + function cb () { + Storage.prototype._onPieceDone.call(self, piece) + } + + if (!piece.buffer || self.readonly) return cb() + var writeToNextFile = function (err) { if (err) return self.emit('error', err) if (i >= end) { - return Storage.prototype._onPieceDone.call(self, piece) + return cb() } var target = targets[i++] |