aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/surface/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/surface/channel.c')
-rw-r--r--src/core/surface/channel.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/surface/channel.c b/src/core/surface/channel.c
index d8fd442702..c6cfdb014c 100644
--- a/src/core/surface/channel.c
+++ b/src/core/surface/channel.c
@@ -61,6 +61,7 @@ struct grpc_channel {
gpr_mu registered_call_mu;
registered_call *registered_calls;
+ grpc_iomgr_closure destroy_closure;
};
#define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack *)((c) + 1))
@@ -204,8 +205,10 @@ void grpc_channel_internal_unref(grpc_channel *c, const char *reason) {
#else
void grpc_channel_internal_unref(grpc_channel *c) {
#endif
- if (gpr_unref(&c->refs)) {
- grpc_iomgr_add_callback(destroy_channel, c);
+ if (gpr_unref(&channel->refs)) {
+ channel->destroy_closure.cb = destroy_channel;
+ channel->destroy_closure.cb_arg = channel;
+ grpc_iomgr_add_callback(&channel->destroy_closure);
}
}