fix: race-condition in electron.net (#27898)
This commit is contained in:
parent
d57fd6cef0
commit
a9b25dda85
1 changed files with 5 additions and 2 deletions
|
@ -119,10 +119,13 @@ class IncomingMessage extends Readable {
|
||||||
this._shouldPush = this.push(chunk);
|
this._shouldPush = this.push(chunk);
|
||||||
}
|
}
|
||||||
if (this._shouldPush && this._resume) {
|
if (this._shouldPush && this._resume) {
|
||||||
this._resume();
|
|
||||||
// Reset the callback, so that a new one is used for each
|
// Reset the callback, so that a new one is used for each
|
||||||
// batch of throttled data
|
// batch of throttled data. Do this before calling resume to avoid a
|
||||||
|
// potential race-condition
|
||||||
|
const resume = this._resume;
|
||||||
this._resume = null;
|
this._resume = null;
|
||||||
|
|
||||||
|
resume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue