more cleanup

This commit is contained in:
Feross Aboukhadijeh 2015-12-05 03:06:54 -08:00
parent 3f1c9644ec
commit 8d735bf97d

View File

@ -208,6 +208,7 @@ WebSocketTracker.prototype._onSocketData = function (data) {
self.client.emit('peer', peer)
clearTimeout(peer.trackerTimeout)
peer.trackerTimeout = null
self.peers[offerId] = null
} else {
debug('got unexpected answer: ' + JSON.stringify(data.answer))
@ -279,8 +280,10 @@ WebSocketTracker.prototype._generateOffers = function (numwant, cb) {
checkDone()
})
peer.trackerTimeout = setTimeout(function () {
peer.destroy()
debug('tracker timeout: destroying peer')
peer.trackerTimeout = null
self.peers[offerId] = null
peer.destroy()
}, OFFER_TIMEOUT)
}