Merge pull request #23567 from HannahShiSFB/23477

PHP: avoid destroy channel more than once
pull/23612/head
Stanley Cheung 4 years ago committed by GitHub
commit 0ebcb5ec49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/php/ext/grpc/channel.c
  2. 1
      src/php/ext/grpc/php_grpc.c

@ -50,7 +50,7 @@ extern HashTable grpc_persistent_list;
extern HashTable grpc_target_upper_bound_map; extern HashTable grpc_target_upper_bound_map;
void free_grpc_channel_wrapper(grpc_channel_wrapper* channel, bool free_channel) { void free_grpc_channel_wrapper(grpc_channel_wrapper* channel, bool free_channel) {
if (free_channel) { if (free_channel && channel->wrapped) {
grpc_channel_destroy(channel->wrapped); grpc_channel_destroy(channel->wrapped);
channel->wrapped = NULL; channel->wrapped = NULL;
} }

@ -159,6 +159,7 @@ void destroy_grpc_channels() {
wrapped_channel.wrapper = le->channel; wrapped_channel.wrapper = le->channel;
grpc_channel_wrapper *channel = wrapped_channel.wrapper; grpc_channel_wrapper *channel = wrapped_channel.wrapper;
grpc_channel_destroy(channel->wrapped); grpc_channel_destroy(channel->wrapped);
channel->wrapped = NULL;
PHP_GRPC_HASH_FOREACH_END() PHP_GRPC_HASH_FOREACH_END()
} }

Loading…
Cancel
Save