We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f1aa98 commit 351f829Copy full SHA for 351f829
index.js
@@ -170,11 +170,17 @@ Tracker.prototype._requestUdp = function (requestUrl, opts) {
170
var socket = dgram.createSocket('udp4')
171
var transactionId = new Buffer(hat(32), 'hex')
172
173
- var timeout = setTimeout(function () {
174
- error('tracker request timed out')
175
- }, 15000)
176
socket.unref()
177
+ 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
178
+ var timeout = setTimeout(function () {
179
+ try { socket.close() } catch (err) {}
180
+ error('tracker request timed out')
181
+ }, 15000)
182
+ }
183
+
184
if (timeout.unref) {
185
timeout.unref()
186
}
0 commit comments