Merge pull request #1391 from murgatroid99/grpc-js_destroy_stream_fix

grpc-js: don't destroyHttp2Stream before saving the status code
This commit is contained in:
Michael Lumish 2020-04-24 10:12:25 -07:00 committed by GitHub
commit b4af434b37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -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() });
}