From 2b31f8c148b790ca8df4deb1fa644cbbc465f264 Mon Sep 17 00:00:00 2001 From: Michael Lumish Date: Tue, 16 Jan 2024 14:37:55 -0800 Subject: [PATCH] grpc-js: Shutdown transport if a state change occurs while connecting --- packages/grpc-js/src/subchannel.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/grpc-js/src/subchannel.ts b/packages/grpc-js/src/subchannel.ts index 03bbf035..eff7509a 100644 --- a/packages/grpc-js/src/subchannel.ts +++ b/packages/grpc-js/src/subchannel.ts @@ -245,6 +245,10 @@ export class Subchannel { ); } }); + } else { + /* If we can't transition from CONNECTING to READY here, we will + * not be using this transport, so release its resources. */ + transport.shutdown(); } }, error => {