mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2024-12-14 03:16:24 +00:00
handle case where server returns ip in square brackets
This commit is contained in:
parent
b079bad35a
commit
d7c4af4ce8
@ -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)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user