bittorrent-dht
Advanced tools
Comparing version 2.7.0 to 2.7.1
@@ -137,4 +137,4 @@ module.exports = DHT | ||
// the user will call addNode() to populate the routing table manually. | ||
self.ready = true | ||
self.emit('ready') | ||
self.ready = true | ||
self.emit('ready') | ||
} else if (typeof opts.bootstrap === 'string') { | ||
@@ -178,4 +178,3 @@ self._bootstrap([ opts.bootstrap ]) | ||
if (onlistening) | ||
self.once('listening', onlistening) | ||
if (onlistening) self.once('listening', onlistening) | ||
@@ -235,3 +234,2 @@ if (self._destroyed || self._binding || self.listening) return | ||
/** | ||
@@ -324,5 +322,7 @@ * Destroy and cleanup the DHT. | ||
var peers = self.peers[infoHash] | ||
if (!peers) peers = self.peers[infoHash] = { | ||
index: {}, // addr -> true | ||
list: [] // compactAddr | ||
if (!peers) { | ||
peers = self.peers[infoHash] = { | ||
index: {}, // addr -> true | ||
list: [] // compactAddr | ||
} | ||
} | ||
@@ -444,9 +444,11 @@ | ||
var addrData = addrToIPPort(contact.addr) | ||
if (isIP(addrData[0])) | ||
if (isIP(addrData[0])) { | ||
cb(null, contact) | ||
else dns.lookup(addrData[0], self.ipv, function (err, host) { | ||
if (err) return cb(null, null) | ||
contact.addr = host + ':' + addrData[1] | ||
cb(null, contact) | ||
}) | ||
} else { | ||
dns.lookup(addrData[0], self.ipv, function (err, host) { | ||
if (err) return cb(null, null) | ||
contact.addr = host + ':' + addrData[1] | ||
cb(null, contact) | ||
}) | ||
} | ||
} | ||
@@ -495,7 +497,9 @@ }) | ||
// NOT the same table as the one used for the lookup, as that table may have nodes without tokens | ||
if (!self.tables[idHex]) self.tables[idHex] = new KBucket({ | ||
localNodeId: id, | ||
numberOfNodesPerKBucket: K, | ||
numberOfNodesToPing: MAX_CONCURRENCY | ||
}) | ||
if (!self.tables[idHex]) { | ||
self.tables[idHex] = new KBucket({ | ||
localNodeId: id, | ||
numberOfNodesPerKBucket: K, | ||
numberOfNodesToPing: MAX_CONCURRENCY | ||
}) | ||
} | ||
@@ -502,0 +506,0 @@ var tokenful = self.tables[idHex] |
{ | ||
"name": "bittorrent-dht", | ||
"description": "Simple, robust, BitTorrent DHT implementation", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"author": { | ||
@@ -15,3 +15,3 @@ "name": "Feross Aboukhadijeh", | ||
"addr-to-ip-port": "^1.0.0", | ||
"bencode": "^0.6.0", | ||
"bencode": "^0.7.0", | ||
"buffer-equal": "^0.0.1", | ||
@@ -30,3 +30,4 @@ "compact2string": "^1.2.0", | ||
"ip": "^0.3.0", | ||
"tape": "^2.12.3" | ||
"standard": "^2.0.0", | ||
"tape": "^3.5.0" | ||
}, | ||
@@ -51,5 +52,5 @@ "homepage": "http://webtorrent.io", | ||
"scripts": { | ||
"test": "tape test/*.js", | ||
"test": "standard && tape test/*.js", | ||
"test-live": "tape test/live/*.js" | ||
} | ||
} |
@@ -185,3 +185,2 @@ var common = require('./common') | ||
var infoHash = common.randomId() | ||
var host = | ||
@@ -204,2 +203,2 @@ dht1.listen(function (port) { | ||
}) | ||
}) | ||
}) |
@@ -126,2 +126,1 @@ var common = require('./common') | ||
}) | ||
57059
1525
3
+ Addedbencode@0.7.0(transitive)
- Removedbencode@0.6.0(transitive)
Updatedbencode@^0.7.0