Skip to content

Commit be8cd0a

Browse files
[Backport v6.x] fix: Fixed the issue that there is no running request when http2 goaway (#3877)
Co-authored-by: 沈鸿飞 <[email protected]>
1 parent ee6176c commit be8cd0a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/dispatcher/client-h2.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,12 @@ function onHTTP2GoAway (code) {
242242
util.destroy(this[kSocket], err)
243243

244244
// Fail head of pipeline.
245-
const request = client[kQueue][client[kRunningIdx]]
246-
client[kQueue][client[kRunningIdx]++] = null
247-
util.errorRequest(client, request, err)
248-
249-
client[kPendingIdx] = client[kRunningIdx]
245+
if (client[kRunningIdx] < client[kQueue].length) {
246+
const request = client[kQueue][client[kRunningIdx]]
247+
client[kQueue][client[kRunningIdx]++] = null
248+
util.errorRequest(client, request, err)
249+
client[kPendingIdx] = client[kRunningIdx]
250+
}
250251

251252
assert(client[kRunning] === 0)
252253

0 commit comments

Comments
 (0)