From 4f1ea32f351d09f0e92aed2813e2c6f1bf16e31d Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 23 Nov 2014 01:26:36 +0100 Subject: [PATCH] client _handleResponse: allow string form of peer.ip --- client.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client.js b/client.js index ff6e0bf..9b358d8 100644 --- a/client.js +++ b/client.js @@ -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) {