Skip to content

Commit

Permalink
stream: inline onwriteStateUpdate()
Browse files Browse the repository at this point in the history
The function is very simple and is only called from `onwrite()`.

PR-URL: #27203
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Masashi Hirano <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
  • Loading branch information
lpinca authored and danbev committed Apr 16, 2019
1 parent de463f1 commit 53e0f63
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/_stream_writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,13 +442,6 @@ function onwriteError(stream, state, sync, er, cb) {
}
}

function onwriteStateUpdate(state) {
state.writing = false;
state.writecb = null;
state.length -= state.writelen;
state.writelen = 0;
}

function onwrite(stream, er) {
const state = stream._writableState;
const sync = state.sync;
Expand All @@ -457,7 +450,10 @@ function onwrite(stream, er) {
if (typeof cb !== 'function')
throw new ERR_MULTIPLE_CALLBACK();

onwriteStateUpdate(state);
state.writing = false;
state.writecb = null;
state.length -= state.writelen;
state.writelen = 0;

if (er)
onwriteError(stream, state, sync, er, cb);
Expand Down

0 comments on commit 53e0f63

Please sign in to comment.