Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this was not doing what it was supposed to. This code is written to handle the case where the server sends back a compact response, pulling out each individual byte (like compact2string does), which is already handled above. We just need the ip.toString() part only.

(ip[0] + '.' + ip[1] + '.' + ip[2] + '.' + ip[3]) :
ip.toString()
self.client.emit('peer', host + ':' + peer.port)
})
}
} else if (requestUrl === self._scrapeUrl) {
Expand Down