Skip to content

Commit 2a82829

Browse files
committed
standard
1 parent c88bbb4 commit 2a82829

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

lib/client/http-tracker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ class HTTPTracker extends Tracker {
8181
this.destroyed = true
8282
clearInterval(this.interval)
8383

84+
let timeout
85+
8486
// If there are no pending requests, destroy immediately.
8587
if (this.cleanupFns.length === 0) return destroyCleanup()
8688

8789
// Otherwise, wait a short time for pending requests to complete, then force
8890
// destroy them.
89-
let timeout = setTimeout(destroyCleanup, common.DESTROY_TIMEOUT)
91+
timeout = setTimeout(destroyCleanup, common.DESTROY_TIMEOUT)
9092

9193
// But, if all pending requests complete before the timeout fires, do cleanup
9294
// right away.

lib/client/udp-tracker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ class UDPTracker extends Tracker {
4141
this.destroyed = true
4242
clearInterval(this.interval)
4343

44+
let timeout
45+
4446
// If there are no pending requests, destroy immediately.
4547
if (this.cleanupFns.length === 0) return destroyCleanup()
4648

4749
// Otherwise, wait a short time for pending requests to complete, then force
4850
// destroy them.
49-
let timeout = setTimeout(destroyCleanup, common.DESTROY_TIMEOUT)
51+
timeout = setTimeout(destroyCleanup, common.DESTROY_TIMEOUT)
5052

5153
// But, if all pending requests complete before the timeout fires, do cleanup
5254
// right away.

lib/client/websocket-tracker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ class WebSocketTracker extends Tracker {
129129
socket.on('error', noop) // ignore all future errors
130130
socket.once('close', cb)
131131

132+
let timeout
133+
132134
// If there is no data response expected, destroy immediately.
133135
if (!this.expectingResponse) return destroyCleanup()
134136

135137
// Otherwise, wait a short time for potential responses to come in from the
136138
// server, then force close the socket.
137-
let timeout = setTimeout(destroyCleanup, common.DESTROY_TIMEOUT)
139+
timeout = setTimeout(destroyCleanup, common.DESTROY_TIMEOUT)
138140

139141
// But, if a response comes from the server before the timeout fires, do cleanup
140142
// right away.

0 commit comments

Comments
 (0)