http2: use writableFinished instead of _writableState
PR-URL: https://github.com/nodejs/node/pull/28007 Refs: https://github.com/nodejs/node/issues/445 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
33aef82b42
commit
f11a4ec638
@ -1556,7 +1556,7 @@ function closeStream(stream, code, rstStreamStatus = kSubmitRstStream) {
|
|||||||
stream.setTimeout(0);
|
stream.setTimeout(0);
|
||||||
stream.removeAllListeners('timeout');
|
stream.removeAllListeners('timeout');
|
||||||
|
|
||||||
const { ending, finished } = stream._writableState;
|
const { ending } = stream._writableState;
|
||||||
|
|
||||||
if (!ending) {
|
if (!ending) {
|
||||||
// If the writable side of the Http2Stream is still open, emit the
|
// 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) {
|
if (rstStreamStatus !== kNoRstStream) {
|
||||||
const finishFn = finishCloseStream.bind(stream, code);
|
const finishFn = finishCloseStream.bind(stream, code);
|
||||||
if (!ending || finished || code !== NGHTTP2_NO_ERROR ||
|
if (!ending || stream.writableFinished || code !== NGHTTP2_NO_ERROR ||
|
||||||
rstStreamStatus === kForceRstStream)
|
rstStreamStatus === kForceRstStream)
|
||||||
finishFn();
|
finishFn();
|
||||||
else
|
else
|
||||||
@ -1982,8 +1982,7 @@ class Http2Stream extends Duplex {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(mcollina): remove usage of _*State properties
|
if (this.writableFinished) {
|
||||||
if (this._writableState.finished) {
|
|
||||||
if (!this.readable && this.closed) {
|
if (!this.readable && this.closed) {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user