aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Tim Emiola <temiola@google.com>2015-08-11 10:50:21 -0700
committerGravatar Tim Emiola <temiola@google.com>2015-08-11 16:40:21 -0700
commit7369dcb12befad3742290da2fe17b7ae279f1d7d (patch)
tree1a75653171d5179cfd79307cff99105ba14d0afa
parent73578f7f62df4fd03035ad8e04c43b492649a064 (diff)
Use null for default host
-rw-r--r--src/ruby/ext/grpc/rb_channel.c5
-rw-r--r--src/ruby/lib/grpc/generic/client_stub.rb2
-rw-r--r--src/ruby/spec/call_spec.rb2
-rw-r--r--src/ruby/spec/channel_spec.rb4
-rw-r--r--src/ruby/spec/client_server_spec.rb2
-rw-r--r--src/ruby/spec/generic/active_call_spec.rb2
6 files changed, 10 insertions, 7 deletions
diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c
index 43d9937d74..ac591f1563 100644
--- a/src/ruby/ext/grpc/rb_channel.c
+++ b/src/ruby/ext/grpc/rb_channel.c
@@ -203,7 +203,10 @@ static VALUE grpc_rb_channel_create_call(VALUE self, VALUE cqueue, VALUE method,
grpc_channel *ch = NULL;
grpc_completion_queue *cq = NULL;
char *method_chars = StringValueCStr(method);
- char *host_chars = StringValueCStr(host);
+ char *host_chars = NULL;
+ if (host != Qnil) {
+ host_chars = StringValueCStr(host);
+ }
cq = grpc_rb_get_wrapped_completion_queue(cqueue);
TypedData_Get_Struct(self, grpc_rb_channel, &grpc_channel_data_type, wrapper);
diff --git a/src/ruby/lib/grpc/generic/client_stub.rb b/src/ruby/lib/grpc/generic/client_stub.rb
index 745eab437e..a2f1ec612d 100644
--- a/src/ruby/lib/grpc/generic/client_stub.rb
+++ b/src/ruby/lib/grpc/generic/client_stub.rb
@@ -410,7 +410,7 @@ module GRPC
# @param timeout [TimeConst]
def new_active_call(method, marshal, unmarshal, timeout = nil)
deadline = from_relative_time(timeout.nil? ? @timeout : timeout)
- call = @ch.create_call(@queue, method, @host, deadline)
+ call = @ch.create_call(@queue, method, nil, deadline)
ActiveCall.new(call, @queue, marshal, unmarshal, deadline, started: false)
end
end
diff --git a/src/ruby/spec/call_spec.rb b/src/ruby/spec/call_spec.rb
index 4977c10a7e..36a442faed 100644
--- a/src/ruby/spec/call_spec.rb
+++ b/src/ruby/spec/call_spec.rb
@@ -137,7 +137,7 @@ describe GRPC::Core::Call do
end
def make_test_call
- @ch.create_call(client_queue, 'dummy_method', 'dummy_host', deadline)
+ @ch.create_call(client_queue, 'dummy_method', nil, deadline)
end
def deadline
diff --git a/src/ruby/spec/channel_spec.rb b/src/ruby/spec/channel_spec.rb
index d471ff5db6..9081f0e20c 100644
--- a/src/ruby/spec/channel_spec.rb
+++ b/src/ruby/spec/channel_spec.rb
@@ -117,7 +117,7 @@ describe GRPC::Core::Channel do
deadline = Time.now + 5
blk = proc do
- ch.create_call(cq, 'dummy_method', 'dummy_host', deadline)
+ ch.create_call(cq, 'dummy_method', nil, deadline)
end
expect(&blk).to_not raise_error
end
@@ -128,7 +128,7 @@ describe GRPC::Core::Channel do
deadline = Time.now + 5
blk = proc do
- ch.create_call(cq, 'dummy_method', 'dummy_host', deadline)
+ ch.create_call(cq, 'dummy_method', nil, deadline)
end
expect(&blk).to raise_error(RuntimeError)
end
diff --git a/src/ruby/spec/client_server_spec.rb b/src/ruby/spec/client_server_spec.rb
index ed8032517b..57c9a8de9b 100644
--- a/src/ruby/spec/client_server_spec.rb
+++ b/src/ruby/spec/client_server_spec.rb
@@ -61,7 +61,7 @@ shared_context 'setup: tags' do
end
def new_client_call
- @ch.create_call(@client_queue, '/method', 'foo.test.google.fr', deadline)
+ @ch.create_call(@client_queue, '/method', nil, deadline)
end
end
diff --git a/src/ruby/spec/generic/active_call_spec.rb b/src/ruby/spec/generic/active_call_spec.rb
index bc3bee3d44..424b2dbdeb 100644
--- a/src/ruby/spec/generic/active_call_spec.rb
+++ b/src/ruby/spec/generic/active_call_spec.rb
@@ -338,7 +338,7 @@ describe GRPC::ActiveCall do
end
def make_test_call
- @ch.create_call(@client_queue, '/method', 'a.dummy.host', deadline)
+ @ch.create_call(@client_queue, '/method', nil, deadline)
end
def deadline