Skip to content

Commit

Permalink
http2: use writableFinished instead of _writableState
Browse files Browse the repository at this point in the history
PR-URL: nodejs#28007
Refs: nodejs#445
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
zero1five authored and Trott committed Jun 25, 2019
1 parent 33aef82 commit f11a4ec
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@ function closeStream(stream, code, rstStreamStatus = kSubmitRstStream) {
stream.setTimeout(0);
stream.removeAllListeners('timeout');

const { ending, finished } = stream._writableState;
const { ending } = stream._writableState;

if (!ending) {
// If the writable side of the Http2Stream is still open, emit the
Expand All @@ -1572,7 +1572,7 @@ function closeStream(stream, code, rstStreamStatus = kSubmitRstStream) {

if (rstStreamStatus !== kNoRstStream) {
const finishFn = finishCloseStream.bind(stream, code);
if (!ending || finished || code !== NGHTTP2_NO_ERROR ||
if (!ending || stream.writableFinished || code !== NGHTTP2_NO_ERROR ||
rstStreamStatus === kForceRstStream)
finishFn();
else
Expand Down Expand Up @@ -1982,8 +1982,7 @@ class Http2Stream extends Duplex {
return;
}

// TODO(mcollina): remove usage of _*State properties
if (this._writableState.finished) {
if (this.writableFinished) {
if (!this.readable && this.closed) {
this.destroy();
return;
Expand Down

0 comments on commit f11a4ec

Please sign in to comment.