diff options
author | Tim Emiola <temiola@google.com> | 2015-01-26 12:30:51 -0800 |
---|---|---|
committer | Tim Emiola <temiola@google.com> | 2015-01-26 12:30:51 -0800 |
commit | 0a7d85893c44fee9c76dc72448425a3ef5b7ab97 (patch) | |
tree | 5dcc36b65bb024992d1edddf91c7b1ef186454e5 /src/ruby | |
parent | 6dc549e9af8a9339bee336140b8087d610e53ed7 (diff) |
Updates rb_server.c to return the created port when it's non-zero
Diffstat (limited to 'src/ruby')
-rw-r--r-- | src/ruby/ext/grpc/rb_server.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index ef2a9f107b..436d006760 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -223,7 +223,7 @@ static VALUE grpc_rb_server_add_http2_port(int argc, VALUE *argv, VALUE self) { VALUE port = Qnil; VALUE is_secure = Qnil; grpc_rb_server *s = NULL; - int added_ok = 0; + int recvd_port = 0; /* "11" == 1 mandatory args, 1 (is_secure) is optional */ rb_scan_args(argc, argv, "11", &port, &is_secure); @@ -233,22 +233,22 @@ static VALUE grpc_rb_server_add_http2_port(int argc, VALUE *argv, VALUE self) { rb_raise(rb_eRuntimeError, "closed!"); return Qnil; } else if (is_secure == Qnil || TYPE(is_secure) != T_TRUE) { - added_ok = grpc_server_add_http2_port(s->wrapped, StringValueCStr(port)); - if (added_ok == 0) { + recvd_port = grpc_server_add_http2_port(s->wrapped, StringValueCStr(port)); + if (recvd_port == 0) { rb_raise(rb_eRuntimeError, "could not add port %s to server, not sure why", StringValueCStr(port)); } } else if (TYPE(is_secure) != T_FALSE) { - added_ok = + recvd_port = grpc_server_add_secure_http2_port(s->wrapped, StringValueCStr(port)); - if (added_ok == 0) { + if (recvd_port == 0) { rb_raise(rb_eRuntimeError, "could not add secure port %s to server, not sure why", StringValueCStr(port)); } } - return Qnil; + return INT2NUM(recvd_port); } void Init_google_rpc_server() { |