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
5 changes: 4 additions & 1 deletion lib/client/websocket-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ WebSocketTracker.prototype.destroy = function (cb) {
self.destroyed = true
clearInterval(self.interval)
clearTimeout(self.reconnectTimer)
self.reconnectTimer = null

self.socket.removeListener('connect', self._onSocketConnectBound)
self.socket.removeListener('data', self._onSocketDataBound)
Expand All @@ -111,7 +112,7 @@ WebSocketTracker.prototype.destroy = function (cb) {
clearTimeout(peer.trackerTimeout)
peer.destroy()
}
self.peers = null
self.peers = {}
Copy link
Member

Choose a reason for hiding this comment

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

Good catch!


if (socketPool[self.announceUrl]) {
socketPool[self.announceUrl].consumers -= 1
Expand All @@ -130,6 +131,8 @@ WebSocketTracker.prototype.destroy = function (cb) {
}

self.socket = null
self.reconnecting = false
Copy link
Member

Choose a reason for hiding this comment

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

This isn't correct. This boolean needs to stay true until a 'connect' event is fired. Setting it to false here defeats the point of it.

self.retries = 0
Copy link
Member

Choose a reason for hiding this comment

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

Same with retries

}

WebSocketTracker.prototype._openSocket = function () {
Expand Down