Fix ruby server

pull/1472/head
Craig Tiller 10 years ago
parent 9e86dc8938
commit c4440d913e
  1. 10
      src/ruby/ext/grpc/rb_server.c

@ -203,7 +203,7 @@ static VALUE grpc_rb_server_request_call(VALUE self, VALUE cqueue,
VALUE tag_new, VALUE timeout) { VALUE tag_new, VALUE timeout) {
grpc_rb_server *s = NULL; grpc_rb_server *s = NULL;
grpc_call *call = NULL; grpc_call *call = NULL;
grpc_event *ev = NULL; grpc_event ev;
grpc_call_error err; grpc_call_error err;
request_call_stack st; request_call_stack st;
VALUE result; VALUE result;
@ -227,15 +227,14 @@ static VALUE grpc_rb_server_request_call(VALUE self, VALUE cqueue,
return Qnil; return Qnil;
} }
ev = grpc_rb_completion_queue_pluck_event(cqueue, tag_new, timeout); ev = grpc_rb_completion_queue_pluck_event(cqueue, tag_new, timeout);
if (ev == NULL) { if (ev.type == GRPC_QUEUE_TIMEOUT) {
grpc_request_call_stack_cleanup(&st); grpc_request_call_stack_cleanup(&st);
return Qnil; return Qnil;
} }
if (ev->data.op_complete != GRPC_OP_OK) { if (!ev.success) {
grpc_request_call_stack_cleanup(&st); grpc_request_call_stack_cleanup(&st);
grpc_event_finish(ev); grpc_event_finish(ev);
rb_raise(grpc_rb_eCallError, "request_call completion failed: (code=%d)", rb_raise(grpc_rb_eCallError, "request_call completion failed");
ev->data.op_complete);
return Qnil; return Qnil;
} }
@ -249,7 +248,6 @@ static VALUE grpc_rb_server_request_call(VALUE self, VALUE cqueue,
grpc_rb_md_ary_to_h(&st.md_ary), grpc_rb_md_ary_to_h(&st.md_ary),
grpc_rb_wrap_call(call), grpc_rb_wrap_call(call),
NULL); NULL);
grpc_event_finish(ev);
grpc_request_call_stack_cleanup(&st); grpc_request_call_stack_cleanup(&st);
return result; return result;
} }

Loading…
Cancel
Save