diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 9d06adc775d240..83fd6d1f4d4697 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -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; @@ -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);