diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fs-storage.js | 1 | ||||
-rw-r--r-- | lib/storage.js | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/fs-storage.js b/lib/fs-storage.js index 51e5ea5..14b423e 100644 --- a/lib/fs-storage.js +++ b/lib/fs-storage.js @@ -156,6 +156,7 @@ FSStorage.prototype._onPieceDone = function (piece) { var writeToNextFile = function (err) { if (err) return self.emit('error', err) if (i >= end) { + delete piece.buffer return cb() } diff --git a/lib/storage.js b/lib/storage.js index 805c498..d13e116 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -1,4 +1,4 @@ -module.exports = Storage +module.exports = exports = Storage var BitField = require('bitfield') var BlockStream = require('block-stream2') @@ -16,9 +16,10 @@ var sha1 = require('simple-sha1') var BLOCK_LENGTH = 16 * 1024 -var BLOCK_BLANK = 0 -var BLOCK_RESERVED = 1 -var BLOCK_WRITTEN = 2 +var BLOCK_BLANK = exports.BLOCK_BLANK = 0 +var BLOCK_RESERVED = exports.BLOCK_RESERVED = 1 +var BLOCK_WRITTEN = exports.BLOCK_WRITTEN = 2 + function noop () {} inherits(Piece, EventEmitter) |