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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
  • Loading branch information
陈刚 authored and MylesBorins committed Feb 21, 2018
1 parent 58003d4 commit 560f657
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 @@ -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);
};

Expand Down

0 comments on commit 560f657

Please sign in to comment.