From 560f657957e13e180ecd05abb9afa1432870fa43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=88=9A?= Date: Sun, 14 Jan 2018 23:34:18 +0800 Subject: [PATCH] stream: delete redundant code In `Writable.prototype.end()`, `state.ending` is true after calling `endWritable()` and it doesn't reset to false. In `Writable.prototype.uncork()`, `state.finished` must be false if `state.bufferedRequest` is true. PR-URL: https://github.com/nodejs/node/pull/18145 Reviewed-By: Ruben Bridgewater Reviewed-By: Matteo Collina --- lib/_stream_writable.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 895563bb39de25..b259d31cd9fcde 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -307,7 +307,6 @@ Writable.prototype.uncork = function() { if (!state.writing && !state.corked && - !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); @@ -579,7 +578,7 @@ Writable.prototype.end = function(chunk, encoding, cb) { } // ignore unnecessary end() calls. - if (!state.ending && !state.finished) + if (!state.ending) endWritable(this, state, cb); };