[Ruby] set metadata_sent after call success (#33998)

fixes #25373
pull/33991/head
alto-ruby 1 year ago committed by GitHub
parent b4a39a2230
commit f3419f8373
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/ruby/lib/grpc/generic/active_call.rb

@ -232,17 +232,16 @@ module GRPC
def server_unary_response(req, trailing_metadata: {},
code: Core::StatusCodes::OK, details: 'OK')
ops = {}
ops[SEND_MESSAGE] = @marshal.call(req)
ops[SEND_STATUS_FROM_SERVER] = Struct::Status.new(
code, details, trailing_metadata)
ops[RECV_CLOSE_ON_SERVER] = nil
@send_initial_md_mutex.synchronize do
ops[SEND_INITIAL_METADATA] = @metadata_to_send unless @metadata_sent
@metadata_sent = true
end
payload = @marshal.call(req)
ops[SEND_MESSAGE] = payload
ops[SEND_STATUS_FROM_SERVER] = Struct::Status.new(
code, details, trailing_metadata)
ops[RECV_CLOSE_ON_SERVER] = nil
@call.run_batch(ops)
set_output_stream_done
end

Loading…
Cancel
Save