Skip to content

Commit bf2009a

Browse files
committed
grpc-js: Handle unset opaqueData in goaway event
1 parent 51b0f66 commit bf2009a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/grpc-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grpc/grpc-js",
3-
"version": "1.9.9",
3+
"version": "1.9.10",
44
"description": "gRPC Library for Node - pure JS implementation",
55
"homepage": "https://grpc.io/",
66
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

packages/grpc-js/src/transport.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,18 @@ class Http2Transport implements Transport {
194194
});
195195
session.once(
196196
'goaway',
197-
(errorCode: number, lastStreamID: number, opaqueData: Buffer) => {
197+
(errorCode: number, lastStreamID: number, opaqueData?: Buffer) => {
198198
let tooManyPings = false;
199199
/* See the last paragraph of
200200
* https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md#basic-keepalive */
201201
if (
202202
errorCode === http2.constants.NGHTTP2_ENHANCE_YOUR_CALM &&
203+
opaqueData &&
203204
opaqueData.equals(tooManyPingsData)
204205
) {
205206
tooManyPings = true;
206207
}
207-
this.trace('connection closed by GOAWAY with code ' + errorCode);
208+
this.trace('connection closed by GOAWAY with code ' + errorCode + ' and data ' + opaqueData?.toString());
208209
this.reportDisconnectToOwner(tooManyPings);
209210
}
210211
);

0 commit comments

Comments
 (0)