diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 8c05ff626792d7..63f9da5564d6d8 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -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 @@ -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 @@ -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;