Skip to content

Commit af631d9

Browse files
committed
Merge remote-tracking branch 'upstream/master' into client-infos
2 parents 2f37e6c + 18de340 commit af631d9

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
img.png

lib/client/websocket-tracker.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ WebSocketTracker.prototype.destroy = function (onclose) {
7070
self.destroyed = true
7171
clearInterval(self.interval)
7272

73-
socketPool[self.announceUrl] = null
73+
delete socketPool[self.announceUrl]
7474

7575
self.socket.removeListener('connect', self._onSocketConnectBound)
7676
self.socket.removeListener('data', self._onSocketDataBound)
@@ -208,7 +208,7 @@ WebSocketTracker.prototype._onSocketData = function (data) {
208208

209209
clearTimeout(peer.trackerTimeout)
210210
peer.trackerTimeout = null
211-
self.peers[offerId] = null
211+
delete self.peers[offerId]
212212
} else {
213213
debug('got unexpected answer: ' + JSON.stringify(data.answer))
214214
}
@@ -281,7 +281,7 @@ WebSocketTracker.prototype._generateOffers = function (numwant, cb) {
281281
peer.trackerTimeout = setTimeout(function () {
282282
debug('tracker timeout: destroying peer')
283283
peer.trackerTimeout = null
284-
self.peers[offerId] = null
284+
delete self.peers[offerId]
285285
peer.destroy()
286286
}, OFFER_TIMEOUT)
287287
}

lib/server/swarm.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Swarm.prototype._onAnnounceStopped = function (params, peer) {
7070
if (peer.complete) this.complete -= 1
7171
else this.incomplete -= 1
7272
var id = params.type === common.PEER_TYPES.websocket ? params.peer_id : params.addr
73-
this.peers[id] = null
73+
delete this.peers[id]
7474
}
7575

7676
Swarm.prototype._onAnnounceCompleted = function (params, peer) {
@@ -107,7 +107,6 @@ Swarm.prototype._getPeers = function (numwant, ownPeerId, isWebRTC) {
107107
var peerId
108108
while ((peerId = ite()) && peers.length < numwant) {
109109
var peer = this.peers[peerId]
110-
if (!peer) continue
111110
if (isWebRTC && peer.peerId === ownPeerId) continue // don't send peer to itself
112111
if ((isWebRTC && peer.ip) || (!isWebRTC && peer.socket)) continue // send proper peer type
113112
peers.push(peer)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bittorrent-tracker",
33
"description": "Simple, robust, BitTorrent tracker (client & server) implementation",
4-
"version": "7.3.2",
4+
"version": "7.3.4",
55
"author": {
66
"name": "Feross Aboukhadijeh",
77
"email": "[email protected]",

0 commit comments

Comments
 (0)