From cf0a90f9da50a1c4663d11786dec61ee7db1586a Mon Sep 17 00:00:00 2001 From: Michael Lumish Date: Thu, 23 Apr 2020 14:17:07 -0700 Subject: [PATCH] grpc-js: don't destroyHttp2Stream before saving the status code --- packages/grpc-js/src/call-stream.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/grpc-js/src/call-stream.ts b/packages/grpc-js/src/call-stream.ts index 9ceebdbf..ca3049e7 100644 --- a/packages/grpc-js/src/call-stream.ts +++ b/packages/grpc-js/src/call-stream.ts @@ -249,7 +249,6 @@ export class Http2CallStream implements Call { * @param status The status of the call. */ private endCall(status: StatusObject): void { - this.destroyHttp2Stream(); /* If the status is OK and a new status comes in (e.g. from a * deserialization failure), that new status takes priority */ if (this.finalStatus === null || this.finalStatus.code === Status.OK) { @@ -263,6 +262,7 @@ export class Http2CallStream implements Call { this.finalStatus = status; this.maybeOutputStatus(); } + this.destroyHttp2Stream(); } private maybeOutputStatus() { @@ -467,7 +467,6 @@ export class Http2CallStream implements Call { const finalMetadata = this.filterStack.receiveMetadata(metadata); this.listener!.onReceiveMetadata(finalMetadata); } catch (error) { - this.destroyHttp2Stream(); this.endCall({ code: Status.UNKNOWN, details: error.message, @@ -588,7 +587,6 @@ export class Http2CallStream implements Call { this.trace( 'cancelWithStatus code: ' + status + ' details: "' + details + '"' ); - this.destroyHttp2Stream(); this.endCall({ code: status, details, metadata: new Metadata() }); }