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>2016-04-24 03:50:00 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-04-24 03:50:00 +0300
commit675ed147b0b53549a2dbc82eaff4660c60425d80 (patch)
tree9e8db12a4def42c2dc4dc9f8c785bd06b07de624
parentbd6e21408d08a4749ac9797ad3b0bf56f45ea8bf (diff)
emit 'done' after tracker 'complete' is sent
Fix CLI crash
-rw-r--r--lib/torrent.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/torrent.js b/lib/torrent.js
index f24b52c..03fa0db 100644
--- a/lib/torrent.js
+++ b/lib/torrent.js
@@ -1466,9 +1466,11 @@ Torrent.prototype._checkDone = function () {
}
if (!self.done && done) {
self.done = true
- self.emit('done')
self._debug('torrent done: ' + self.infoHash)
- if (self.discovery.tracker) self.discovery.tracker.complete()
+ if (self.discovery.tracker) {
+ self.discovery.tracker.complete()
+ }
+ self.emit('done')
}
self._gcSelections()