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
path: root/lib
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-07-07 22:01:08 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-07-07 22:01:08 +0300
commit23e7977f42307006c1b99139e47c7aa32d3adadb (patch)
tree87f0df041775e528d691ea48af42334478c21b28 /lib
parentd60548fdc7bab4069a7864c9392b19e58d09a693 (diff)
parentdc7a3172c7b7357b877779e9e7423ecdeabf5b4f (diff)
Merge branch 'astro-storage-leakfix'
Diffstat (limited to 'lib')
-rw-r--r--lib/fs-storage.js1
-rw-r--r--lib/storage.js9
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)