From 59e339b9d243a2962f37e4080ae2110d32989fd4 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 14 Oct 2015 15:24:45 -0700 Subject: [PATCH] Made ruby server stop waiting for calls when it starts getting null calls --- src/ruby/lib/grpc/generic/rpc_server.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ruby/lib/grpc/generic/rpc_server.rb b/src/ruby/lib/grpc/generic/rpc_server.rb index 3740ac52da2..8dfc9b67637 100644 --- a/src/ruby/lib/grpc/generic/rpc_server.rb +++ b/src/ruby/lib/grpc/generic/rpc_server.rb @@ -417,7 +417,12 @@ module GRPC begin an_rpc = @server.request_call(@cq, loop_tag, INFINITE_FUTURE) c = new_active_server_call(an_rpc) - unless c.nil? + if c.nil? + # With infinite timeout on request_call, a nil call implies that the + # server has shut down. Waiting for another call at that point will + # not accomplish anything. + break + else mth = an_rpc.method.to_sym @pool.schedule(c) do |call| rpc_descs[mth].run_server_method(call, rpc_handlers[mth])