stream: cleanup use of internal ended state

PR-URL: https://github.com/nodejs/node/pull/29645
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Chetan Karande 2019-09-21 10:12:13 -04:00 committed by Daniel Bevenius
parent 06929956f9
commit fed05cc414
3 changed files with 4 additions and 4 deletions

View File

@ -303,7 +303,7 @@ class Http2ServerRequest extends Readable {
get complete() {
return this[kAborted] ||
this._readableState.ended ||
this.readableEnded ||
this[kState].closed ||
this[kStream].destroyed;
}

View File

@ -207,11 +207,11 @@ class Worker extends EventEmitter {
const { stdout, stderr } = this[kParentSideStdio];
if (!stdout._readableState.ended) {
if (!stdout.readableEnded) {
debug(`[${threadId}] explicitly closes stdout for ${this.threadId}`);
stdout.push(null);
}
if (!stderr._readableState.ended) {
if (!stderr.readableEnded) {
debug(`[${threadId}] explicitly closes stderr for ${this.threadId}`);
stderr.push(null);
}

View File

@ -422,7 +422,7 @@ function afterShutdown(status) {
if (self.destroyed)
return;
if (!self.readable || self._readableState.ended) {
if (!self.readable || self.readableEnded) {
debug('readableState ended, destroying');
self.destroy();
}