mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-19 04:31:36 +00:00
udp client: don't set a timer for stopped message
This commit is contained in:
parent
6f1aa981d4
commit
351f829104
12
index.js
12
index.js
@ -170,11 +170,17 @@ Tracker.prototype._requestUdp = function (requestUrl, opts) {
|
|||||||
var socket = dgram.createSocket('udp4')
|
var socket = dgram.createSocket('udp4')
|
||||||
var transactionId = new Buffer(hat(32), 'hex')
|
var transactionId = new Buffer(hat(32), 'hex')
|
||||||
|
|
||||||
var timeout = setTimeout(function () {
|
|
||||||
error('tracker request timed out')
|
|
||||||
}, 15000)
|
|
||||||
socket.unref()
|
socket.unref()
|
||||||
|
|
||||||
|
if (opts.event !== EVENTS.stopped) {
|
||||||
|
// if we're sending a stopped message, we don't really care if it arrives, so don't
|
||||||
|
// set a timer
|
||||||
|
var timeout = setTimeout(function () {
|
||||||
|
try { socket.close() } catch (err) {}
|
||||||
|
error('tracker request timed out')
|
||||||
|
}, 15000)
|
||||||
|
}
|
||||||
|
|
||||||
if (timeout.unref) {
|
if (timeout.unref) {
|
||||||
timeout.unref()
|
timeout.unref()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user