From 4aff6a7e177c8ce2f7b407d6224d81f263a05434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=88=9A?= Date: Mon, 15 Jan 2018 14:45:11 +0800 Subject: [PATCH] stream: delete redundant code `state.corkedRequestsFree` of a writable stream is always not null. PR-URL: https://github.com/nodejs/node/pull/18145 Reviewed-By: Ruben Bridgewater Reviewed-By: Matteo Collina --- lib/_stream_writable.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index b259d31cd9fcde..9c1b32b81dc957 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -657,11 +657,9 @@ function onCorkedFinish(corkReq, state, err) { cb(err); entry = entry.next; } - if (state.corkedRequestsFree) { - state.corkedRequestsFree.next = corkReq; - } else { - state.corkedRequestsFree = corkReq; - } + + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; } Object.defineProperty(Writable.prototype, 'destroyed', {