client _handleResponse: allow string form of peer.ip

This commit is contained in:
Astro 2014-11-23 01:26:36 +01:00 committed by Feross Aboukhadijeh
parent 7376843920
commit 4f1ea32f35

View File

@ -497,8 +497,10 @@ Tracker.prototype._handleResponse = function (requestUrl, data) {
// tracker returned normal response
data.peers.forEach(function (peer) {
var ip = peer.ip
var addr = ip[0] + '.' + ip[1] + '.' + ip[2] + '.' + ip[3] + ':' + peer.port
self.client.emit('peer', addr)
var host = ip.length == 4 ?
(ip[0] + '.' + ip[1] + '.' + ip[2] + '.' + ip[3]) :
ip.toString()
self.client.emit('peer', host + ':' + peer.port)
})
}
} else if (requestUrl === self._scrapeUrl) {