Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/grpc-js/src/call-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,12 +638,12 @@ export class Http2CallStream implements Call {
* RST_STREAM as a result after we have the status */
let code: number;
if (this.finalStatus?.code === Status.OK) {
code = http2.constants.NGHTTP2_NO_ERROR;
this.http2Stream.close(http2.constants.NGHTTP2_NO_ERROR);
this.trace('close http2 stream with code ' + http2.constants.NGHTTP2_NO_ERROR);
} else {
code = http2.constants.NGHTTP2_CANCEL;
this.http2Stream.destroy(new Error('Stream error'));
this.trace('destroy http2 stream after error ');
}
this.trace('close http2 stream with code ' + code);
this.http2Stream.close(code);
}
}

Expand Down
3 changes: 3 additions & 0 deletions packages/grpc-js/src/subchannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,9 @@ export class Subchannel {
}
logging.trace(LogVerbosity.DEBUG, 'call_stream', 'Starting stream on subchannel ' + this.subchannelAddressString + ' with headers\n' + headersString);
callStream.attachHttp2Stream(http2Stream, this, extraFilterFactory);
http2Stream.on('error', () => {
this.session?.close();
});
}

/**
Expand Down