From b36eb756e7ce7af4b15750e3ba562e01017d3714 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Thu, 16 Apr 2020 20:48:41 +0200 Subject: [PATCH] stream: inline unbuffered _write PR-URL: https://github.com/nodejs/node/pull/32886 Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Zeyu Yang Reviewed-By: Ruben Bridgewater --- lib/_stream_writable.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index d2739f5788a606..f494a623d5818e 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -371,7 +371,12 @@ function writeOrBuffer(stream, state, chunk, encoding, cb) { } state.bufferedRequestCount += 1; } else { - doWrite(stream, state, false, len, chunk, encoding, cb); + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + stream._write(chunk, encoding, state.onwrite); + state.sync = false; } // Return false if errored or destroyed in order to break