diff options
author | Craig Tiller <ctiller@google.com> | 2016-03-03 10:08:31 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-03-03 10:08:31 -0800 |
commit | d7f12e30a0050b3fecb72fe7ad558b4d837e140f (patch) | |
tree | ebc5f7ca63719f35ba7c1dd71e59f4e2c5f6c6b7 /src/core/surface | |
parent | 40d27ba78455d9c5ef1feef250d0d889d6bfb746 (diff) |
Fix accept_stream being called post-channel deletion
- Have the server clear the accept_stream callback prior to destroying
the channel (required a small transport op protocol change)
- Have the transport not enact transport ops until parsing is completed
(prevents accept_stream from disappearing mid-parse)
Diffstat (limited to 'src/core/surface')
-rw-r--r-- | src/core/surface/server.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/core/surface/server.c b/src/core/surface/server.c index fb5e0d4b9e..5b13d4ba52 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -407,8 +407,15 @@ static void destroy_channel(grpc_exec_ctx *exec_ctx, channel_data *chand) { maybe_finish_shutdown(exec_ctx, chand->server); chand->finish_destroy_channel_closure.cb = finish_destroy_channel; chand->finish_destroy_channel_closure.cb_arg = chand; - grpc_exec_ctx_enqueue(exec_ctx, &chand->finish_destroy_channel_closure, true, - NULL); + + grpc_transport_op op; + memset(&op, 0, sizeof(op)); + op.set_accept_stream = true; + op.on_consumed = &chand->finish_destroy_channel_closure; + grpc_channel_next_op(exec_ctx, + grpc_channel_stack_element( + grpc_channel_get_channel_stack(chand->channel), 0), + &op); } static void finish_start_new_rpc(grpc_exec_ctx *exec_ctx, grpc_server *server, @@ -971,7 +978,8 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s, GRPC_CHANNEL_INTERNAL_REF(channel, "connectivity"); memset(&op, 0, sizeof(op)); - op.set_accept_stream = accept_stream; + op.set_accept_stream = true; + op.set_accept_stream_fn = accept_stream; op.set_accept_stream_user_data = chand; op.on_connectivity_state_change = &chand->channel_connectivity_changed; op.connectivity_state = &chand->connectivity_state; |