diff options
author | Tim Emiola <temiola@google.com> | 2015-03-17 21:41:57 -0700 |
---|---|---|
committer | Tim Emiola <temiola@google.com> | 2015-03-17 21:41:57 -0700 |
commit | e52995ef2b5547230904d2f123cacaa5440a572c (patch) | |
tree | c9a736110864685ca974487fd5acdf1163050169 | |
parent | 09eaec027ab4b3d97cb239820af98fe0c460f287 (diff) |
Adds back calls to #finish at the end of server calls
-rw-r--r-- | src/ruby/lib/grpc/generic/rpc_desc.rb | 1 | ||||
-rw-r--r-- | src/ruby/spec/generic/client_stub_spec.rb | 10 | ||||
-rw-r--r-- | src/ruby/spec/generic/rpc_desc_spec.rb | 4 |
3 files changed, 10 insertions, 5 deletions
diff --git a/src/ruby/lib/grpc/generic/rpc_desc.rb b/src/ruby/lib/grpc/generic/rpc_desc.rb index 5e3d3c9f9c..2cb3d2eebf 100644 --- a/src/ruby/lib/grpc/generic/rpc_desc.rb +++ b/src/ruby/lib/grpc/generic/rpc_desc.rb @@ -81,6 +81,7 @@ module GRPC active_call.run_server_bidi(mth) end send_status(active_call, OK, 'OK') + active_call.finished rescue BadStatus => e # this is raised by handlers that want GRPC to send an application # error code and detail message. diff --git a/src/ruby/spec/generic/client_stub_spec.rb b/src/ruby/spec/generic/client_stub_spec.rb index adf354f4ee..73f2d37e30 100644 --- a/src/ruby/spec/generic/client_stub_spec.rb +++ b/src/ruby/spec/generic/client_stub_spec.rb @@ -434,7 +434,7 @@ describe 'ClientStub' do end expect(c.remote_read).to eq(expected_input) replys.each { |r| c.remote_send(r) } - c.send_status(status, status == @pass ? 'OK' : 'NOK') + c.send_status(status, status == @pass ? 'OK' : 'NOK', true) end end @@ -444,7 +444,7 @@ describe 'ClientStub' do c = expect_server_to_be_invoked(mtx, cnd) expected_inputs.each { |i| expect(c.remote_read).to eq(i) } replys.each { |r| c.remote_send(r) } - c.send_status(status, status == @pass ? 'OK' : 'NOK') + c.send_status(status, status == @pass ? 'OK' : 'NOK', true) end end @@ -460,7 +460,7 @@ describe 'ClientStub' do expect(c.remote_read).to eq(i) end end - c.send_status(status, status == @pass ? 'OK' : 'NOK') + c.send_status(status, status == @pass ? 'OK' : 'NOK', true) end end @@ -473,7 +473,7 @@ describe 'ClientStub' do expect(c.metadata[k.to_s]).to eq(v) end c.remote_send(resp) - c.send_status(status, status == @pass ? 'OK' : 'NOK') + c.send_status(status, status == @pass ? 'OK' : 'NOK', true) end end @@ -486,7 +486,7 @@ describe 'ClientStub' do expect(c.metadata[k.to_s]).to eq(v) end c.remote_send(resp) - c.send_status(status, status == @pass ? 'OK' : 'NOK') + c.send_status(status, status == @pass ? 'OK' : 'NOK', true) end end diff --git a/src/ruby/spec/generic/rpc_desc_spec.rb b/src/ruby/spec/generic/rpc_desc_spec.rb index 8bff2a9a64..39d1e83748 100644 --- a/src/ruby/spec/generic/rpc_desc_spec.rb +++ b/src/ruby/spec/generic/rpc_desc_spec.rb @@ -94,6 +94,7 @@ describe GRPC::RpcDesc do expect(@call).to receive(:remote_read).once.and_return(req) expect(@call).to receive(:remote_send).once.with(@ok_response) expect(@call).to receive(:send_status).once.with(OK, 'OK') + expect(@call).to receive(:finished).once @request_response.run_server_method(@call, method(:fake_reqresp)) end end @@ -134,6 +135,7 @@ describe GRPC::RpcDesc do it 'sends a response and closes the stream if there no errors' do expect(@call).to receive(:remote_send).once.with(@ok_response) expect(@call).to receive(:send_status).once.with(OK, 'OK') + expect(@call).to receive(:finished).once @client_streamer.run_server_method(@call, method(:fake_clstream)) end end @@ -178,6 +180,7 @@ describe GRPC::RpcDesc do expect(@call).to receive(:remote_read).once.and_return(req) expect(@call).to receive(:remote_send).twice.with(@ok_response) expect(@call).to receive(:send_status).once.with(OK, 'OK') + expect(@call).to receive(:finished).once @server_streamer.run_server_method(@call, method(:fake_svstream)) end end @@ -207,6 +210,7 @@ describe GRPC::RpcDesc do it 'closes the stream if there no errors' do expect(@call).to receive(:run_server_bidi) expect(@call).to receive(:send_status).once.with(OK, 'OK') + expect(@call).to receive(:finished).once @bidi_streamer.run_server_method(@call, method(:fake_bidistream)) end end |