fix cancellation

pull/33097/head
Craig Tiller 2 years ago
parent a863532c62
commit 3203e75ec5
  1. 15
      src/core/lib/channel/connected_channel.cc

@ -710,13 +710,16 @@ ArenaPromise<ServerMetadataHandle> MakeServerCallPromise(
// Promise factory that accepts a ServerMetadataHandle, and sends it as the // Promise factory that accepts a ServerMetadataHandle, and sends it as the
// trailing metadata for this call. // trailing metadata for this call.
auto send_trailing_metadata = auto send_trailing_metadata = [call_data, stream = stream->InternalRef()](
[call_data, stream = stream->InternalRef()]( ServerMetadataHandle
ServerMetadataHandle server_trailing_metadata) { server_trailing_metadata) {
return GetContext<BatchBuilder>()->SendServerTrailingMetadata( bool is_cancellation =
stream->batch_target(), std::move(server_trailing_metadata), server_trailing_metadata->get(GrpcCallWasCancelled()).value_or(false);
return GetContext<BatchBuilder>()->SendServerTrailingMetadata(
stream->batch_target(), std::move(server_trailing_metadata),
is_cancellation ||
!std::exchange(call_data->sent_initial_metadata, true)); !std::exchange(call_data->sent_initial_metadata, true));
}; };
// Runs the receive message loop, either until all the messages // Runs the receive message loop, either until all the messages
// are received or the server call is complete. // are received or the server call is complete.

Loading…
Cancel
Save