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-05-18 02:35:11 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-05-18 02:35:11 +0300
commit4309d70fb2473e0097bed3b0b7525579de4a52a4 (patch)
tree02aaadd20685170b4a7ce10d2d926b3f4e8fdbc4 /lib/file-stream.js
parent1dae3cba494c0371012a8b781573279af4c75fe9 (diff)
remove torrent from client on fatal torrent error
also, fixed a bug with choking where we were inspecting wire._destroyed instead of wire.destroyed.
Diffstat (limited to 'lib/file-stream.js')
-rw-r--r--lib/file-stream.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/file-stream.js b/lib/file-stream.js
index 5ea5bc2..4d34dca 100644
--- a/lib/file-stream.js
+++ b/lib/file-stream.js
@@ -26,6 +26,7 @@ function FileStream (file, opts) {
if (!opts.start) opts.start = 0
if (!opts.end) opts.end = file.length - 1
+ self.destroyed = false
self.length = opts.end - opts.start + 1
var offset = opts.start + file.offset
@@ -40,7 +41,6 @@ function FileStream (file, opts) {
self._missing = self.length
self._reading = false
self._notifying = false
- self._destroyed = false
self._criticalLength = Math.min((1024 * 1024 / pieceLength) | 0, 2)
self._offset = offset - (self.startPiece * pieceLength)
}
@@ -71,7 +71,7 @@ FileStream.prototype.notify = function () {
debug('after read %s (length %s) (err %s)', p, buffer.length, err && err.message)
self._notifying = false
- if (self._destroyed) return
+ if (self.destroyed) return
if (err) {
self._storage.emit('error', err)
@@ -115,6 +115,6 @@ FileStream.prototype.pipe = function (dst) {
FileStream.prototype.destroy = function () {
var self = this
- if (self._destroyed) return
- self._destroyed = true
+ if (self.destroyed) return
+ self.destroyed = true
}