diff --git a/src/ruby/ext/grpc/rb_completion_queue.c b/src/ruby/ext/grpc/rb_completion_queue.c index cef8cd75d2f448949e3ef207c78bbca59a36c476..33338d68e9f20ab8886bbc96f1d89276f0af7de4 100644 --- a/src/ruby/ext/grpc/rb_completion_queue.c +++ b/src/ruby/ext/grpc/rb_completion_queue.c @@ -80,7 +80,7 @@ static void grpc_rb_completion_queue_shutdown_drain(grpc_completion_queue *cq) { grpc_completion_queue_shutdown(cq); next_call.cq = cq; - next_call.event = NULL; + next_call.event.type = GRPC_QUEUE_TIMEOUT; /* TODO: the timeout should be a module level constant that defaults * to gpr_inf_future. * @@ -95,16 +95,11 @@ static void grpc_rb_completion_queue_shutdown_drain(grpc_completion_queue *cq) { do { rb_thread_call_without_gvl(grpc_rb_completion_queue_next_no_gil, (void *)&next_call, NULL, NULL); - if (next_call.event == NULL) { - break; - } - type = next_call.event->type; + type = next_call.event.type; if (type != GRPC_QUEUE_SHUTDOWN) { ++drained; rb_warning("completion queue shutdown: %d undrained events", drained); } - grpc_event_finish(next_call.event); - next_call.event = NULL; } while (type != GRPC_QUEUE_SHUTDOWN); } diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index a013dbcfc9fae1d42be8cf3b70e10df3bd302935..7db9e989de47bea225689a71842dc32b19c6286c 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -233,7 +233,6 @@ static VALUE grpc_rb_server_request_call(VALUE self, VALUE cqueue, } if (!ev.success) { grpc_request_call_stack_cleanup(&st); - grpc_event_finish(ev); rb_raise(grpc_rb_eCallError, "request_call completion failed"); return Qnil; }