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-02-19 05:53:20 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-02-19 05:53:20 +0300
commit00e90243adb411ac5ee22356c8ab83d73823590d (patch)
tree51d3cfec3431ed30fb1344c13a2407f86a502a0a /index.js
parent5568275a645edcb6d647b5420231e16d5bbb099d (diff)
dht error should destroy the whole client
Diffstat (limited to 'index.js')
-rw-r--r--index.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/index.js b/index.js
index a3c5410..09b18b0 100644
--- a/index.js
+++ b/index.js
@@ -83,6 +83,10 @@ function WebTorrent (opts) {
if (opts.dht !== false && typeof DHT === 'function' /* browser exclude */) {
// use a single DHT instance for all torrents, so the routing table can be reused
self.dht = new DHT(extend({ nodeId: self.nodeId }, opts.dht))
+ self.dht.once('error', function (err) {
+ self.emit('error', err)
+ self.destroy()
+ })
self.dht.listen(opts.dhtPort)
} else {
self.dht = false