Created
February 22, 2018 23:42
-
-
Save ahmadsherif/b861c70f048fffab2065df2287e7aced to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc | |
index 83aaa09445..3ac9b971cb 100644 | |
--- a/src/core/ext/filters/client_channel/subchannel.cc | |
+++ b/src/core/ext/filters/client_channel/subchannel.cc | |
@@ -334,8 +338,13 @@ grpc_subchannel* grpc_subchannel_create(grpc_connector* connector, | |
grpc_subchannel_key* key = grpc_subchannel_key_create(args); | |
grpc_subchannel* c = grpc_subchannel_index_find(key); | |
if (c) { | |
- grpc_subchannel_key_destroy(key); | |
- return c; | |
+ if (grpc_connectivity_state_check(&c->state_tracker) != GRPC_CHANNEL_SHUTDOWN) { | |
+ grpc_subchannel_key_destroy(key); | |
+ return c; | |
+ } else { | |
+ grpc_subchannel_index_unregister(key, c); | |
+ grpc_subchannel_key_destroy(key); | |
+ } | |
} | |
GRPC_STATS_INC_CLIENT_SUBCHANNELS_CREATED(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment