fix cancellation

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

@ -710,11 +710,14 @@ 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) {
bool is_cancellation =
server_trailing_metadata->get(GrpcCallWasCancelled()).value_or(false);
return GetContext<BatchBuilder>()->SendServerTrailingMetadata( return GetContext<BatchBuilder>()->SendServerTrailingMetadata(
stream->batch_target(), std::move(server_trailing_metadata), 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));
}; };

Loading…
Cancel
Save