Skip to content

Commit 9b8abb8

Browse files
authored
fix: Fixed the issue that there is no running request when http2 goaway (#3875)
1 parent 43bfeb4 commit 9b8abb8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/dispatcher/client-h2.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,12 @@ function onHttp2SessionGoAway (errorCode) {
203203
util.destroy(this[kSocket], err)
204204

205205
// Fail head of pipeline.
206-
const request = client[kQueue][client[kRunningIdx]]
207-
client[kQueue][client[kRunningIdx]++] = null
208-
util.errorRequest(client, request, err)
209-
210-
client[kPendingIdx] = client[kRunningIdx]
206+
if (client[kRunningIdx] < client[kQueue].length) {
207+
const request = client[kQueue][client[kRunningIdx]]
208+
client[kQueue][client[kRunningIdx]++] = null
209+
util.errorRequest(client, request, err)
210+
client[kPendingIdx] = client[kRunningIdx]
211+
}
211212

212213
assert(client[kRunning] === 0)
213214

0 commit comments

Comments
 (0)