Skip to content

Commit

Permalink
stream: delete redundant code
Browse files Browse the repository at this point in the history
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: #18145
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
陈刚 authored and rvagg committed Aug 16, 2018
1 parent ab967b7 commit af27768
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/_stream_writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ Writable.prototype.uncork = function() {

if (!state.writing &&
!state.corked &&
!state.finished &&
!state.bufferProcessing &&
state.bufferedRequest)
clearBuffer(this, state);
Expand Down Expand Up @@ -569,7 +568,7 @@ Writable.prototype.end = function(chunk, encoding, cb) {
}

// ignore unnecessary end() calls.
if (!state.ending && !state.finished)
if (!state.ending)
endWritable(this, state, cb);
};

Expand Down

0 comments on commit af27768

Please sign in to comment.