diff options
author | John Hiesey <john@hiesey.com> | 2021-07-14 00:04:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-14 00:04:18 +0300 |
commit | b035cbe9ea59d3fcfc6467dcf4f2f49da2f7c3d8 (patch) | |
tree | b801bab04e39a5c450fb207860158340974d9873 | |
parent | fb241986d8547b0cd335148d957655e500306000 (diff) |
fix: call public FileStream.destroy method so cb is defined (#2135)
Previously, early exits in FileStream._notify would
throw since cb was not defined in _destroy
-rw-r--r-- | lib/file-stream.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/file-stream.js b/lib/file-stream.js index b499754..e7dee68 100644 --- a/lib/file-stream.js +++ b/lib/file-stream.js @@ -59,7 +59,7 @@ class FileStream extends stream.Readable { if (this._notifying) return this._notifying = true - if (this._torrent.destroyed) return this._destroy(new Error('Torrent removed')) + if (this._torrent.destroyed) return this.destroy(new Error('Torrent removed')) const p = this._piece @@ -73,7 +73,7 @@ class FileStream extends stream.Readable { if (this.destroyed) return debug('read %s (length %s) (err %s)', p, buffer && buffer.length, err && err.message) - if (err) return this._destroy(err) + if (err) return this.destroy(err) if (this._offset) { buffer = buffer.slice(this._offset) |