Skip to content

Commit e83ce3b

Browse files
committed
Merge remote-tracking branch 'upstream/@grpc/[email protected]' into v1.8.x_upmerge_3
2 parents 867caad + 51d6163 commit e83ce3b

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
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.8.19",
3+
"version": "1.8.20",
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: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ class Http2Transport implements Transport {
153153
*/
154154
private remoteName: string | null
155155
) {
156+
/* Populate subchannelAddressString and channelzRef before doing anything
157+
* else, because they are used in the trace methods. */
158+
this.subchannelAddressString = subchannelAddressToString(subchannelAddress);
159+
160+
if (options['grpc.enable_channelz'] === 0) {
161+
this.channelzEnabled = false;
162+
}
163+
this.channelzRef = registerChannelzSocket(this.subchannelAddressString, () => this.getChannelzInfo(), this.channelzEnabled);
156164
// Build user-agent string.
157165
this.userAgent = [
158166
options['grpc.primary_user_agent'],
@@ -174,20 +182,6 @@ class Http2Transport implements Transport {
174182
} else {
175183
this.keepaliveWithoutCalls = false;
176184
}
177-
if (this.keepaliveWithoutCalls) {
178-
this.maybeStartKeepalivePingTimer();
179-
}
180-
181-
this.subchannelAddressString = subchannelAddressToString(subchannelAddress);
182-
183-
if (options['grpc.enable_channelz'] === 0) {
184-
this.channelzEnabled = false;
185-
}
186-
this.channelzRef = registerChannelzSocket(
187-
this.subchannelAddressString,
188-
() => this.getChannelzInfo(),
189-
this.channelzEnabled
190-
);
191185

192186
session.once('close', () => {
193187
this.trace('session closed');
@@ -233,6 +227,11 @@ class Http2Transport implements Transport {
233227
);
234228
});
235229
}
230+
/* Start the keepalive timer last, because this can trigger trace logs,
231+
* which should only happen after everything else is set up. */
232+
if (this.keepaliveWithoutCalls) {
233+
this.maybeStartKeepalivePingTimer();
234+
}
236235
}
237236

238237
private getChannelzInfo(): SocketInfo {

0 commit comments

Comments
 (0)