From d7c4af4ce8ceff674bbcf93a941c7284703dd8c0 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 26 Nov 2014 20:18:44 +0800 Subject: [PATCH] handle case where server returns ip in square brackets --- client.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client.js b/client.js index 2b923d7..1681a4a 100644 --- a/client.js +++ b/client.js @@ -513,9 +513,9 @@ Tracker.prototype._handleResponse = function (requestUrl, data) { } else if (Array.isArray(data.peers6)) { // tracker returned normal response data.peers.forEach(function (peer) { - var ip = /:/.test(peer.ip) ? - '[' + peer.ip + ']' : - peer.ip + var ip = /^\[/.test(peer.ip) + ? peer.ip + : '[' + peer.ip + ']' self.client.emit('peer', ip + ':' + peer.port) }) }