Skip to content

Commit e2568b0

Browse files
committed
fixup
1 parent 1f345b9 commit e2568b0

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

lib/core/client.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -376,23 +376,29 @@ class Parser extends HTTPParser {
376376
this.read = 0
377377
this.request = null
378378
this.paused = false
379+
this.resuming = false
379380
this.queue = []
380381

381382
this._resume = () => {
382-
if (!this.paused) {
383+
if (!this.paused || this.resuming) {
383384
return
384385
}
385386

386387
this.paused = false
387388

388-
while (this.queue.length) {
389-
const [fn, ...args] = this.queue.shift()
389+
this.resuming = true
390+
try {
391+
while (this.queue.length) {
392+
const [fn, ...args] = this.queue.shift()
390393

391-
Reflect.apply(fn, this, args)
394+
Reflect.apply(fn, this, args)
392395

393-
if (this.paused) {
394-
return
396+
if (this.paused) {
397+
return
398+
}
395399
}
400+
} finally {
401+
this.resuming = false
396402
}
397403

398404
socketResume(socket)

0 commit comments

Comments
 (0)