mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-18 12:11:36 +00:00
standard
This commit is contained in:
parent
c88bbb4a62
commit
2a828292b8
@ -81,12 +81,14 @@ class HTTPTracker extends Tracker {
|
||||
this.destroyed = true
|
||||
clearInterval(this.interval)
|
||||
|
||||
let timeout
|
||||
|
||||
// If there are no pending requests, destroy immediately.
|
||||
if (this.cleanupFns.length === 0) return destroyCleanup()
|
||||
|
||||
// Otherwise, wait a short time for pending requests to complete, then force
|
||||
// destroy them.
|
||||
let timeout = setTimeout(destroyCleanup, common.DESTROY_TIMEOUT)
|
||||
timeout = setTimeout(destroyCleanup, common.DESTROY_TIMEOUT)
|
||||
|
||||
// But, if all pending requests complete before the timeout fires, do cleanup
|
||||
// right away.
|
||||
|
@ -41,12 +41,14 @@ class UDPTracker extends Tracker {
|
||||
this.destroyed = true
|
||||
clearInterval(this.interval)
|
||||
|
||||
let timeout
|
||||
|
||||
// If there are no pending requests, destroy immediately.
|
||||
if (this.cleanupFns.length === 0) return destroyCleanup()
|
||||
|
||||
// Otherwise, wait a short time for pending requests to complete, then force
|
||||
// destroy them.
|
||||
let timeout = setTimeout(destroyCleanup, common.DESTROY_TIMEOUT)
|
||||
timeout = setTimeout(destroyCleanup, common.DESTROY_TIMEOUT)
|
||||
|
||||
// But, if all pending requests complete before the timeout fires, do cleanup
|
||||
// right away.
|
||||
|
@ -129,12 +129,14 @@ class WebSocketTracker extends Tracker {
|
||||
socket.on('error', noop) // ignore all future errors
|
||||
socket.once('close', cb)
|
||||
|
||||
let timeout
|
||||
|
||||
// If there is no data response expected, destroy immediately.
|
||||
if (!this.expectingResponse) return destroyCleanup()
|
||||
|
||||
// Otherwise, wait a short time for potential responses to come in from the
|
||||
// server, then force close the socket.
|
||||
let timeout = setTimeout(destroyCleanup, common.DESTROY_TIMEOUT)
|
||||
timeout = setTimeout(destroyCleanup, common.DESTROY_TIMEOUT)
|
||||
|
||||
// But, if a response comes from the server before the timeout fires, do cleanup
|
||||
// right away.
|
||||
|
Loading…
Reference in New Issue
Block a user