|
|
|
@ -38,6 +38,7 @@ |
|
|
|
|
#include "src/core/lib/promise/seq.h" |
|
|
|
|
#include "src/core/lib/slice/slice.h" |
|
|
|
|
#include "src/core/util/crash.h" |
|
|
|
|
#include "src/core/util/latent_see.h" |
|
|
|
|
#include "src/core/util/manual_constructor.h" |
|
|
|
|
#include "src/core/util/status_helper.h" |
|
|
|
|
|
|
|
|
@ -242,10 +243,8 @@ void BaseCallData::CapturedBatch::CancelWith(grpc_error_handle error, |
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// BaseCallData::Flusher
|
|
|
|
|
|
|
|
|
|
BaseCallData::Flusher::Flusher(BaseCallData* call) |
|
|
|
|
: latent_see::InnerScope( |
|
|
|
|
GRPC_LATENT_SEE_METADATA("PromiseBasedFilter Flusher")), |
|
|
|
|
call_(call) { |
|
|
|
|
BaseCallData::Flusher::Flusher(BaseCallData* call, const char* desc) |
|
|
|
|
: latent_see::InnerScope(GRPC_LATENT_SEE_METADATA_RAW(desc)), call_(call) { |
|
|
|
|
GRPC_CALL_STACK_REF(call_->call_stack(), "flusher"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -397,7 +396,7 @@ bool BaseCallData::SendMessage::IsIdle() const { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void BaseCallData::SendMessage::OnComplete(absl::Status status) { |
|
|
|
|
Flusher flusher(base_); |
|
|
|
|
Flusher flusher(base_, "SendMessage::OnComplete"); |
|
|
|
|
GRPC_TRACE_LOG(channel, INFO) |
|
|
|
|
<< base_->LogTag() << " SendMessage.OnComplete st=" << StateString(state_) |
|
|
|
|
<< " status=" << status; |
|
|
|
@ -707,7 +706,7 @@ void BaseCallData::ReceiveMessage::OnComplete(absl::Status status) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
completed_status_ = status; |
|
|
|
|
Flusher flusher(base_); |
|
|
|
|
Flusher flusher(base_, "ReceiveMessage::OnComplete"); |
|
|
|
|
ScopedContext ctx(base_); |
|
|
|
|
base_->WakeInsideCombiner(&flusher); |
|
|
|
|
} |
|
|
|
@ -1221,7 +1220,8 @@ class ClientCallData::PollContext { |
|
|
|
|
auto* next_poll = static_cast<NextPoll*>(p); |
|
|
|
|
{ |
|
|
|
|
ScopedContext ctx(next_poll->call_data); |
|
|
|
|
Flusher flusher(next_poll->call_data); |
|
|
|
|
Flusher flusher(next_poll->call_data, |
|
|
|
|
"ClientCallData::PollContext::~PollContext"); |
|
|
|
|
next_poll->call_data->WakeInsideCombiner(&flusher); |
|
|
|
|
} |
|
|
|
|
GRPC_CALL_STACK_UNREF(next_poll->call_stack, "re-poll"); |
|
|
|
@ -1350,7 +1350,7 @@ void ClientCallData::StartBatch(grpc_transport_stream_op_batch* b) { |
|
|
|
|
// Fake out the activity based context.
|
|
|
|
|
ScopedContext context(this); |
|
|
|
|
CapturedBatch batch(b); |
|
|
|
|
Flusher flusher(this); |
|
|
|
|
Flusher flusher(this, "ClientCallData::StartBatch"); |
|
|
|
|
|
|
|
|
|
GRPC_TRACE_LOG(channel, INFO) << LogTag() << " StartBatch " << DebugString(); |
|
|
|
|
|
|
|
|
@ -1556,7 +1556,7 @@ void ClientCallData::RecvInitialMetadataReady(grpc_error_handle error) { |
|
|
|
|
<< DebugString() << " error:" << error.ToString() |
|
|
|
|
<< " md:" << recv_initial_metadata_->metadata->DebugString(); |
|
|
|
|
ScopedContext context(this); |
|
|
|
|
Flusher flusher(this); |
|
|
|
|
Flusher flusher(this, "ClientCallData::RecvInitialMetadataReady"); |
|
|
|
|
if (!error.ok()) { |
|
|
|
|
switch (recv_initial_metadata_->state) { |
|
|
|
|
case RecvInitialMetadata::kHookedWaitingForPipe: |
|
|
|
@ -1742,7 +1742,7 @@ void ClientCallData::RecvTrailingMetadataReadyCallback( |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ClientCallData::RecvTrailingMetadataReady(grpc_error_handle error) { |
|
|
|
|
Flusher flusher(this); |
|
|
|
|
Flusher flusher(this, "ClientCallData::RecvTrailingMetadataReady"); |
|
|
|
|
GRPC_TRACE_LOG(channel, INFO) |
|
|
|
|
<< LogTag() << " ClientCallData.RecvTrailingMetadataReady " |
|
|
|
|
<< "recv_trailing_state=" << StateString(recv_trailing_state_) |
|
|
|
@ -1793,11 +1793,12 @@ void ClientCallData::SetStatusFromError(grpc_metadata_batch* metadata, |
|
|
|
|
|
|
|
|
|
// Wakeup and poll the promise if appropriate.
|
|
|
|
|
void ClientCallData::WakeInsideCombiner(Flusher* flusher) { |
|
|
|
|
GRPC_LATENT_SEE_INNER_SCOPE("ClientCallData::WakeInsideCombiner"); |
|
|
|
|
PollContext(this, flusher).Run(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ClientCallData::OnWakeup() { |
|
|
|
|
Flusher flusher(this); |
|
|
|
|
Flusher flusher(this, "ClientCallData::OnWakeup"); |
|
|
|
|
ScopedContext context(this); |
|
|
|
|
WakeInsideCombiner(&flusher); |
|
|
|
|
} |
|
|
|
@ -1873,7 +1874,8 @@ class ServerCallData::PollContext { |
|
|
|
|
auto run = [](void* p, grpc_error_handle) { |
|
|
|
|
auto* next_poll = static_cast<NextPoll*>(p); |
|
|
|
|
{ |
|
|
|
|
Flusher flusher(next_poll->call_data); |
|
|
|
|
Flusher flusher(next_poll->call_data, |
|
|
|
|
"ServerCallData::PollContext::~PollContext"); |
|
|
|
|
ScopedContext context(next_poll->call_data); |
|
|
|
|
next_poll->call_data->WakeInsideCombiner(&flusher); |
|
|
|
|
} |
|
|
|
@ -1977,7 +1979,7 @@ void ServerCallData::StartBatch(grpc_transport_stream_op_batch* b) { |
|
|
|
|
// Fake out the activity based context.
|
|
|
|
|
ScopedContext context(this); |
|
|
|
|
CapturedBatch batch(b); |
|
|
|
|
Flusher flusher(this); |
|
|
|
|
Flusher flusher(this, "ServerCallData::StartBatch"); |
|
|
|
|
bool wake = false; |
|
|
|
|
|
|
|
|
|
GRPC_TRACE_LOG(channel, INFO) << LogTag() << " StartBatch: " << DebugString(); |
|
|
|
@ -2266,7 +2268,7 @@ void ServerCallData::RecvTrailingMetadataReady(grpc_error_handle error) { |
|
|
|
|
GRPC_TRACE_LOG(channel, INFO) |
|
|
|
|
<< LogTag() << ": RecvTrailingMetadataReady error=" << error |
|
|
|
|
<< " md=" << recv_trailing_metadata_->DebugString(); |
|
|
|
|
Flusher flusher(this); |
|
|
|
|
Flusher flusher(this, "ServerCallData::RecvTrailingMetadataReady"); |
|
|
|
|
PollContext poll_ctx(this, &flusher); |
|
|
|
|
Completed(error, recv_trailing_metadata_->get(GrpcTarPit()).has_value(), |
|
|
|
|
&flusher); |
|
|
|
@ -2280,7 +2282,7 @@ void ServerCallData::RecvInitialMetadataReadyCallback(void* arg, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ServerCallData::RecvInitialMetadataReady(grpc_error_handle error) { |
|
|
|
|
Flusher flusher(this); |
|
|
|
|
Flusher flusher(this, "ServerCallData::RecvInitialMetadataReady"); |
|
|
|
|
GRPC_TRACE_LOG(channel, INFO) |
|
|
|
|
<< LogTag() << ": RecvInitialMetadataReady " << error; |
|
|
|
|
CHECK(recv_initial_state_ == RecvInitialState::kForwarded); |
|
|
|
@ -2343,6 +2345,7 @@ std::string ServerCallData::DebugString() const { |
|
|
|
|
|
|
|
|
|
// Wakeup and poll the promise if appropriate.
|
|
|
|
|
void ServerCallData::WakeInsideCombiner(Flusher* flusher) { |
|
|
|
|
GRPC_LATENT_SEE_INNER_SCOPE("ServerCallData::WakeInsideCombiner"); |
|
|
|
|
PollContext poll_ctx(this, flusher); |
|
|
|
|
GRPC_TRACE_LOG(channel, INFO) |
|
|
|
|
<< LogTag() << ": WakeInsideCombiner " << DebugString(); |
|
|
|
@ -2494,7 +2497,7 @@ void ServerCallData::WakeInsideCombiner(Flusher* flusher) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ServerCallData::OnWakeup() { |
|
|
|
|
Flusher flusher(this); |
|
|
|
|
Flusher flusher(this, "ServerCallData::OnWakeup"); |
|
|
|
|
ScopedContext context(this); |
|
|
|
|
WakeInsideCombiner(&flusher); |
|
|
|
|
} |
|
|
|
|