diff options
author | Alexander Polcyn <apolcyn@google.com> | 2017-07-27 17:54:59 -0700 |
---|---|---|
committer | Alexander Polcyn <apolcyn@google.com> | 2017-07-27 17:54:59 -0700 |
commit | cd22f11905dacc72f08b0255c1cf73d0cea4c7c2 (patch) | |
tree | 826ce72dca7fd367449b054f68861df5b4799fc1 /src/ruby/lib | |
parent | 9511aefaa9779762daef3040a04627c435f9c392 (diff) |
properly finish bidi calls when there is an initial error
Diffstat (limited to 'src/ruby/lib')
-rw-r--r-- | src/ruby/lib/grpc/generic/active_call.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ruby/lib/grpc/generic/active_call.rb b/src/ruby/lib/grpc/generic/active_call.rb index 87b29c26ea..10eb70b4a7 100644 --- a/src/ruby/lib/grpc/generic/active_call.rb +++ b/src/ruby/lib/grpc/generic/active_call.rb @@ -480,7 +480,20 @@ module GRPC def bidi_streamer(requests, metadata: {}, &blk) raise_error_if_already_executed # Metadata might have already been sent if this is an operation view - merge_metadata_and_send_if_not_already_sent(metadata) + begin + merge_metadata_and_send_if_not_already_sent(metadata) + rescue GRPC::Core::CallError => e + batch_result = @call.run_batch(RECV_STATUS_ON_CLIENT => nil) + set_input_stream_done + set_output_stream_done + attach_status_results_and_complete_call(batch_result) + raise e + rescue => e + set_input_stream_done + set_output_stream_done + raise e + end + bd = BidiCall.new(@call, @marshal, @unmarshal, |