Skip to content

Commit

Permalink
Merge pull request #2611 from murgatroid99/grpc-js_goaway_null_data
Browse files Browse the repository at this point in the history
grpc-js: Handle unset opaqueData in goaway event
  • Loading branch information
murgatroid99 committed Nov 14, 2023
2 parents 993835a + bf2009a commit 056738f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/grpc-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "1.9.9",
"version": "1.9.10",
"description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
Expand Down
5 changes: 3 additions & 2 deletions packages/grpc-js/src/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,18 @@ class Http2Transport implements Transport {
});
session.once(
'goaway',
(errorCode: number, lastStreamID: number, opaqueData: Buffer) => {
(errorCode: number, lastStreamID: number, opaqueData?: Buffer) => {
let tooManyPings = false;
/* See the last paragraph of
* https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md#basic-keepalive */
if (
errorCode === http2.constants.NGHTTP2_ENHANCE_YOUR_CALM &&
opaqueData &&
opaqueData.equals(tooManyPingsData)
) {
tooManyPings = true;
}
this.trace('connection closed by GOAWAY with code ' + errorCode);
this.trace('connection closed by GOAWAY with code ' + errorCode + ' and data ' + opaqueData?.toString());
this.reportDisconnectToOwner(tooManyPings);
}
);
Expand Down

0 comments on commit 056738f

Please sign in to comment.