Skip to content

Commit

Permalink
fix: race-condition in electron.net (#27938)
Browse files Browse the repository at this point in the history
  • Loading branch information
VerteDinde committed Mar 1, 2021
1 parent 0baf999 commit e7e1801
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/browser/api/net.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,13 @@ class IncomingMessage extends Readable {
this._shouldPush = this.push(chunk);
}
if (this._shouldPush && this._resume) {
this._resume();
// 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;

resume();
}
}

Expand Down

0 comments on commit e7e1801

Please sign in to comment.