Skip to content

Commit

Permalink
Merge pull request webtorrent#1166 from aveday/master
Browse files Browse the repository at this point in the history
Raise error when streaming from a removed torrent
  • Loading branch information
DiegoRBaquero authored Sep 9, 2017
2 parents d8c5855 + c04a416 commit 1f80004
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/file-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ FileStream.prototype._notify = function () {
if (self._notifying) return
self._notifying = true

if (self._torrent.destroyed) return self._destroy(new Error('Torrent removed'))

var p = self._piece
self._torrent.store.get(p, function (err, buffer) {
self._notifying = false
Expand Down

0 comments on commit 1f80004

Please sign in to comment.