Introduced grpc_error_handle (#25902)
- Define grpc_error_handle - Replace grpc_error* with grpc_error_handle
This commit is contained in:
parent
2d8936b097
commit
ca945a58e9
|
|
@ -56,8 +56,8 @@ For example, in the following code block, error1 and error2 are owned by the
|
|||
current function.
|
||||
|
||||
```C
|
||||
grpc_error* error1 = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Some error occurred");
|
||||
grpc_error* error2 = some_operation_that_might_fail(...);
|
||||
grpc_error_handle error1 = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Some error occurred");
|
||||
grpc_error_handle error2 = some_operation_that_might_fail(...);
|
||||
```
|
||||
|
||||
The current function would have to explicitly call GRPC_ERROR_UNREF on the
|
||||
|
|
@ -71,7 +71,7 @@ errors, or pass them along to a function that would take over the ownership.
|
|||
A `grpc_closure` callback function is any function that has the signature:
|
||||
|
||||
```C
|
||||
void (*cb)(void *arg, grpc_error *error);
|
||||
void (*cb)(void *arg, grpc_error_handle error);
|
||||
```
|
||||
|
||||
This means that the error ownership is NOT transferred when a functions calls:
|
||||
|
|
@ -87,7 +87,7 @@ way to execute callbacks is via the `Closure::Run` method, which takes ownership
|
|||
of the error variable.
|
||||
|
||||
```C
|
||||
grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Some error occurred");
|
||||
grpc_error_handle error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Some error occurred");
|
||||
grpc_core::Closure::Run(DEBUG_LOCATION, c->cb, error);
|
||||
// current function no longer has ownership of the error
|
||||
```
|
||||
|
|
@ -96,7 +96,7 @@ If you schedule or run a closure, but still need ownership of the error, then
|
|||
you must explicitly take a reference.
|
||||
|
||||
```C
|
||||
grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Some error occurred");
|
||||
grpc_error_handle error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Some error occurred");
|
||||
grpc_core::Closure::Run(DEBUG_LOCATION, c->cb, GRPC_ERROR_REF(error));
|
||||
// do some other things with the error
|
||||
GRPC_ERROR_UNREF(error);
|
||||
|
|
@ -109,7 +109,7 @@ would take ownership of the error, without explicitly taking ownership yourself.
|
|||
For example:
|
||||
|
||||
```C
|
||||
void on_some_action(void *arg, grpc_error *error) {
|
||||
void on_some_action(void *arg, grpc_error_handle error) {
|
||||
// this would cause a crash, because some_function will unref the error,
|
||||
// and the caller of this callback will also unref it.
|
||||
some_function(error);
|
||||
|
|
@ -128,7 +128,7 @@ void on_some_action(void *arg, grpc_error *error) {
|
|||
Take the following example:
|
||||
|
||||
```C
|
||||
grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Some error occurred");
|
||||
grpc_error_handle error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Some error occurred");
|
||||
// do some things
|
||||
some_function(error);
|
||||
// can't use error anymore! might be gone.
|
||||
|
|
@ -142,7 +142,7 @@ if would have to take on a reference to it. This is a common pattern seen.
|
|||
|
||||
```C
|
||||
void func() {
|
||||
grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Some error");
|
||||
grpc_error_handle error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Some error");
|
||||
some_function(GRPC_ERROR_REF(error));
|
||||
// do things
|
||||
some_other_function(GRPC_ERROR_REF(error));
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ static void backup_poller_shutdown_unref(backup_poller* p) {
|
|||
}
|
||||
}
|
||||
|
||||
static void done_poller(void* arg, grpc_error* /*error*/) {
|
||||
static void done_poller(void* arg, grpc_error_handle /*error*/) {
|
||||
backup_poller_shutdown_unref(static_cast<backup_poller*>(arg));
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ static void g_poller_unref() {
|
|||
}
|
||||
}
|
||||
|
||||
static void run_poller(void* arg, grpc_error* error) {
|
||||
static void run_poller(void* arg, grpc_error_handle error) {
|
||||
backup_poller* p = static_cast<backup_poller*>(arg);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
if (error != GRPC_ERROR_CANCELLED) {
|
||||
|
|
@ -127,7 +127,7 @@ static void run_poller(void* arg, grpc_error* error) {
|
|||
backup_poller_shutdown_unref(p);
|
||||
return;
|
||||
}
|
||||
grpc_error* err =
|
||||
grpc_error_handle err =
|
||||
grpc_pollset_work(p->pollset, nullptr, grpc_core::ExecCtx::Get()->Now());
|
||||
gpr_mu_unlock(p->pollset_mu);
|
||||
GRPC_LOG_IF_ERROR("Run client channel backup poller", err);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class StateWatcher {
|
|||
grpc_closure* closure() { return &closure_; }
|
||||
|
||||
private:
|
||||
static void WatcherTimerInit(void* arg, grpc_error* /*error*/) {
|
||||
static void WatcherTimerInit(void* arg, grpc_error_handle /*error*/) {
|
||||
auto* self = static_cast<WatcherTimerInitState*>(arg);
|
||||
grpc_timer_init(&self->state_watcher_->timer_, self->deadline_,
|
||||
&self->state_watcher_->on_timeout_);
|
||||
|
|
@ -130,10 +130,10 @@ class StateWatcher {
|
|||
if (should_delete) delete self;
|
||||
}
|
||||
|
||||
void PartlyDone(bool due_to_completion, grpc_error* error) {
|
||||
void PartlyDone(bool due_to_completion, grpc_error_handle error) {
|
||||
bool end_op = false;
|
||||
void* end_op_tag = nullptr;
|
||||
grpc_error* end_op_error = nullptr;
|
||||
grpc_error_handle end_op_error = GRPC_ERROR_NONE;
|
||||
grpc_completion_queue* end_op_cq = nullptr;
|
||||
grpc_cq_completion* end_op_completion_storage = nullptr;
|
||||
if (due_to_completion) {
|
||||
|
|
@ -191,12 +191,12 @@ class StateWatcher {
|
|||
GRPC_ERROR_UNREF(error);
|
||||
}
|
||||
|
||||
static void WatchComplete(void* arg, grpc_error* error) {
|
||||
static void WatchComplete(void* arg, grpc_error_handle error) {
|
||||
auto* self = static_cast<StateWatcher*>(arg);
|
||||
self->PartlyDone(/*due_to_completion=*/true, GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void TimeoutComplete(void* arg, grpc_error* error) {
|
||||
static void TimeoutComplete(void* arg, grpc_error_handle error) {
|
||||
auto* self = static_cast<StateWatcher*>(arg);
|
||||
self->PartlyDone(/*due_to_completion=*/false, GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
|
@ -215,7 +215,7 @@ class StateWatcher {
|
|||
|
||||
Mutex mu_;
|
||||
CallbackPhase phase_ ABSL_GUARDED_BY(mu_) = kWaiting;
|
||||
grpc_error* error_ ABSL_GUARDED_BY(mu_) = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error_ ABSL_GUARDED_BY(mu_) = GRPC_ERROR_NONE;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ TraceFlag grpc_client_channel_routing_trace(false, "client_channel_routing");
|
|||
|
||||
class ClientChannel::CallData {
|
||||
public:
|
||||
static grpc_error* Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args);
|
||||
static grpc_error_handle Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args);
|
||||
static void Destroy(grpc_call_element* elem,
|
||||
const grpc_call_final_info* final_info,
|
||||
grpc_closure* then_schedule_closure);
|
||||
|
|
@ -105,18 +105,18 @@ class ClientChannel::CallData {
|
|||
static void SetPollent(grpc_call_element* elem, grpc_polling_entity* pollent);
|
||||
|
||||
// Invoked by channel for queued calls when name resolution is completed.
|
||||
static void CheckResolution(void* arg, grpc_error* error);
|
||||
static void CheckResolution(void* arg, grpc_error_handle error);
|
||||
// Helper function for applying the service config to a call while
|
||||
// holding ClientChannel::resolution_mu_.
|
||||
// Returns true if the service config has been applied to the call, in which
|
||||
// case the caller must invoke ResolutionDone() or AsyncResolutionDone()
|
||||
// with the returned error.
|
||||
bool CheckResolutionLocked(grpc_call_element* elem, grpc_error** error)
|
||||
bool CheckResolutionLocked(grpc_call_element* elem, grpc_error_handle* error)
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&ClientChannel::resolution_mu_);
|
||||
// Schedules a callback to continue processing the call once
|
||||
// resolution is complete. The callback will not run until after this
|
||||
// method returns.
|
||||
void AsyncResolutionDone(grpc_call_element* elem, grpc_error* error);
|
||||
void AsyncResolutionDone(grpc_call_element* elem, grpc_error_handle error);
|
||||
|
||||
private:
|
||||
class ResolverQueuedCallCanceller;
|
||||
|
|
@ -129,7 +129,8 @@ class ClientChannel::CallData {
|
|||
static size_t GetBatchIndex(grpc_transport_stream_op_batch* batch);
|
||||
void PendingBatchesAdd(grpc_call_element* elem,
|
||||
grpc_transport_stream_op_batch* batch);
|
||||
static void FailPendingBatchInCallCombiner(void* arg, grpc_error* error);
|
||||
static void FailPendingBatchInCallCombiner(void* arg,
|
||||
grpc_error_handle error);
|
||||
// A predicate type and some useful implementations for PendingBatchesFail().
|
||||
typedef bool (*YieldCallCombinerPredicate)(
|
||||
const CallCombinerClosureList& closures);
|
||||
|
|
@ -147,9 +148,10 @@ class ClientChannel::CallData {
|
|||
// If yield_call_combiner_predicate returns true, assumes responsibility for
|
||||
// yielding the call combiner.
|
||||
void PendingBatchesFail(
|
||||
grpc_call_element* elem, grpc_error* error,
|
||||
grpc_call_element* elem, grpc_error_handle error,
|
||||
YieldCallCombinerPredicate yield_call_combiner_predicate);
|
||||
static void ResumePendingBatchInCallCombiner(void* arg, grpc_error* ignored);
|
||||
static void ResumePendingBatchInCallCombiner(void* arg,
|
||||
grpc_error_handle ignored);
|
||||
// Resumes all pending batches on lb_call_.
|
||||
void PendingBatchesResume(grpc_call_element* elem);
|
||||
|
||||
|
|
@ -157,12 +159,12 @@ class ClientChannel::CallData {
|
|||
// that the resolver has returned results to the channel.
|
||||
// If an error is returned, the error indicates the status with which
|
||||
// the call should be failed.
|
||||
grpc_error* ApplyServiceConfigToCallLocked(
|
||||
grpc_error_handle ApplyServiceConfigToCallLocked(
|
||||
grpc_call_element* elem, grpc_metadata_batch* initial_metadata)
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&ClientChannel::resolution_mu_);
|
||||
// Invoked when the resolver result is applied to the caller, on both
|
||||
// success or failure.
|
||||
static void ResolutionDone(void* arg, grpc_error* error);
|
||||
static void ResolutionDone(void* arg, grpc_error_handle error);
|
||||
// Removes the call (if present) from the channel's list of calls queued
|
||||
// for name resolution.
|
||||
void MaybeRemoveCallFromResolverQueuedCallsLocked(grpc_call_element* elem)
|
||||
|
|
@ -173,7 +175,7 @@ class ClientChannel::CallData {
|
|||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&ClientChannel::resolution_mu_);
|
||||
|
||||
static void RecvInitialMetadataReadyForConfigSelectorCommitCallback(
|
||||
void* arg, grpc_error* error);
|
||||
void* arg, grpc_error_handle error);
|
||||
void InjectRecvInitialMetadataReadyForConfigSelectorCommitCallback(
|
||||
grpc_transport_stream_op_batch* batch);
|
||||
|
||||
|
|
@ -225,7 +227,7 @@ class ClientChannel::CallData {
|
|||
grpc_transport_stream_op_batch* pending_batches_[MAX_PENDING_BATCHES] = {};
|
||||
|
||||
// Set when we get a cancel_stream op.
|
||||
grpc_error* cancel_error_ = GRPC_ERROR_NONE;
|
||||
grpc_error_handle cancel_error_ = GRPC_ERROR_NONE;
|
||||
};
|
||||
|
||||
//
|
||||
|
|
@ -280,8 +282,8 @@ class DynamicTerminationFilter {
|
|||
|
||||
static const grpc_channel_filter kFilterVtable;
|
||||
|
||||
static grpc_error* Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
static grpc_error_handle Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
GPR_ASSERT(args->is_last);
|
||||
GPR_ASSERT(elem->filter == &kFilterVtable);
|
||||
new (elem->channel_data) DynamicTerminationFilter(args->channel_args);
|
||||
|
|
@ -309,8 +311,8 @@ class DynamicTerminationFilter {
|
|||
|
||||
class DynamicTerminationFilter::CallData {
|
||||
public:
|
||||
static grpc_error* Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
static grpc_error_handle Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
new (elem->call_data) CallData(*args);
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
|
@ -418,7 +420,7 @@ class ClientChannel::ResolverResultHandler : public Resolver::ResultHandler {
|
|||
chand_->OnResolverResultChangedLocked(std::move(result));
|
||||
}
|
||||
|
||||
void ReturnError(grpc_error* error) override
|
||||
void ReturnError(grpc_error_handle error) override
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(chand_->work_serializer_) {
|
||||
chand_->OnResolverErrorLocked(error);
|
||||
}
|
||||
|
|
@ -719,7 +721,7 @@ class ClientChannel::SubchannelWrapper : public SubchannelInterface {
|
|||
// in chand_->pending_subchannel_updates_. So we don't want to add
|
||||
// entries there that will never be processed, since that would
|
||||
// leave dangling refs to the channel and prevent its destruction.
|
||||
grpc_error* disconnect_error = chand_->disconnect_error();
|
||||
grpc_error_handle disconnect_error = chand_->disconnect_error();
|
||||
if (disconnect_error != GRPC_ERROR_NONE) return;
|
||||
// Not shutting down, so do the update.
|
||||
if (connected_subchannel_ != connected_subchannel) {
|
||||
|
|
@ -985,7 +987,7 @@ class ClientChannel::ClientChannelControlHelper
|
|||
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker) override
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(chand_->work_serializer_) {
|
||||
if (chand_->resolver_ == nullptr) return; // Shutting down.
|
||||
grpc_error* disconnect_error = chand_->disconnect_error();
|
||||
grpc_error_handle disconnect_error = chand_->disconnect_error();
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
||||
const char* extra = disconnect_error == GRPC_ERROR_NONE
|
||||
? ""
|
||||
|
|
@ -1042,11 +1044,11 @@ ClientChannel* ClientChannel::GetFromChannel(grpc_channel* channel) {
|
|||
return static_cast<ClientChannel*>(elem->channel_data);
|
||||
}
|
||||
|
||||
grpc_error* ClientChannel::Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
grpc_error_handle ClientChannel::Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
GPR_ASSERT(args->is_last);
|
||||
GPR_ASSERT(elem->filter == &kFilterVtable);
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
new (elem->channel_data) ClientChannel(args, &error);
|
||||
return error;
|
||||
}
|
||||
|
|
@ -1080,7 +1082,7 @@ channelz::ChannelNode* GetChannelzNode(const grpc_channel_args* args) {
|
|||
} // namespace
|
||||
|
||||
ClientChannel::ClientChannel(grpc_channel_element_args* args,
|
||||
grpc_error** error)
|
||||
grpc_error_handle* error)
|
||||
: deadline_checking_enabled_(
|
||||
grpc_deadline_checking_enabled(args->channel_args)),
|
||||
enable_retries_(GetEnableRetries(args->channel_args)),
|
||||
|
|
@ -1200,7 +1202,7 @@ RefCountedPtr<LoadBalancingPolicy::Config> ChooseLbPolicy(
|
|||
Json config_json = Json::Array{Json::Object{
|
||||
{policy_name, Json::Object{}},
|
||||
}};
|
||||
grpc_error* parse_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle parse_error = GRPC_ERROR_NONE;
|
||||
auto lb_policy_config = LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(
|
||||
config_json, &parse_error);
|
||||
// The policy name came from one of three places:
|
||||
|
|
@ -1248,7 +1250,7 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
|
|||
// The result of grpc_error_string() is owned by the error itself.
|
||||
// We're storing that string in trace_strings, so we need to make sure
|
||||
// that the error lives until we're done with the string.
|
||||
grpc_error* service_config_error =
|
||||
grpc_error_handle service_config_error =
|
||||
GRPC_ERROR_REF(result.service_config_error);
|
||||
if (service_config_error != GRPC_ERROR_NONE) {
|
||||
trace_strings.push_back(grpc_error_string(service_config_error));
|
||||
|
|
@ -1344,7 +1346,7 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
|
|||
GRPC_ERROR_UNREF(service_config_error);
|
||||
}
|
||||
|
||||
void ClientChannel::OnResolverErrorLocked(grpc_error* error) {
|
||||
void ClientChannel::OnResolverErrorLocked(grpc_error_handle error) {
|
||||
if (resolver_ == nullptr) {
|
||||
GRPC_ERROR_UNREF(error);
|
||||
return;
|
||||
|
|
@ -1357,8 +1359,9 @@ void ClientChannel::OnResolverErrorLocked(grpc_error* error) {
|
|||
// result, then we continue to let it set the connectivity state.
|
||||
// Otherwise, we go into TRANSIENT_FAILURE.
|
||||
if (lb_policy_ == nullptr) {
|
||||
grpc_error* state_error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
||||
"Resolver transient failure", &error, 1);
|
||||
grpc_error_handle state_error =
|
||||
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
||||
"Resolver transient failure", &error, 1);
|
||||
{
|
||||
MutexLock lock(&resolution_mu_);
|
||||
// Update resolver transient failure.
|
||||
|
|
@ -1369,7 +1372,7 @@ void ClientChannel::OnResolverErrorLocked(grpc_error* error) {
|
|||
call = call->next) {
|
||||
grpc_call_element* elem = call->elem;
|
||||
CallData* calld = static_cast<CallData*>(elem->call_data);
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
if (calld->CheckResolutionLocked(elem, &error)) {
|
||||
calld->AsyncResolutionDone(elem, error);
|
||||
}
|
||||
|
|
@ -1550,7 +1553,7 @@ void ClientChannel::UpdateServiceConfigInDataPlaneLocked() {
|
|||
call = call->next) {
|
||||
grpc_call_element* elem = call->elem;
|
||||
CallData* calld = static_cast<CallData*>(elem->call_data);
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
if (calld->CheckResolutionLocked(elem, &error)) {
|
||||
calld->AsyncResolutionDone(elem, error);
|
||||
}
|
||||
|
|
@ -1660,7 +1663,7 @@ void ClientChannel::UpdateStateAndPickerLocked(
|
|||
// Re-process queued picks.
|
||||
for (LbQueuedCall* call = lb_queued_calls_; call != nullptr;
|
||||
call = call->next) {
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
if (call->lb_call->PickSubchannelLocked(&error)) {
|
||||
call->lb_call->AsyncPickDone(error);
|
||||
}
|
||||
|
|
@ -1671,7 +1674,7 @@ void ClientChannel::UpdateStateAndPickerLocked(
|
|||
pending_subchannel_updates_.clear();
|
||||
}
|
||||
|
||||
grpc_error* ClientChannel::DoPingLocked(grpc_transport_op* op) {
|
||||
grpc_error_handle ClientChannel::DoPingLocked(grpc_transport_op* op) {
|
||||
if (state_tracker_.state() != GRPC_CHANNEL_READY) {
|
||||
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("channel not connected");
|
||||
}
|
||||
|
|
@ -1708,7 +1711,7 @@ void ClientChannel::StartTransportOpLocked(grpc_transport_op* op) {
|
|||
}
|
||||
// Ping.
|
||||
if (op->send_ping.on_initiate != nullptr || op->send_ping.on_ack != nullptr) {
|
||||
grpc_error* error = DoPingLocked(op);
|
||||
grpc_error_handle error = DoPingLocked(op);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
ExecCtx::Run(DEBUG_LOCATION, op->send_ping.on_initiate,
|
||||
GRPC_ERROR_REF(error));
|
||||
|
|
@ -1889,8 +1892,8 @@ ClientChannel::CallData::~CallData() {
|
|||
}
|
||||
}
|
||||
|
||||
grpc_error* ClientChannel::CallData::Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
grpc_error_handle ClientChannel::CallData::Init(
|
||||
grpc_call_element* elem, const grpc_call_element_args* args) {
|
||||
ClientChannel* chand = static_cast<ClientChannel*>(elem->channel_data);
|
||||
new (elem->call_data) CallData(elem, *chand, *args);
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -2041,7 +2044,7 @@ void ClientChannel::CallData::PendingBatchesAdd(
|
|||
|
||||
// This is called via the call combiner, so access to calld is synchronized.
|
||||
void ClientChannel::CallData::FailPendingBatchInCallCombiner(
|
||||
void* arg, grpc_error* error) {
|
||||
void* arg, grpc_error_handle error) {
|
||||
grpc_transport_stream_op_batch* batch =
|
||||
static_cast<grpc_transport_stream_op_batch*>(arg);
|
||||
CallData* calld = static_cast<CallData*>(batch->handler_private.extra_arg);
|
||||
|
|
@ -2052,7 +2055,7 @@ void ClientChannel::CallData::FailPendingBatchInCallCombiner(
|
|||
|
||||
// This is called via the call combiner, so access to calld is synchronized.
|
||||
void ClientChannel::CallData::PendingBatchesFail(
|
||||
grpc_call_element* elem, grpc_error* error,
|
||||
grpc_call_element* elem, grpc_error_handle error,
|
||||
YieldCallCombinerPredicate yield_call_combiner_predicate) {
|
||||
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
|
||||
|
|
@ -2087,7 +2090,7 @@ void ClientChannel::CallData::PendingBatchesFail(
|
|||
|
||||
// This is called via the call combiner, so access to calld is synchronized.
|
||||
void ClientChannel::CallData::ResumePendingBatchInCallCombiner(
|
||||
void* arg, grpc_error* /*ignored*/) {
|
||||
void* arg, grpc_error_handle /*ignored*/) {
|
||||
grpc_transport_stream_op_batch* batch =
|
||||
static_cast<grpc_transport_stream_op_batch*>(arg);
|
||||
auto* elem =
|
||||
|
|
@ -2144,7 +2147,7 @@ class ClientChannel::CallData::ResolverQueuedCallCanceller {
|
|||
}
|
||||
|
||||
private:
|
||||
static void CancelLocked(void* arg, grpc_error* error) {
|
||||
static void CancelLocked(void* arg, grpc_error_handle error) {
|
||||
auto* self = static_cast<ResolverQueuedCallCanceller*>(arg);
|
||||
auto* chand = static_cast<ClientChannel*>(self->elem_->channel_data);
|
||||
auto* calld = static_cast<CallData*>(self->elem_->call_data);
|
||||
|
|
@ -2203,7 +2206,7 @@ void ClientChannel::CallData::MaybeAddCallToResolverQueuedCallsLocked(
|
|||
resolver_call_canceller_ = new ResolverQueuedCallCanceller(elem);
|
||||
}
|
||||
|
||||
grpc_error* ClientChannel::CallData::ApplyServiceConfigToCallLocked(
|
||||
grpc_error_handle ClientChannel::CallData::ApplyServiceConfigToCallLocked(
|
||||
grpc_call_element* elem, grpc_metadata_batch* initial_metadata) {
|
||||
ClientChannel* chand = static_cast<ClientChannel*>(elem->channel_data);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
||||
|
|
@ -2263,8 +2266,8 @@ grpc_error* ClientChannel::CallData::ApplyServiceConfigToCallLocked(
|
|||
}
|
||||
|
||||
void ClientChannel::CallData::
|
||||
RecvInitialMetadataReadyForConfigSelectorCommitCallback(void* arg,
|
||||
grpc_error* error) {
|
||||
RecvInitialMetadataReadyForConfigSelectorCommitCallback(
|
||||
void* arg, grpc_error_handle error) {
|
||||
auto* self = static_cast<CallData*>(arg);
|
||||
if (self->on_call_committed_ != nullptr) {
|
||||
self->on_call_committed_();
|
||||
|
|
@ -2290,12 +2293,13 @@ void ClientChannel::CallData::
|
|||
}
|
||||
|
||||
void ClientChannel::CallData::AsyncResolutionDone(grpc_call_element* elem,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
GRPC_CLOSURE_INIT(&pick_closure_, ResolutionDone, elem, nullptr);
|
||||
ExecCtx::Run(DEBUG_LOCATION, &pick_closure_, error);
|
||||
}
|
||||
|
||||
void ClientChannel::CallData::ResolutionDone(void* arg, grpc_error* error) {
|
||||
void ClientChannel::CallData::ResolutionDone(void* arg,
|
||||
grpc_error_handle error) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
|
||||
ClientChannel* chand = static_cast<ClientChannel*>(elem->channel_data);
|
||||
CallData* calld = static_cast<CallData*>(elem->call_data);
|
||||
|
|
@ -2311,7 +2315,8 @@ void ClientChannel::CallData::ResolutionDone(void* arg, grpc_error* error) {
|
|||
calld->CreateDynamicCall(elem);
|
||||
}
|
||||
|
||||
void ClientChannel::CallData::CheckResolution(void* arg, grpc_error* error) {
|
||||
void ClientChannel::CallData::CheckResolution(void* arg,
|
||||
grpc_error_handle error) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
|
||||
CallData* calld = static_cast<CallData*>(elem->call_data);
|
||||
ClientChannel* chand = static_cast<ClientChannel*>(elem->channel_data);
|
||||
|
|
@ -2327,7 +2332,7 @@ void ClientChannel::CallData::CheckResolution(void* arg, grpc_error* error) {
|
|||
}
|
||||
|
||||
bool ClientChannel::CallData::CheckResolutionLocked(grpc_call_element* elem,
|
||||
grpc_error** error) {
|
||||
grpc_error_handle* error) {
|
||||
ClientChannel* chand = static_cast<ClientChannel*>(elem->channel_data);
|
||||
// If we're still in IDLE, we need to start resolving.
|
||||
if (GPR_UNLIKELY(chand->CheckConnectivityState(false) == GRPC_CHANNEL_IDLE)) {
|
||||
|
|
@ -2339,7 +2344,7 @@ bool ClientChannel::CallData::CheckResolutionLocked(grpc_call_element* elem,
|
|||
ExecCtx::Run(
|
||||
DEBUG_LOCATION,
|
||||
GRPC_CLOSURE_CREATE(
|
||||
[](void* arg, grpc_error* /*error*/) {
|
||||
[](void* arg, grpc_error_handle /*error*/) {
|
||||
auto* chand = static_cast<ClientChannel*>(arg);
|
||||
chand->work_serializer_->Run(
|
||||
[chand]()
|
||||
|
|
@ -2365,7 +2370,7 @@ bool ClientChannel::CallData::CheckResolutionLocked(grpc_call_element* elem,
|
|||
if (GPR_UNLIKELY(!chand->received_service_config_data_)) {
|
||||
// If the resolver returned transient failure before returning the
|
||||
// first service config, fail any non-wait_for_ready calls.
|
||||
grpc_error* resolver_error = chand->resolver_transient_failure_error_;
|
||||
grpc_error_handle resolver_error = chand->resolver_transient_failure_error_;
|
||||
if (resolver_error != GRPC_ERROR_NONE &&
|
||||
(send_initial_metadata_flags & GRPC_INITIAL_METADATA_WAIT_FOR_READY) ==
|
||||
0) {
|
||||
|
|
@ -2398,7 +2403,7 @@ void ClientChannel::CallData::CreateDynamicCall(grpc_call_element* elem) {
|
|||
arena_,
|
||||
call_context_,
|
||||
call_combiner_};
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
DynamicFilters* channel_stack = args.channel_stack.get();
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
||||
gpr_log(
|
||||
|
|
@ -2589,7 +2594,7 @@ void ClientChannel::LoadBalancedCall::PendingBatchesAdd(
|
|||
|
||||
// This is called via the call combiner, so access to calld is synchronized.
|
||||
void ClientChannel::LoadBalancedCall::FailPendingBatchInCallCombiner(
|
||||
void* arg, grpc_error* error) {
|
||||
void* arg, grpc_error_handle error) {
|
||||
grpc_transport_stream_op_batch* batch =
|
||||
static_cast<grpc_transport_stream_op_batch*>(arg);
|
||||
auto* self = static_cast<LoadBalancedCall*>(batch->handler_private.extra_arg);
|
||||
|
|
@ -2600,7 +2605,7 @@ void ClientChannel::LoadBalancedCall::FailPendingBatchInCallCombiner(
|
|||
|
||||
// This is called via the call combiner, so access to calld is synchronized.
|
||||
void ClientChannel::LoadBalancedCall::PendingBatchesFail(
|
||||
grpc_error* error,
|
||||
grpc_error_handle error,
|
||||
YieldCallCombinerPredicate yield_call_combiner_predicate) {
|
||||
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
||||
GRPC_ERROR_UNREF(failure_error_);
|
||||
|
|
@ -2636,7 +2641,7 @@ void ClientChannel::LoadBalancedCall::PendingBatchesFail(
|
|||
|
||||
// This is called via the call combiner, so access to calld is synchronized.
|
||||
void ClientChannel::LoadBalancedCall::ResumePendingBatchInCallCombiner(
|
||||
void* arg, grpc_error* /*ignored*/) {
|
||||
void* arg, grpc_error_handle /*ignored*/) {
|
||||
grpc_transport_stream_op_batch* batch =
|
||||
static_cast<grpc_transport_stream_op_batch*>(arg);
|
||||
SubchannelCall* subchannel_call =
|
||||
|
|
@ -2757,11 +2762,11 @@ void ClientChannel::LoadBalancedCall::StartTransportStreamOpBatch(
|
|||
|
||||
void ClientChannel::LoadBalancedCall::
|
||||
RecvTrailingMetadataReadyForLoadBalancingPolicy(void* arg,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
auto* self = static_cast<LoadBalancedCall*>(arg);
|
||||
if (self->lb_recv_trailing_metadata_ready_ != nullptr) {
|
||||
// Set error if call did not succeed.
|
||||
grpc_error* error_for_lb = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error_for_lb = GRPC_ERROR_NONE;
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
error_for_lb = error;
|
||||
} else {
|
||||
|
|
@ -2820,7 +2825,7 @@ void ClientChannel::LoadBalancedCall::CreateSubchannelCall() {
|
|||
// TODO(roth): When we implement hedging support, we will probably
|
||||
// need to use a separate call context for each subchannel call.
|
||||
call_context_, call_combiner_};
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
subchannel_call_ = SubchannelCall::Create(std::move(call_args), &error);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
||||
gpr_log(GPR_INFO,
|
||||
|
|
@ -2855,7 +2860,7 @@ class ClientChannel::LoadBalancedCall::LbQueuedCallCanceller {
|
|||
}
|
||||
|
||||
private:
|
||||
static void CancelLocked(void* arg, grpc_error* error) {
|
||||
static void CancelLocked(void* arg, grpc_error_handle error) {
|
||||
auto* self = static_cast<LbQueuedCallCanceller*>(arg);
|
||||
auto* lb_call = self->lb_call_.get();
|
||||
auto* chand = lb_call->chand_;
|
||||
|
|
@ -2909,12 +2914,13 @@ void ClientChannel::LoadBalancedCall::MaybeAddCallToLbQueuedCallsLocked() {
|
|||
lb_call_canceller_ = new LbQueuedCallCanceller(Ref());
|
||||
}
|
||||
|
||||
void ClientChannel::LoadBalancedCall::AsyncPickDone(grpc_error* error) {
|
||||
void ClientChannel::LoadBalancedCall::AsyncPickDone(grpc_error_handle error) {
|
||||
GRPC_CLOSURE_INIT(&pick_closure_, PickDone, this, grpc_schedule_on_exec_ctx);
|
||||
ExecCtx::Run(DEBUG_LOCATION, &pick_closure_, error);
|
||||
}
|
||||
|
||||
void ClientChannel::LoadBalancedCall::PickDone(void* arg, grpc_error* error) {
|
||||
void ClientChannel::LoadBalancedCall::PickDone(void* arg,
|
||||
grpc_error_handle error) {
|
||||
auto* self = static_cast<LoadBalancedCall*>(arg);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
||||
|
|
@ -2946,7 +2952,7 @@ const char* PickResultTypeName(
|
|||
} // namespace
|
||||
|
||||
void ClientChannel::LoadBalancedCall::PickSubchannel(void* arg,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
auto* self = static_cast<LoadBalancedCall*>(arg);
|
||||
bool pick_complete;
|
||||
{
|
||||
|
|
@ -2959,7 +2965,8 @@ void ClientChannel::LoadBalancedCall::PickSubchannel(void* arg,
|
|||
}
|
||||
}
|
||||
|
||||
bool ClientChannel::LoadBalancedCall::PickSubchannelLocked(grpc_error** error) {
|
||||
bool ClientChannel::LoadBalancedCall::PickSubchannelLocked(
|
||||
grpc_error_handle* error) {
|
||||
GPR_ASSERT(connected_subchannel_ == nullptr);
|
||||
GPR_ASSERT(subchannel_call_ == nullptr);
|
||||
// Grab initial metadata.
|
||||
|
|
@ -2987,7 +2994,7 @@ bool ClientChannel::LoadBalancedCall::PickSubchannelLocked(grpc_error** error) {
|
|||
switch (result.type) {
|
||||
case LoadBalancingPolicy::PickResult::PICK_FAILED: {
|
||||
// If we're shutting down, fail all RPCs.
|
||||
grpc_error* disconnect_error = chand_->disconnect_error();
|
||||
grpc_error_handle disconnect_error = chand_->disconnect_error();
|
||||
if (disconnect_error != GRPC_ERROR_NONE) {
|
||||
GRPC_ERROR_UNREF(result.error);
|
||||
MaybeRemoveCallFromLbQueuedCallsLocked();
|
||||
|
|
@ -2998,7 +3005,7 @@ bool ClientChannel::LoadBalancedCall::PickSubchannelLocked(grpc_error** error) {
|
|||
// attempt's final status.
|
||||
if ((send_initial_metadata_flags &
|
||||
GRPC_INITIAL_METADATA_WAIT_FOR_READY) == 0) {
|
||||
grpc_error* new_error =
|
||||
grpc_error_handle new_error =
|
||||
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
||||
"Failed to pick subchannel", &result.error, 1);
|
||||
GRPC_ERROR_UNREF(result.error);
|
||||
|
|
|
|||
|
|
@ -192,12 +192,12 @@ class ClientChannel {
|
|||
LbQueuedCall* next = nullptr;
|
||||
};
|
||||
|
||||
ClientChannel(grpc_channel_element_args* args, grpc_error** error);
|
||||
ClientChannel(grpc_channel_element_args* args, grpc_error_handle* error);
|
||||
~ClientChannel();
|
||||
|
||||
// Filter vtable functions.
|
||||
static grpc_error* Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args);
|
||||
static grpc_error_handle Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args);
|
||||
static void Destroy(grpc_channel_element* elem);
|
||||
static void StartTransportOp(grpc_channel_element* elem,
|
||||
grpc_transport_op* op);
|
||||
|
|
@ -205,7 +205,7 @@ class ClientChannel {
|
|||
const grpc_channel_info* info);
|
||||
|
||||
// Note: Does NOT return a new ref.
|
||||
grpc_error* disconnect_error() const {
|
||||
grpc_error_handle disconnect_error() const {
|
||||
return disconnect_error_.Load(MemoryOrder::ACQUIRE);
|
||||
}
|
||||
|
||||
|
|
@ -214,7 +214,7 @@ class ClientChannel {
|
|||
|
||||
void OnResolverResultChangedLocked(Resolver::Result result)
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(work_serializer_);
|
||||
void OnResolverErrorLocked(grpc_error* error)
|
||||
void OnResolverErrorLocked(grpc_error_handle error)
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(work_serializer_);
|
||||
|
||||
void CreateOrUpdateLbPolicyLocked(
|
||||
|
|
@ -244,7 +244,7 @@ class ClientChannel {
|
|||
void DestroyResolverAndLbPolicyLocked()
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(work_serializer_);
|
||||
|
||||
grpc_error* DoPingLocked(grpc_transport_op* op)
|
||||
grpc_error_handle DoPingLocked(grpc_transport_op* op)
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(work_serializer_);
|
||||
|
||||
void StartTransportOpLocked(grpc_transport_op* op)
|
||||
|
|
@ -291,7 +291,7 @@ class ClientChannel {
|
|||
ResolverQueuedCall* resolver_queued_calls_ ABSL_GUARDED_BY(resolution_mu_) =
|
||||
nullptr;
|
||||
// Data from service config.
|
||||
grpc_error* resolver_transient_failure_error_
|
||||
grpc_error_handle resolver_transient_failure_error_
|
||||
ABSL_GUARDED_BY(resolution_mu_) = GRPC_ERROR_NONE;
|
||||
bool received_service_config_data_ ABSL_GUARDED_BY(resolution_mu_) = false;
|
||||
RefCountedPtr<ServiceConfig> service_config_ ABSL_GUARDED_BY(resolution_mu_);
|
||||
|
|
@ -346,7 +346,7 @@ class ClientChannel {
|
|||
// Fields accessed from both data plane mutex and control plane
|
||||
// work_serializer.
|
||||
//
|
||||
Atomic<grpc_error*> disconnect_error_;
|
||||
Atomic<grpc_error_handle> disconnect_error_;
|
||||
|
||||
//
|
||||
// Fields guarded by a mutex, since they need to be accessed
|
||||
|
|
@ -390,15 +390,15 @@ class ClientChannel::LoadBalancedCall
|
|||
void StartTransportStreamOpBatch(grpc_transport_stream_op_batch* batch);
|
||||
|
||||
// Invoked by channel for queued LB picks when the picker is updated.
|
||||
static void PickSubchannel(void* arg, grpc_error* error);
|
||||
static void PickSubchannel(void* arg, grpc_error_handle error);
|
||||
// Helper function for performing an LB pick while holding the data plane
|
||||
// mutex. Returns true if the pick is complete, in which case the caller
|
||||
// must invoke PickDone() or AsyncPickDone() with the returned error.
|
||||
bool PickSubchannelLocked(grpc_error** error)
|
||||
bool PickSubchannelLocked(grpc_error_handle* error)
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&ClientChannel::data_plane_mu_);
|
||||
// Schedules a callback to process the completed pick. The callback
|
||||
// will not run until after this method returns.
|
||||
void AsyncPickDone(grpc_error* error);
|
||||
void AsyncPickDone(grpc_error_handle error);
|
||||
|
||||
RefCountedPtr<SubchannelCall> subchannel_call() const {
|
||||
return subchannel_call_;
|
||||
|
|
@ -412,7 +412,8 @@ class ClientChannel::LoadBalancedCall
|
|||
// Returns the index into pending_batches_ to be used for batch.
|
||||
static size_t GetBatchIndex(grpc_transport_stream_op_batch* batch);
|
||||
void PendingBatchesAdd(grpc_transport_stream_op_batch* batch);
|
||||
static void FailPendingBatchInCallCombiner(void* arg, grpc_error* error);
|
||||
static void FailPendingBatchInCallCombiner(void* arg,
|
||||
grpc_error_handle error);
|
||||
// A predicate type and some useful implementations for PendingBatchesFail().
|
||||
typedef bool (*YieldCallCombinerPredicate)(
|
||||
const CallCombinerClosureList& closures);
|
||||
|
|
@ -430,20 +431,21 @@ class ClientChannel::LoadBalancedCall
|
|||
// If yield_call_combiner_predicate returns true, assumes responsibility for
|
||||
// yielding the call combiner.
|
||||
void PendingBatchesFail(
|
||||
grpc_error* error,
|
||||
grpc_error_handle error,
|
||||
YieldCallCombinerPredicate yield_call_combiner_predicate);
|
||||
static void ResumePendingBatchInCallCombiner(void* arg, grpc_error* ignored);
|
||||
static void ResumePendingBatchInCallCombiner(void* arg,
|
||||
grpc_error_handle ignored);
|
||||
// Resumes all pending batches on subchannel_call_.
|
||||
void PendingBatchesResume();
|
||||
|
||||
static void RecvTrailingMetadataReadyForLoadBalancingPolicy(
|
||||
void* arg, grpc_error* error);
|
||||
void* arg, grpc_error_handle error);
|
||||
void InjectRecvTrailingMetadataReadyForLoadBalancingPolicy(
|
||||
grpc_transport_stream_op_batch* batch);
|
||||
|
||||
void CreateSubchannelCall();
|
||||
// Invoked when a pick is completed, on both success or failure.
|
||||
static void PickDone(void* arg, grpc_error* error);
|
||||
static void PickDone(void* arg, grpc_error_handle error);
|
||||
// Removes the call from the channel's list of queued picks if present.
|
||||
void MaybeRemoveCallFromLbQueuedCallsLocked()
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&ClientChannel::data_plane_mu_);
|
||||
|
|
@ -467,10 +469,10 @@ class ClientChannel::LoadBalancedCall
|
|||
grpc_closure* on_call_destruction_complete_;
|
||||
|
||||
// Set when we get a cancel_stream op.
|
||||
grpc_error* cancel_error_ = GRPC_ERROR_NONE;
|
||||
grpc_error_handle cancel_error_ = GRPC_ERROR_NONE;
|
||||
|
||||
// Set when we fail inside the LB call.
|
||||
grpc_error* failure_error_ = GRPC_ERROR_NONE;
|
||||
grpc_error_handle failure_error_ = GRPC_ERROR_NONE;
|
||||
|
||||
grpc_closure pick_closure_;
|
||||
|
||||
|
|
@ -484,7 +486,7 @@ class ClientChannel::LoadBalancedCall
|
|||
|
||||
RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
|
||||
const LoadBalancingPolicy::BackendMetricData* backend_metric_data_ = nullptr;
|
||||
std::function<void(grpc_error*, LoadBalancingPolicy::MetadataInterface*,
|
||||
std::function<void(grpc_error_handle, LoadBalancingPolicy::MetadataInterface*,
|
||||
LoadBalancingPolicy::CallState*)>
|
||||
lb_recv_trailing_metadata_ready_;
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class ConfigSelector : public RefCounted<ConfigSelector> {
|
|||
|
||||
struct CallConfig {
|
||||
// Can be set to indicate the call should be failed.
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
// The per-method parsed configs that will be passed to
|
||||
// ServiceConfigCallData.
|
||||
const ServiceConfigParser::ParsedConfigVector* method_configs = nullptr;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class SubchannelConnector : public InternallyRefCounted<SubchannelConnector> {
|
|||
|
||||
// Cancels any in-flight connection attempt and shuts down the
|
||||
// connector.
|
||||
virtual void Shutdown(grpc_error* error) = 0;
|
||||
virtual void Shutdown(grpc_error_handle error) = 0;
|
||||
|
||||
void Orphan() override {
|
||||
Shutdown(GRPC_ERROR_CREATE_FROM_STATIC_STRING("Subchannel disconnected"));
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace grpc_core {
|
|||
// DynamicFilters::Call
|
||||
//
|
||||
|
||||
DynamicFilters::Call::Call(Args args, grpc_error** error)
|
||||
DynamicFilters::Call::Call(Args args, grpc_error_handle* error)
|
||||
: channel_stack_(std::move(args.channel_stack)) {
|
||||
grpc_call_stack* call_stack = CALL_TO_CALL_STACK(this);
|
||||
const grpc_call_element_args call_args = {
|
||||
|
|
@ -94,7 +94,7 @@ void DynamicFilters::Call::Unref(const DebugLocation& /*location*/,
|
|||
GRPC_CALL_STACK_UNREF(CALL_TO_CALL_STACK(this), reason);
|
||||
}
|
||||
|
||||
void DynamicFilters::Call::Destroy(void* arg, grpc_error* /*error*/) {
|
||||
void DynamicFilters::Call::Destroy(void* arg, grpc_error_handle /*error*/) {
|
||||
DynamicFilters::Call* self = static_cast<DynamicFilters::Call*>(arg);
|
||||
// Keep some members before destroying the subchannel call.
|
||||
grpc_closure* after_call_stack_destroy = self->after_call_stack_destroy_;
|
||||
|
|
@ -124,13 +124,13 @@ void DynamicFilters::Call::IncrementRefCount(
|
|||
|
||||
namespace {
|
||||
|
||||
void DestroyChannelStack(void* arg, grpc_error* /*error*/) {
|
||||
void DestroyChannelStack(void* arg, grpc_error_handle /*error*/) {
|
||||
grpc_channel_stack* channel_stack = static_cast<grpc_channel_stack*>(arg);
|
||||
grpc_channel_stack_destroy(channel_stack);
|
||||
gpr_free(channel_stack);
|
||||
}
|
||||
|
||||
std::pair<grpc_channel_stack*, grpc_error*> CreateChannelStack(
|
||||
std::pair<grpc_channel_stack*, grpc_error_handle> CreateChannelStack(
|
||||
const grpc_channel_args* args,
|
||||
std::vector<const grpc_channel_filter*> filters) {
|
||||
// Allocate memory for channel stack.
|
||||
|
|
@ -139,7 +139,7 @@ std::pair<grpc_channel_stack*, grpc_error*> CreateChannelStack(
|
|||
grpc_channel_stack* channel_stack =
|
||||
reinterpret_cast<grpc_channel_stack*>(gpr_zalloc(channel_stack_size));
|
||||
// Initialize stack.
|
||||
grpc_error* error = grpc_channel_stack_init(
|
||||
grpc_error_handle error = grpc_channel_stack_init(
|
||||
/*initial_refs=*/1, DestroyChannelStack, channel_stack, filters.data(),
|
||||
filters.size(), args, /*optional_transport=*/nullptr, "DynamicFilters",
|
||||
channel_stack);
|
||||
|
|
@ -163,7 +163,7 @@ RefCountedPtr<DynamicFilters> DynamicFilters::Create(
|
|||
if (p.second != GRPC_ERROR_NONE) {
|
||||
// Channel stack creation failed with requested filters.
|
||||
// Create with lame filter instead.
|
||||
grpc_error* error = p.second;
|
||||
grpc_error_handle error = p.second;
|
||||
grpc_arg error_arg = MakeLameClientErrorArg(error);
|
||||
grpc_channel_args* new_args =
|
||||
grpc_channel_args_copy_and_add(args, &error_arg, 1);
|
||||
|
|
@ -180,7 +180,7 @@ DynamicFilters::~DynamicFilters() {
|
|||
}
|
||||
|
||||
RefCountedPtr<DynamicFilters::Call> DynamicFilters::CreateCall(
|
||||
DynamicFilters::Call::Args args, grpc_error** error) {
|
||||
DynamicFilters::Call::Args args, grpc_error_handle* error) {
|
||||
size_t allocation_size = GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(Call)) +
|
||||
channel_stack_->call_stack_size;
|
||||
Call* call = static_cast<Call*>(args.arena->Alloc(allocation_size));
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class DynamicFilters : public RefCounted<DynamicFilters> {
|
|||
CallCombiner* call_combiner;
|
||||
};
|
||||
|
||||
Call(Args args, grpc_error** error);
|
||||
Call(Args args, grpc_error_handle* error);
|
||||
|
||||
// Continues processing a transport stream op batch.
|
||||
void StartTransportStreamOpBatch(grpc_transport_stream_op_batch* batch);
|
||||
|
|
@ -73,7 +73,7 @@ class DynamicFilters : public RefCounted<DynamicFilters> {
|
|||
void IncrementRefCount();
|
||||
void IncrementRefCount(const DebugLocation& location, const char* reason);
|
||||
|
||||
static void Destroy(void* arg, grpc_error* error);
|
||||
static void Destroy(void* arg, grpc_error_handle error);
|
||||
|
||||
RefCountedPtr<DynamicFilters> channel_stack_;
|
||||
grpc_closure* after_call_stack_destroy_ = nullptr;
|
||||
|
|
@ -88,7 +88,7 @@ class DynamicFilters : public RefCounted<DynamicFilters> {
|
|||
|
||||
~DynamicFilters() override;
|
||||
|
||||
RefCountedPtr<Call> CreateCall(Call::Args args, grpc_error** error);
|
||||
RefCountedPtr<Call> CreateCall(Call::Args args, grpc_error_handle* error);
|
||||
|
||||
private:
|
||||
grpc_channel_stack* channel_stack_;
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ void HealthCheckClient::StartRetryTimerLocked() {
|
|||
grpc_timer_init(&retry_timer_, next_try, &retry_timer_callback_);
|
||||
}
|
||||
|
||||
void HealthCheckClient::OnRetryTimer(void* arg, grpc_error* error) {
|
||||
void HealthCheckClient::OnRetryTimer(void* arg, grpc_error_handle error) {
|
||||
HealthCheckClient* self = static_cast<HealthCheckClient*>(arg);
|
||||
{
|
||||
MutexLock lock(&self->mu_);
|
||||
|
|
@ -202,7 +202,7 @@ void EncodeRequest(const std::string& service_name,
|
|||
|
||||
// Returns true if healthy.
|
||||
// If there was an error parsing the response, sets *error and returns false.
|
||||
bool DecodeResponse(grpc_slice_buffer* slice_buffer, grpc_error** error) {
|
||||
bool DecodeResponse(grpc_slice_buffer* slice_buffer, grpc_error_handle* error) {
|
||||
// If message is empty, assume unhealthy.
|
||||
if (slice_buffer->length == 0) {
|
||||
*error =
|
||||
|
|
@ -290,7 +290,7 @@ void HealthCheckClient::CallState::StartCall() {
|
|||
context_,
|
||||
&call_combiner_,
|
||||
};
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
call_ = SubchannelCall::Create(std::move(args), &error).release();
|
||||
// Register after-destruction callback.
|
||||
GRPC_CLOSURE_INIT(&after_call_stack_destruction_, AfterCallStackDestruction,
|
||||
|
|
@ -378,7 +378,7 @@ void HealthCheckClient::CallState::StartCall() {
|
|||
}
|
||||
|
||||
void HealthCheckClient::CallState::StartBatchInCallCombiner(
|
||||
void* arg, grpc_error* /*error*/) {
|
||||
void* arg, grpc_error_handle /*error*/) {
|
||||
grpc_transport_stream_op_batch* batch =
|
||||
static_cast<grpc_transport_stream_op_batch*>(arg);
|
||||
SubchannelCall* call =
|
||||
|
|
@ -396,14 +396,14 @@ void HealthCheckClient::CallState::StartBatch(
|
|||
}
|
||||
|
||||
void HealthCheckClient::CallState::AfterCallStackDestruction(
|
||||
void* arg, grpc_error* /*error*/) {
|
||||
void* arg, grpc_error_handle /*error*/) {
|
||||
HealthCheckClient::CallState* self =
|
||||
static_cast<HealthCheckClient::CallState*>(arg);
|
||||
delete self;
|
||||
}
|
||||
|
||||
void HealthCheckClient::CallState::OnCancelComplete(void* arg,
|
||||
grpc_error* /*error*/) {
|
||||
void HealthCheckClient::CallState::OnCancelComplete(
|
||||
void* arg, grpc_error_handle /*error*/) {
|
||||
HealthCheckClient::CallState* self =
|
||||
static_cast<HealthCheckClient::CallState*>(arg);
|
||||
GRPC_CALL_COMBINER_STOP(&self->call_combiner_, "health_cancel");
|
||||
|
|
@ -411,7 +411,7 @@ void HealthCheckClient::CallState::OnCancelComplete(void* arg,
|
|||
}
|
||||
|
||||
void HealthCheckClient::CallState::StartCancel(void* arg,
|
||||
grpc_error* /*error*/) {
|
||||
grpc_error_handle /*error*/) {
|
||||
HealthCheckClient::CallState* self =
|
||||
static_cast<HealthCheckClient::CallState*>(arg);
|
||||
auto* batch = grpc_make_transport_stream_op(
|
||||
|
|
@ -434,7 +434,7 @@ void HealthCheckClient::CallState::Cancel() {
|
|||
}
|
||||
|
||||
void HealthCheckClient::CallState::OnComplete(void* arg,
|
||||
grpc_error* /*error*/) {
|
||||
grpc_error_handle /*error*/) {
|
||||
HealthCheckClient::CallState* self =
|
||||
static_cast<HealthCheckClient::CallState*>(arg);
|
||||
GRPC_CALL_COMBINER_STOP(&self->call_combiner_, "on_complete");
|
||||
|
|
@ -444,7 +444,7 @@ void HealthCheckClient::CallState::OnComplete(void* arg,
|
|||
}
|
||||
|
||||
void HealthCheckClient::CallState::RecvInitialMetadataReady(
|
||||
void* arg, grpc_error* /*error*/) {
|
||||
void* arg, grpc_error_handle /*error*/) {
|
||||
HealthCheckClient::CallState* self =
|
||||
static_cast<HealthCheckClient::CallState*>(arg);
|
||||
GRPC_CALL_COMBINER_STOP(&self->call_combiner_, "recv_initial_metadata_ready");
|
||||
|
|
@ -452,7 +452,8 @@ void HealthCheckClient::CallState::RecvInitialMetadataReady(
|
|||
self->call_->Unref(DEBUG_LOCATION, "recv_initial_metadata_ready");
|
||||
}
|
||||
|
||||
void HealthCheckClient::CallState::DoneReadingRecvMessage(grpc_error* error) {
|
||||
void HealthCheckClient::CallState::DoneReadingRecvMessage(
|
||||
grpc_error_handle error) {
|
||||
recv_message_.reset();
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
GRPC_ERROR_UNREF(error);
|
||||
|
|
@ -482,9 +483,9 @@ void HealthCheckClient::CallState::DoneReadingRecvMessage(grpc_error* error) {
|
|||
StartBatch(&recv_message_batch_);
|
||||
}
|
||||
|
||||
grpc_error* HealthCheckClient::CallState::PullSliceFromRecvMessage() {
|
||||
grpc_error_handle HealthCheckClient::CallState::PullSliceFromRecvMessage() {
|
||||
grpc_slice slice;
|
||||
grpc_error* error = recv_message_->Pull(&slice);
|
||||
grpc_error_handle error = recv_message_->Pull(&slice);
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
grpc_slice_buffer_add(&recv_message_buffer_, slice);
|
||||
}
|
||||
|
|
@ -493,7 +494,7 @@ grpc_error* HealthCheckClient::CallState::PullSliceFromRecvMessage() {
|
|||
|
||||
void HealthCheckClient::CallState::ContinueReadingRecvMessage() {
|
||||
while (recv_message_->Next(SIZE_MAX, &recv_message_ready_)) {
|
||||
grpc_error* error = PullSliceFromRecvMessage();
|
||||
grpc_error_handle error = PullSliceFromRecvMessage();
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
DoneReadingRecvMessage(error);
|
||||
return;
|
||||
|
|
@ -506,7 +507,7 @@ void HealthCheckClient::CallState::ContinueReadingRecvMessage() {
|
|||
}
|
||||
|
||||
void HealthCheckClient::CallState::OnByteStreamNext(void* arg,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
HealthCheckClient::CallState* self =
|
||||
static_cast<HealthCheckClient::CallState*>(arg);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
|
|
@ -525,8 +526,8 @@ void HealthCheckClient::CallState::OnByteStreamNext(void* arg,
|
|||
}
|
||||
}
|
||||
|
||||
void HealthCheckClient::CallState::RecvMessageReady(void* arg,
|
||||
grpc_error* /*error*/) {
|
||||
void HealthCheckClient::CallState::RecvMessageReady(
|
||||
void* arg, grpc_error_handle /*error*/) {
|
||||
HealthCheckClient::CallState* self =
|
||||
static_cast<HealthCheckClient::CallState*>(arg);
|
||||
GRPC_CALL_COMBINER_STOP(&self->call_combiner_, "recv_message_ready");
|
||||
|
|
@ -542,7 +543,7 @@ void HealthCheckClient::CallState::RecvMessageReady(void* arg,
|
|||
}
|
||||
|
||||
void HealthCheckClient::CallState::RecvTrailingMetadataReady(
|
||||
void* arg, grpc_error* error) {
|
||||
void* arg, grpc_error_handle error) {
|
||||
HealthCheckClient::CallState* self =
|
||||
static_cast<HealthCheckClient::CallState*>(arg);
|
||||
GRPC_CALL_COMBINER_STOP(&self->call_combiner_,
|
||||
|
|
|
|||
|
|
@ -70,24 +70,24 @@ class HealthCheckClient : public InternallyRefCounted<HealthCheckClient> {
|
|||
void Cancel();
|
||||
|
||||
void StartBatch(grpc_transport_stream_op_batch* batch);
|
||||
static void StartBatchInCallCombiner(void* arg, grpc_error* error);
|
||||
static void StartBatchInCallCombiner(void* arg, grpc_error_handle error);
|
||||
|
||||
void CallEndedLocked(bool retry)
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(health_check_client_->mu_);
|
||||
|
||||
static void OnComplete(void* arg, grpc_error* error);
|
||||
static void RecvInitialMetadataReady(void* arg, grpc_error* error);
|
||||
static void RecvMessageReady(void* arg, grpc_error* error);
|
||||
static void RecvTrailingMetadataReady(void* arg, grpc_error* error);
|
||||
static void StartCancel(void* arg, grpc_error* error);
|
||||
static void OnCancelComplete(void* arg, grpc_error* error);
|
||||
static void OnComplete(void* arg, grpc_error_handle error);
|
||||
static void RecvInitialMetadataReady(void* arg, grpc_error_handle error);
|
||||
static void RecvMessageReady(void* arg, grpc_error_handle error);
|
||||
static void RecvTrailingMetadataReady(void* arg, grpc_error_handle error);
|
||||
static void StartCancel(void* arg, grpc_error_handle error);
|
||||
static void OnCancelComplete(void* arg, grpc_error_handle error);
|
||||
|
||||
static void OnByteStreamNext(void* arg, grpc_error* error);
|
||||
static void OnByteStreamNext(void* arg, grpc_error_handle error);
|
||||
void ContinueReadingRecvMessage();
|
||||
grpc_error* PullSliceFromRecvMessage();
|
||||
void DoneReadingRecvMessage(grpc_error* error);
|
||||
grpc_error_handle PullSliceFromRecvMessage();
|
||||
void DoneReadingRecvMessage(grpc_error_handle error);
|
||||
|
||||
static void AfterCallStackDestruction(void* arg, grpc_error* error);
|
||||
static void AfterCallStackDestruction(void* arg, grpc_error_handle error);
|
||||
|
||||
RefCountedPtr<HealthCheckClient> health_check_client_;
|
||||
grpc_polling_entity pollent_;
|
||||
|
|
@ -144,7 +144,7 @@ class HealthCheckClient : public InternallyRefCounted<HealthCheckClient> {
|
|||
void StartCallLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
||||
|
||||
void StartRetryTimerLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
||||
static void OnRetryTimer(void* arg, grpc_error* error);
|
||||
static void OnRetryTimer(void* arg, grpc_error_handle error);
|
||||
|
||||
void SetHealthStatus(grpc_connectivity_state state, const char* reason);
|
||||
void SetHealthStatusLocked(grpc_connectivity_state state, const char* reason)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace {
|
|||
class HttpConnectHandshaker : public Handshaker {
|
||||
public:
|
||||
HttpConnectHandshaker();
|
||||
void Shutdown(grpc_error* why) override;
|
||||
void Shutdown(grpc_error_handle why) override;
|
||||
void DoHandshake(grpc_tcp_server_acceptor* acceptor,
|
||||
grpc_closure* on_handshake_done,
|
||||
HandshakerArgs* args) override;
|
||||
|
|
@ -56,12 +56,12 @@ class HttpConnectHandshaker : public Handshaker {
|
|||
private:
|
||||
~HttpConnectHandshaker() override;
|
||||
void CleanupArgsForFailureLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
||||
void HandshakeFailedLocked(grpc_error* error)
|
||||
void HandshakeFailedLocked(grpc_error_handle error)
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
||||
static void OnWriteDone(void* arg, grpc_error* error);
|
||||
static void OnReadDone(void* arg, grpc_error* error);
|
||||
static void OnWriteDoneScheduler(void* arg, grpc_error* error);
|
||||
static void OnReadDoneScheduler(void* arg, grpc_error* error);
|
||||
static void OnWriteDone(void* arg, grpc_error_handle error);
|
||||
static void OnReadDone(void* arg, grpc_error_handle error);
|
||||
static void OnWriteDoneScheduler(void* arg, grpc_error_handle error);
|
||||
static void OnReadDoneScheduler(void* arg, grpc_error_handle error);
|
||||
|
||||
Mutex mu_;
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ void HttpConnectHandshaker::CleanupArgsForFailureLocked() {
|
|||
|
||||
// If the handshake failed or we're shutting down, clean up and invoke the
|
||||
// callback with the error.
|
||||
void HttpConnectHandshaker::HandshakeFailedLocked(grpc_error* error) {
|
||||
void HttpConnectHandshaker::HandshakeFailedLocked(grpc_error_handle error) {
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
// If we were shut down after an endpoint operation succeeded but
|
||||
// before the endpoint callback was invoked, we need to generate our
|
||||
|
|
@ -134,7 +134,8 @@ void HttpConnectHandshaker::HandshakeFailedLocked(grpc_error* error) {
|
|||
|
||||
// This callback can be invoked inline while already holding onto the mutex. To
|
||||
// avoid deadlocks, schedule OnWriteDone on ExecCtx.
|
||||
void HttpConnectHandshaker::OnWriteDoneScheduler(void* arg, grpc_error* error) {
|
||||
void HttpConnectHandshaker::OnWriteDoneScheduler(void* arg,
|
||||
grpc_error_handle error) {
|
||||
auto* handshaker = static_cast<HttpConnectHandshaker*>(arg);
|
||||
grpc_core::ExecCtx::Run(
|
||||
DEBUG_LOCATION,
|
||||
|
|
@ -145,7 +146,7 @@ void HttpConnectHandshaker::OnWriteDoneScheduler(void* arg, grpc_error* error) {
|
|||
}
|
||||
|
||||
// Callback invoked when finished writing HTTP CONNECT request.
|
||||
void HttpConnectHandshaker::OnWriteDone(void* arg, grpc_error* error) {
|
||||
void HttpConnectHandshaker::OnWriteDone(void* arg, grpc_error_handle error) {
|
||||
auto* handshaker = static_cast<HttpConnectHandshaker*>(arg);
|
||||
ReleasableMutexLock lock(&handshaker->mu_);
|
||||
if (error != GRPC_ERROR_NONE || handshaker->is_shutdown_) {
|
||||
|
|
@ -168,7 +169,8 @@ void HttpConnectHandshaker::OnWriteDone(void* arg, grpc_error* error) {
|
|||
|
||||
// This callback can be invoked inline while already holding onto the mutex. To
|
||||
// avoid deadlocks, schedule OnReadDone on ExecCtx.
|
||||
void HttpConnectHandshaker::OnReadDoneScheduler(void* arg, grpc_error* error) {
|
||||
void HttpConnectHandshaker::OnReadDoneScheduler(void* arg,
|
||||
grpc_error_handle error) {
|
||||
auto* handshaker = static_cast<HttpConnectHandshaker*>(arg);
|
||||
grpc_core::ExecCtx::Run(
|
||||
DEBUG_LOCATION,
|
||||
|
|
@ -179,7 +181,7 @@ void HttpConnectHandshaker::OnReadDoneScheduler(void* arg, grpc_error* error) {
|
|||
}
|
||||
|
||||
// Callback invoked for reading HTTP CONNECT response.
|
||||
void HttpConnectHandshaker::OnReadDone(void* arg, grpc_error* error) {
|
||||
void HttpConnectHandshaker::OnReadDone(void* arg, grpc_error_handle error) {
|
||||
auto* handshaker = static_cast<HttpConnectHandshaker*>(arg);
|
||||
ReleasableMutexLock lock(&handshaker->mu_);
|
||||
if (error != GRPC_ERROR_NONE || handshaker->is_shutdown_) {
|
||||
|
|
@ -265,7 +267,7 @@ done:
|
|||
// Public handshaker methods
|
||||
//
|
||||
|
||||
void HttpConnectHandshaker::Shutdown(grpc_error* why) {
|
||||
void HttpConnectHandshaker::Shutdown(grpc_error_handle why) {
|
||||
{
|
||||
MutexLock lock(&mu_);
|
||||
if (!is_shutdown_) {
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ LoadBalancingPolicy::PickResult LoadBalancingPolicy::QueuePicker::Pick(
|
|||
auto* parent = parent_->Ref().release(); // ref held by lambda.
|
||||
ExecCtx::Run(DEBUG_LOCATION,
|
||||
GRPC_CLOSURE_CREATE(
|
||||
[](void* arg, grpc_error* /*error*/) {
|
||||
[](void* arg, grpc_error_handle /*error*/) {
|
||||
auto* parent = static_cast<LoadBalancingPolicy*>(arg);
|
||||
parent->work_serializer()->Run(
|
||||
[parent]() {
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
|
|||
/// Error to be set when returning a failure.
|
||||
// TODO(roth): Replace this with something similar to grpc::Status,
|
||||
// so that we don't expose grpc_error to this API.
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
|
||||
/// Used only if type is PICK_COMPLETE.
|
||||
/// Callback set by LB policy to be notified of trailing metadata.
|
||||
|
|
@ -243,7 +243,7 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
|
|||
// TODO(roth): The arguments to this callback should be moved into a
|
||||
// struct, so that we can later add new fields without breaking
|
||||
// existing implementations.
|
||||
std::function<void(grpc_error*, MetadataInterface*, CallState*)>
|
||||
std::function<void(grpc_error_handle, MetadataInterface*, CallState*)>
|
||||
recv_trailing_metadata_ready;
|
||||
};
|
||||
|
||||
|
|
@ -387,13 +387,13 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
|
|||
// A picker that returns PICK_TRANSIENT_FAILURE for all picks.
|
||||
class TransientFailurePicker : public SubchannelPicker {
|
||||
public:
|
||||
explicit TransientFailurePicker(grpc_error* error) : error_(error) {}
|
||||
explicit TransientFailurePicker(grpc_error_handle error) : error_(error) {}
|
||||
~TransientFailurePicker() override { GRPC_ERROR_UNREF(error_); }
|
||||
|
||||
PickResult Pick(PickArgs args) override;
|
||||
|
||||
private:
|
||||
grpc_error* error_;
|
||||
grpc_error_handle error_;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
#include "src/core/lib/iomgr/error.h"
|
||||
#include "src/core/lib/profiling/timers.h"
|
||||
|
||||
static grpc_error* clr_init_channel_elem(grpc_channel_element* /*elem*/,
|
||||
grpc_channel_element_args* /*args*/) {
|
||||
static grpc_error_handle clr_init_channel_elem(
|
||||
grpc_channel_element* /*elem*/, grpc_channel_element_args* /*args*/) {
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ struct call_data {
|
|||
|
||||
} // namespace
|
||||
|
||||
static void on_complete_for_send(void* arg, grpc_error* error) {
|
||||
static void on_complete_for_send(void* arg, grpc_error_handle error) {
|
||||
call_data* calld = static_cast<call_data*>(arg);
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
calld->send_initial_metadata_succeeded = true;
|
||||
|
|
@ -63,7 +63,7 @@ static void on_complete_for_send(void* arg, grpc_error* error) {
|
|||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void recv_initial_metadata_ready(void* arg, grpc_error* error) {
|
||||
static void recv_initial_metadata_ready(void* arg, grpc_error_handle error) {
|
||||
call_data* calld = static_cast<call_data*>(arg);
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
calld->recv_initial_metadata_succeeded = true;
|
||||
|
|
@ -73,8 +73,8 @@ static void recv_initial_metadata_ready(void* arg, grpc_error* error) {
|
|||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static grpc_error* clr_init_call_elem(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
static grpc_error_handle clr_init_call_elem(
|
||||
grpc_call_element* elem, const grpc_call_element_args* args) {
|
||||
GPR_ASSERT(args->context != nullptr);
|
||||
new (elem->call_data) call_data();
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
|
|||
|
|
@ -186,17 +186,17 @@ class GrpcLb : public LoadBalancingPolicy {
|
|||
void ScheduleNextClientLoadReportLocked();
|
||||
void SendClientLoadReportLocked();
|
||||
|
||||
static void MaybeSendClientLoadReport(void* arg, grpc_error* error);
|
||||
static void ClientLoadReportDone(void* arg, grpc_error* error);
|
||||
static void OnInitialRequestSent(void* arg, grpc_error* error);
|
||||
static void OnBalancerMessageReceived(void* arg, grpc_error* error);
|
||||
static void OnBalancerStatusReceived(void* arg, grpc_error* error);
|
||||
static void MaybeSendClientLoadReport(void* arg, grpc_error_handle error);
|
||||
static void ClientLoadReportDone(void* arg, grpc_error_handle error);
|
||||
static void OnInitialRequestSent(void* arg, grpc_error_handle error);
|
||||
static void OnBalancerMessageReceived(void* arg, grpc_error_handle error);
|
||||
static void OnBalancerStatusReceived(void* arg, grpc_error_handle error);
|
||||
|
||||
void MaybeSendClientLoadReportLocked(grpc_error* error);
|
||||
void ClientLoadReportDoneLocked(grpc_error* error);
|
||||
void MaybeSendClientLoadReportLocked(grpc_error_handle error);
|
||||
void ClientLoadReportDoneLocked(grpc_error_handle error);
|
||||
void OnInitialRequestSentLocked();
|
||||
void OnBalancerMessageReceivedLocked();
|
||||
void OnBalancerStatusReceivedLocked(grpc_error* error);
|
||||
void OnBalancerStatusReceivedLocked(grpc_error_handle error);
|
||||
|
||||
// The owning LB policy.
|
||||
RefCountedPtr<LoadBalancingPolicy> grpclb_policy_;
|
||||
|
|
@ -410,14 +410,14 @@ class GrpcLb : public LoadBalancingPolicy {
|
|||
|
||||
// Methods for dealing with fallback state.
|
||||
void MaybeEnterFallbackModeAfterStartup();
|
||||
static void OnFallbackTimer(void* arg, grpc_error* error);
|
||||
void OnFallbackTimerLocked(grpc_error* error);
|
||||
static void OnFallbackTimer(void* arg, grpc_error_handle error);
|
||||
void OnFallbackTimerLocked(grpc_error_handle error);
|
||||
|
||||
// Methods for dealing with the balancer call.
|
||||
void StartBalancerCallLocked();
|
||||
void StartBalancerCallRetryTimerLocked();
|
||||
static void OnBalancerCallRetryTimer(void* arg, grpc_error* error);
|
||||
void OnBalancerCallRetryTimerLocked(grpc_error* error);
|
||||
static void OnBalancerCallRetryTimer(void* arg, grpc_error_handle error);
|
||||
void OnBalancerCallRetryTimerLocked(grpc_error_handle error);
|
||||
|
||||
// Methods for dealing with the child policy.
|
||||
grpc_channel_args* CreateChildPolicyArgsLocked(
|
||||
|
|
@ -902,8 +902,8 @@ void GrpcLb::BalancerCallState::ScheduleNextClientLoadReportLocked() {
|
|||
client_load_report_timer_callback_pending_ = true;
|
||||
}
|
||||
|
||||
void GrpcLb::BalancerCallState::MaybeSendClientLoadReport(void* arg,
|
||||
grpc_error* error) {
|
||||
void GrpcLb::BalancerCallState::MaybeSendClientLoadReport(
|
||||
void* arg, grpc_error_handle error) {
|
||||
BalancerCallState* lb_calld = static_cast<BalancerCallState*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
lb_calld->grpclb_policy()->work_serializer()->Run(
|
||||
|
|
@ -912,7 +912,7 @@ void GrpcLb::BalancerCallState::MaybeSendClientLoadReport(void* arg,
|
|||
}
|
||||
|
||||
void GrpcLb::BalancerCallState::MaybeSendClientLoadReportLocked(
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
client_load_report_timer_callback_pending_ = false;
|
||||
if (error != GRPC_ERROR_NONE || this != grpclb_policy()->lb_calld_.get()) {
|
||||
Unref(DEBUG_LOCATION, "client_load_report");
|
||||
|
|
@ -982,7 +982,7 @@ void GrpcLb::BalancerCallState::SendClientLoadReportLocked() {
|
|||
}
|
||||
|
||||
void GrpcLb::BalancerCallState::ClientLoadReportDone(void* arg,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
BalancerCallState* lb_calld = static_cast<BalancerCallState*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
lb_calld->grpclb_policy()->work_serializer()->Run(
|
||||
|
|
@ -990,7 +990,8 @@ void GrpcLb::BalancerCallState::ClientLoadReportDone(void* arg,
|
|||
DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
void GrpcLb::BalancerCallState::ClientLoadReportDoneLocked(grpc_error* error) {
|
||||
void GrpcLb::BalancerCallState::ClientLoadReportDoneLocked(
|
||||
grpc_error_handle error) {
|
||||
grpc_byte_buffer_destroy(send_message_payload_);
|
||||
send_message_payload_ = nullptr;
|
||||
if (error != GRPC_ERROR_NONE || this != grpclb_policy()->lb_calld_.get()) {
|
||||
|
|
@ -1001,8 +1002,8 @@ void GrpcLb::BalancerCallState::ClientLoadReportDoneLocked(grpc_error* error) {
|
|||
ScheduleNextClientLoadReportLocked();
|
||||
}
|
||||
|
||||
void GrpcLb::BalancerCallState::OnInitialRequestSent(void* arg,
|
||||
grpc_error* /*error*/) {
|
||||
void GrpcLb::BalancerCallState::OnInitialRequestSent(
|
||||
void* arg, grpc_error_handle /*error*/) {
|
||||
BalancerCallState* lb_calld = static_cast<BalancerCallState*>(arg);
|
||||
lb_calld->grpclb_policy()->work_serializer()->Run(
|
||||
[lb_calld]() { lb_calld->OnInitialRequestSentLocked(); }, DEBUG_LOCATION);
|
||||
|
|
@ -1021,7 +1022,7 @@ void GrpcLb::BalancerCallState::OnInitialRequestSentLocked() {
|
|||
}
|
||||
|
||||
void GrpcLb::BalancerCallState::OnBalancerMessageReceived(
|
||||
void* arg, grpc_error* /*error*/) {
|
||||
void* arg, grpc_error_handle /*error*/) {
|
||||
BalancerCallState* lb_calld = static_cast<BalancerCallState*>(arg);
|
||||
lb_calld->grpclb_policy()->work_serializer()->Run(
|
||||
[lb_calld]() { lb_calld->OnBalancerMessageReceivedLocked(); },
|
||||
|
|
@ -1183,8 +1184,8 @@ void GrpcLb::BalancerCallState::OnBalancerMessageReceivedLocked() {
|
|||
}
|
||||
}
|
||||
|
||||
void GrpcLb::BalancerCallState::OnBalancerStatusReceived(void* arg,
|
||||
grpc_error* error) {
|
||||
void GrpcLb::BalancerCallState::OnBalancerStatusReceived(
|
||||
void* arg, grpc_error_handle error) {
|
||||
BalancerCallState* lb_calld = static_cast<BalancerCallState*>(arg);
|
||||
GRPC_ERROR_REF(error); // owned by lambda
|
||||
lb_calld->grpclb_policy()->work_serializer()->Run(
|
||||
|
|
@ -1193,7 +1194,7 @@ void GrpcLb::BalancerCallState::OnBalancerStatusReceived(void* arg,
|
|||
}
|
||||
|
||||
void GrpcLb::BalancerCallState::OnBalancerStatusReceivedLocked(
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
GPR_ASSERT(lb_call_ != nullptr);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_glb_trace)) {
|
||||
char* status_details = grpc_slice_to_c_string(lb_call_status_details_);
|
||||
|
|
@ -1534,7 +1535,7 @@ void GrpcLb::StartBalancerCallRetryTimerLocked() {
|
|||
grpc_timer_init(&lb_call_retry_timer_, next_try, &lb_on_call_retry_);
|
||||
}
|
||||
|
||||
void GrpcLb::OnBalancerCallRetryTimer(void* arg, grpc_error* error) {
|
||||
void GrpcLb::OnBalancerCallRetryTimer(void* arg, grpc_error_handle error) {
|
||||
GrpcLb* grpclb_policy = static_cast<GrpcLb*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
grpclb_policy->work_serializer()->Run(
|
||||
|
|
@ -1544,7 +1545,7 @@ void GrpcLb::OnBalancerCallRetryTimer(void* arg, grpc_error* error) {
|
|||
DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
void GrpcLb::OnBalancerCallRetryTimerLocked(grpc_error* error) {
|
||||
void GrpcLb::OnBalancerCallRetryTimerLocked(grpc_error_handle error) {
|
||||
retry_timer_callback_pending_ = false;
|
||||
if (!shutting_down_ && error == GRPC_ERROR_NONE && lb_calld_ == nullptr) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_glb_trace)) {
|
||||
|
|
@ -1578,7 +1579,7 @@ void GrpcLb::MaybeEnterFallbackModeAfterStartup() {
|
|||
}
|
||||
}
|
||||
|
||||
void GrpcLb::OnFallbackTimer(void* arg, grpc_error* error) {
|
||||
void GrpcLb::OnFallbackTimer(void* arg, grpc_error_handle error) {
|
||||
GrpcLb* grpclb_policy = static_cast<GrpcLb*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
grpclb_policy->work_serializer()->Run(
|
||||
|
|
@ -1586,7 +1587,7 @@ void GrpcLb::OnFallbackTimer(void* arg, grpc_error* error) {
|
|||
DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
void GrpcLb::OnFallbackTimerLocked(grpc_error* error) {
|
||||
void GrpcLb::OnFallbackTimerLocked(grpc_error_handle error) {
|
||||
// If we receive a serverlist after the timer fires but before this callback
|
||||
// actually runs, don't fall back.
|
||||
if (fallback_at_startup_checks_pending_ && !shutting_down_ &&
|
||||
|
|
@ -1690,12 +1691,12 @@ class GrpcLbFactory : public LoadBalancingPolicyFactory {
|
|||
const char* name() const override { return kGrpclb; }
|
||||
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
|
||||
const Json& json, grpc_error** error) const override {
|
||||
const Json& json, grpc_error_handle* error) const override {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
if (json.type() == Json::Type::JSON_NULL) {
|
||||
return MakeRefCounted<GrpcLbConfig>(nullptr, "");
|
||||
}
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
Json child_policy_config_json_tmp;
|
||||
const Json* child_policy_config_json;
|
||||
std::string service_name;
|
||||
|
|
@ -1718,12 +1719,12 @@ class GrpcLbFactory : public LoadBalancingPolicyFactory {
|
|||
} else {
|
||||
child_policy_config_json = &it->second;
|
||||
}
|
||||
grpc_error* parse_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle parse_error = GRPC_ERROR_NONE;
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> child_policy_config =
|
||||
LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(
|
||||
*child_policy_config_json, &parse_error);
|
||||
if (parse_error != GRPC_ERROR_NONE) {
|
||||
std::vector<grpc_error*> child_errors;
|
||||
std::vector<grpc_error_handle> child_errors;
|
||||
child_errors.push_back(parse_error);
|
||||
error_list.push_back(
|
||||
GRPC_ERROR_CREATE_FROM_VECTOR("field:childPolicy", &child_errors));
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ void PickFirst::AttemptToConnectUsingLatestUpdateArgsLocked() {
|
|||
// (If we are idle, then this will happen in ExitIdleLocked() if we
|
||||
// haven't gotten a non-empty update by the time the application tries
|
||||
// to start a new call.)
|
||||
grpc_error* error =
|
||||
grpc_error_handle error =
|
||||
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty update"),
|
||||
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
|
||||
channel_control_helper()->UpdateState(
|
||||
|
|
@ -314,7 +314,7 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
|
|||
p->subchannel_list_ = std::move(p->latest_pending_subchannel_list_);
|
||||
// Set our state to that of the pending subchannel list.
|
||||
if (p->subchannel_list_->in_transient_failure()) {
|
||||
grpc_error* error = grpc_error_set_int(
|
||||
grpc_error_handle error = grpc_error_set_int(
|
||||
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"selected subchannel failed; switching to pending update"),
|
||||
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
|
||||
|
|
@ -393,7 +393,7 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
|
|||
subchannel_list()->set_in_transient_failure(true);
|
||||
// Only report new state in case 1.
|
||||
if (subchannel_list() == p->subchannel_list_.get()) {
|
||||
grpc_error* error = grpc_error_set_int(
|
||||
grpc_error_handle error = grpc_error_set_int(
|
||||
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"failed to connect to all addresses"),
|
||||
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
|
||||
|
|
@ -497,7 +497,7 @@ class PickFirstFactory : public LoadBalancingPolicyFactory {
|
|||
const char* name() const override { return kPickFirst; }
|
||||
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
|
||||
const Json& /*json*/, grpc_error** /*error*/) const override {
|
||||
const Json& /*json*/, grpc_error_handle* /*error*/) const override {
|
||||
return MakeRefCounted<PickFirstConfig>();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -179,10 +179,10 @@ class PriorityLb : public LoadBalancingPolicy {
|
|||
|
||||
void StartFailoverTimerLocked();
|
||||
|
||||
static void OnFailoverTimer(void* arg, grpc_error* error);
|
||||
void OnFailoverTimerLocked(grpc_error* error);
|
||||
static void OnDeactivationTimer(void* arg, grpc_error* error);
|
||||
void OnDeactivationTimerLocked(grpc_error* error);
|
||||
static void OnFailoverTimer(void* arg, grpc_error_handle error);
|
||||
void OnFailoverTimerLocked(grpc_error_handle error);
|
||||
static void OnDeactivationTimer(void* arg, grpc_error_handle error);
|
||||
void OnDeactivationTimerLocked(grpc_error_handle error);
|
||||
|
||||
RefCountedPtr<PriorityLb> priority_policy_;
|
||||
const std::string name_;
|
||||
|
|
@ -472,7 +472,7 @@ void PriorityLb::TryNextPriorityLocked(bool report_connecting) {
|
|||
this);
|
||||
}
|
||||
current_child_from_before_update_ = nullptr;
|
||||
grpc_error* error = grpc_error_set_int(
|
||||
grpc_error_handle error = grpc_error_set_int(
|
||||
GRPC_ERROR_CREATE_FROM_STATIC_STRING("no ready priority"),
|
||||
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
|
||||
channel_control_helper()->UpdateState(
|
||||
|
|
@ -655,14 +655,15 @@ void PriorityLb::ChildPriority::MaybeCancelFailoverTimerLocked() {
|
|||
}
|
||||
}
|
||||
|
||||
void PriorityLb::ChildPriority::OnFailoverTimer(void* arg, grpc_error* error) {
|
||||
void PriorityLb::ChildPriority::OnFailoverTimer(void* arg,
|
||||
grpc_error_handle error) {
|
||||
ChildPriority* self = static_cast<ChildPriority*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
self->priority_policy_->work_serializer()->Run(
|
||||
[self, error]() { self->OnFailoverTimerLocked(error); }, DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
void PriorityLb::ChildPriority::OnFailoverTimerLocked(grpc_error* error) {
|
||||
void PriorityLb::ChildPriority::OnFailoverTimerLocked(grpc_error_handle error) {
|
||||
if (error == GRPC_ERROR_NONE && failover_timer_callback_pending_ &&
|
||||
!priority_policy_->shutting_down_) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_priority_trace)) {
|
||||
|
|
@ -712,7 +713,7 @@ void PriorityLb::ChildPriority::MaybeReactivateLocked() {
|
|||
}
|
||||
|
||||
void PriorityLb::ChildPriority::OnDeactivationTimer(void* arg,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
ChildPriority* self = static_cast<ChildPriority*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
self->priority_policy_->work_serializer()->Run(
|
||||
|
|
@ -720,7 +721,8 @@ void PriorityLb::ChildPriority::OnDeactivationTimer(void* arg,
|
|||
DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
void PriorityLb::ChildPriority::OnDeactivationTimerLocked(grpc_error* error) {
|
||||
void PriorityLb::ChildPriority::OnDeactivationTimerLocked(
|
||||
grpc_error_handle error) {
|
||||
if (error == GRPC_ERROR_NONE && deactivation_timer_callback_pending_ &&
|
||||
!priority_policy_->shutting_down_) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_priority_trace)) {
|
||||
|
|
@ -785,7 +787,7 @@ class PriorityLbFactory : public LoadBalancingPolicyFactory {
|
|||
const char* name() const override { return kPriority; }
|
||||
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
|
||||
const Json& json, grpc_error** error) const override {
|
||||
const Json& json, grpc_error_handle* error) const override {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
if (json.type() == Json::Type::JSON_NULL) {
|
||||
// priority was mentioned as a policy in the deprecated
|
||||
|
|
@ -796,7 +798,7 @@ class PriorityLbFactory : public LoadBalancingPolicyFactory {
|
|||
"config instead.");
|
||||
return nullptr;
|
||||
}
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
// Children.
|
||||
std::map<std::string, PriorityLbConfig::PriorityLbChild> children;
|
||||
auto it = json.object_value().find("children");
|
||||
|
|
@ -824,7 +826,7 @@ class PriorityLbFactory : public LoadBalancingPolicyFactory {
|
|||
" error:missing 'config' field")
|
||||
.c_str()));
|
||||
} else {
|
||||
grpc_error* parse_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle parse_error = GRPC_ERROR_NONE;
|
||||
auto config = LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(
|
||||
it2->second, &parse_error);
|
||||
bool ignore_resolution_requests = false;
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ void RoundRobin::RoundRobinSubchannelList::
|
|||
absl::make_unique<QueuePicker>(p->Ref(DEBUG_LOCATION, "QueuePicker")));
|
||||
} else if (num_transient_failure_ == num_subchannels()) {
|
||||
/* 3) TRANSIENT_FAILURE */
|
||||
grpc_error* error =
|
||||
grpc_error_handle error =
|
||||
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"connections to all backends failing"),
|
||||
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
|
||||
|
|
@ -449,7 +449,7 @@ void RoundRobin::UpdateLocked(UpdateArgs args) {
|
|||
if (latest_pending_subchannel_list_->num_subchannels() == 0) {
|
||||
// If the new list is empty, immediately promote the new list to the
|
||||
// current list and transition to TRANSIENT_FAILURE.
|
||||
grpc_error* error =
|
||||
grpc_error_handle error =
|
||||
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty update"),
|
||||
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
|
||||
channel_control_helper()->UpdateState(
|
||||
|
|
@ -487,7 +487,7 @@ class RoundRobinFactory : public LoadBalancingPolicyFactory {
|
|||
const char* name() const override { return kRoundRobin; }
|
||||
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
|
||||
const Json& /*json*/, grpc_error** /*error*/) const override {
|
||||
const Json& /*json*/, grpc_error_handle* /*error*/) const override {
|
||||
return MakeRefCounted<RoundRobinConfig>();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -165,8 +165,8 @@ class WeightedTargetLb : public LoadBalancingPolicy {
|
|||
grpc_connectivity_state state, const absl::Status& status,
|
||||
std::unique_ptr<SubchannelPicker> picker);
|
||||
|
||||
static void OnDelayedRemovalTimer(void* arg, grpc_error* error);
|
||||
void OnDelayedRemovalTimerLocked(grpc_error* error);
|
||||
static void OnDelayedRemovalTimer(void* arg, grpc_error_handle error);
|
||||
void OnDelayedRemovalTimerLocked(grpc_error_handle error);
|
||||
|
||||
// The owning LB policy.
|
||||
RefCountedPtr<WeightedTargetLb> weighted_target_policy_;
|
||||
|
|
@ -387,7 +387,7 @@ void WeightedTargetLb::UpdateStateLocked() {
|
|||
absl::make_unique<QueuePicker>(Ref(DEBUG_LOCATION, "QueuePicker"));
|
||||
break;
|
||||
default:
|
||||
grpc_error* error = grpc_error_set_int(
|
||||
grpc_error_handle error = grpc_error_set_int(
|
||||
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"weighted_target: all children report state TRANSIENT_FAILURE"),
|
||||
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
|
||||
|
|
@ -564,8 +564,8 @@ void WeightedTargetLb::WeightedChild::DeactivateLocked() {
|
|||
&on_delayed_removal_timer_);
|
||||
}
|
||||
|
||||
void WeightedTargetLb::WeightedChild::OnDelayedRemovalTimer(void* arg,
|
||||
grpc_error* error) {
|
||||
void WeightedTargetLb::WeightedChild::OnDelayedRemovalTimer(
|
||||
void* arg, grpc_error_handle error) {
|
||||
WeightedChild* self = static_cast<WeightedChild*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
self->weighted_target_policy_->work_serializer()->Run(
|
||||
|
|
@ -574,7 +574,7 @@ void WeightedTargetLb::WeightedChild::OnDelayedRemovalTimer(void* arg,
|
|||
}
|
||||
|
||||
void WeightedTargetLb::WeightedChild::OnDelayedRemovalTimerLocked(
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
if (error == GRPC_ERROR_NONE && delayed_removal_timer_callback_pending_ &&
|
||||
!shutdown_ && weight_ == 0) {
|
||||
delayed_removal_timer_callback_pending_ = false;
|
||||
|
|
@ -631,7 +631,7 @@ class WeightedTargetLbFactory : public LoadBalancingPolicyFactory {
|
|||
const char* name() const override { return kWeightedTarget; }
|
||||
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
|
||||
const Json& json, grpc_error** error) const override {
|
||||
const Json& json, grpc_error_handle* error) const override {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
if (json.type() == Json::Type::JSON_NULL) {
|
||||
// weighted_target was mentioned as a policy in the deprecated
|
||||
|
|
@ -642,7 +642,7 @@ class WeightedTargetLbFactory : public LoadBalancingPolicyFactory {
|
|||
"config instead.");
|
||||
return nullptr;
|
||||
}
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
// Weight map.
|
||||
WeightedTargetLbConfig::TargetMap target_map;
|
||||
auto it = json.object_value().find("targets");
|
||||
|
|
@ -655,14 +655,14 @@ class WeightedTargetLbFactory : public LoadBalancingPolicyFactory {
|
|||
} else {
|
||||
for (const auto& p : it->second.object_value()) {
|
||||
WeightedTargetLbConfig::ChildConfig child_config;
|
||||
std::vector<grpc_error*> child_errors =
|
||||
std::vector<grpc_error_handle> child_errors =
|
||||
ParseChildConfig(p.second, &child_config);
|
||||
if (!child_errors.empty()) {
|
||||
// Can't use GRPC_ERROR_CREATE_FROM_VECTOR() here, because the error
|
||||
// string is not static in this case.
|
||||
grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
grpc_error_handle error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrCat("field:targets key:", p.first).c_str());
|
||||
for (grpc_error* child_error : child_errors) {
|
||||
for (grpc_error_handle child_error : child_errors) {
|
||||
error = grpc_error_add_child(error, child_error);
|
||||
}
|
||||
error_list.push_back(error);
|
||||
|
|
@ -680,9 +680,9 @@ class WeightedTargetLbFactory : public LoadBalancingPolicyFactory {
|
|||
}
|
||||
|
||||
private:
|
||||
static std::vector<grpc_error*> ParseChildConfig(
|
||||
static std::vector<grpc_error_handle> ParseChildConfig(
|
||||
const Json& json, WeightedTargetLbConfig::ChildConfig* child_config) {
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
if (json.type() != Json::Type::OBJECT) {
|
||||
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"value should be of type object"));
|
||||
|
|
@ -711,13 +711,13 @@ class WeightedTargetLbFactory : public LoadBalancingPolicyFactory {
|
|||
// Child policy.
|
||||
it = json.object_value().find("childPolicy");
|
||||
if (it != json.object_value().end()) {
|
||||
grpc_error* parse_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle parse_error = GRPC_ERROR_NONE;
|
||||
child_config->config =
|
||||
LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(it->second,
|
||||
&parse_error);
|
||||
if (child_config->config == nullptr) {
|
||||
GPR_DEBUG_ASSERT(parse_error != GRPC_ERROR_NONE);
|
||||
std::vector<grpc_error*> child_errors;
|
||||
std::vector<grpc_error_handle> child_errors;
|
||||
child_errors.push_back(parse_error);
|
||||
error_list.push_back(
|
||||
GRPC_ERROR_CREATE_FROM_VECTOR("field:childPolicy", &child_errors));
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class CdsLb : public LoadBalancingPolicy {
|
|||
void OnClusterChanged(XdsApi::CdsUpdate cluster_data) override {
|
||||
new Notifier(parent_, name_, std::move(cluster_data));
|
||||
}
|
||||
void OnError(grpc_error* error) override {
|
||||
void OnError(grpc_error_handle error) override {
|
||||
new Notifier(parent_, name_, error);
|
||||
}
|
||||
void OnResourceDoesNotExist() override { new Notifier(parent_, name_); }
|
||||
|
|
@ -86,14 +86,14 @@ class CdsLb : public LoadBalancingPolicy {
|
|||
Notifier(RefCountedPtr<CdsLb> parent, std::string name,
|
||||
XdsApi::CdsUpdate update);
|
||||
Notifier(RefCountedPtr<CdsLb> parent, std::string name,
|
||||
grpc_error* error);
|
||||
grpc_error_handle error);
|
||||
explicit Notifier(RefCountedPtr<CdsLb> parent, std::string name);
|
||||
|
||||
private:
|
||||
enum Type { kUpdate, kError, kDoesNotExist };
|
||||
|
||||
static void RunInExecCtx(void* arg, grpc_error* error);
|
||||
void RunInWorkSerializer(grpc_error* error);
|
||||
static void RunInExecCtx(void* arg, grpc_error_handle error);
|
||||
void RunInWorkSerializer(grpc_error_handle error);
|
||||
|
||||
RefCountedPtr<CdsLb> parent_;
|
||||
std::string name_;
|
||||
|
|
@ -139,10 +139,10 @@ class CdsLb : public LoadBalancingPolicy {
|
|||
std::set<std::string>* clusters_needed);
|
||||
void OnClusterChanged(const std::string& name,
|
||||
XdsApi::CdsUpdate cluster_data);
|
||||
void OnError(const std::string& name, grpc_error* error);
|
||||
void OnError(const std::string& name, grpc_error_handle error);
|
||||
void OnResourceDoesNotExist(const std::string& name);
|
||||
|
||||
grpc_error* UpdateXdsCertificateProvider(
|
||||
grpc_error_handle UpdateXdsCertificateProvider(
|
||||
const std::string& cluster_name, const XdsApi::CdsUpdate& cluster_data);
|
||||
|
||||
void CancelClusterDataWatch(absl::string_view cluster_name,
|
||||
|
|
@ -190,7 +190,8 @@ CdsLb::ClusterWatcher::Notifier::Notifier(RefCountedPtr<CdsLb> parent,
|
|||
}
|
||||
|
||||
CdsLb::ClusterWatcher::Notifier::Notifier(RefCountedPtr<CdsLb> parent,
|
||||
std::string name, grpc_error* error)
|
||||
std::string name,
|
||||
grpc_error_handle error)
|
||||
: parent_(std::move(parent)), name_(std::move(name)), type_(kError) {
|
||||
GRPC_CLOSURE_INIT(&closure_, &RunInExecCtx, this, nullptr);
|
||||
ExecCtx::Run(DEBUG_LOCATION, &closure_, error);
|
||||
|
|
@ -204,14 +205,15 @@ CdsLb::ClusterWatcher::Notifier::Notifier(RefCountedPtr<CdsLb> parent,
|
|||
}
|
||||
|
||||
void CdsLb::ClusterWatcher::Notifier::RunInExecCtx(void* arg,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
Notifier* self = static_cast<Notifier*>(arg);
|
||||
GRPC_ERROR_REF(error);
|
||||
self->parent_->work_serializer()->Run(
|
||||
[self, error]() { self->RunInWorkSerializer(error); }, DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
void CdsLb::ClusterWatcher::Notifier::RunInWorkSerializer(grpc_error* error) {
|
||||
void CdsLb::ClusterWatcher::Notifier::RunInWorkSerializer(
|
||||
grpc_error_handle error) {
|
||||
switch (type_) {
|
||||
case kUpdate:
|
||||
parent_->OnClusterChanged(name_, std::move(update_));
|
||||
|
|
@ -434,7 +436,7 @@ void CdsLb::OnClusterChanged(const std::string& name,
|
|||
if (it == watchers_.end()) return;
|
||||
it->second.update = cluster_data;
|
||||
// Take care of integration with new certificate code.
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
error = UpdateXdsCertificateProvider(name, it->second.update.value());
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
return OnError(name, error);
|
||||
|
|
@ -541,7 +543,7 @@ void CdsLb::OnClusterChanged(const std::string& name,
|
|||
}
|
||||
}
|
||||
|
||||
void CdsLb::OnError(const std::string& name, grpc_error* error) {
|
||||
void CdsLb::OnError(const std::string& name, grpc_error_handle error) {
|
||||
gpr_log(GPR_ERROR, "[cdslb %p] xds error obtaining data for cluster %s: %s",
|
||||
this, name.c_str(), grpc_error_string(error));
|
||||
// Go into TRANSIENT_FAILURE if we have not yet created the child
|
||||
|
|
@ -561,7 +563,7 @@ void CdsLb::OnResourceDoesNotExist(const std::string& name) {
|
|||
"[cdslb %p] CDS resource for %s does not exist -- reporting "
|
||||
"TRANSIENT_FAILURE",
|
||||
this, name.c_str());
|
||||
grpc_error* error =
|
||||
grpc_error_handle error =
|
||||
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrCat("CDS resource \"", config_->cluster(),
|
||||
"\" does not exist")
|
||||
|
|
@ -573,7 +575,7 @@ void CdsLb::OnResourceDoesNotExist(const std::string& name) {
|
|||
MaybeDestroyChildPolicyLocked();
|
||||
}
|
||||
|
||||
grpc_error* CdsLb::UpdateXdsCertificateProvider(
|
||||
grpc_error_handle CdsLb::UpdateXdsCertificateProvider(
|
||||
const std::string& cluster_name, const XdsApi::CdsUpdate& cluster_data) {
|
||||
// Early out if channel is not configured to use xds security.
|
||||
grpc_channel_credentials* channel_credentials =
|
||||
|
|
@ -707,7 +709,7 @@ class CdsLbFactory : public LoadBalancingPolicyFactory {
|
|||
const char* name() const override { return kCds; }
|
||||
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
|
||||
const Json& json, grpc_error** error) const override {
|
||||
const Json& json, grpc_error_handle* error) const override {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
if (json.type() == Json::Type::JSON_NULL) {
|
||||
// xds was mentioned as a policy in the deprecated loadBalancingPolicy
|
||||
|
|
@ -717,7 +719,7 @@ class CdsLbFactory : public LoadBalancingPolicyFactory {
|
|||
"Please use loadBalancingConfig field of service config instead.");
|
||||
return nullptr;
|
||||
}
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
// cluster name.
|
||||
std::string cluster;
|
||||
auto it = json.object_value().find("cluster");
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ LoadBalancingPolicy::PickResult XdsClusterImplLb::Picker::Pick(
|
|||
// Note: This callback does not run in either the control plane
|
||||
// work serializer or in the data plane mutex.
|
||||
[locality_stats, original_recv_trailing_metadata_ready, call_counter](
|
||||
grpc_error* error, MetadataInterface* metadata,
|
||||
grpc_error_handle error, MetadataInterface* metadata,
|
||||
CallState* call_state) {
|
||||
// Record call completion for load reporting.
|
||||
if (locality_stats != nullptr) {
|
||||
|
|
@ -611,7 +611,7 @@ class XdsClusterImplLbFactory : public LoadBalancingPolicyFactory {
|
|||
const char* name() const override { return kXdsClusterImpl; }
|
||||
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
|
||||
const Json& json, grpc_error** error) const override {
|
||||
const Json& json, grpc_error_handle* error) const override {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
if (json.type() == Json::Type::JSON_NULL) {
|
||||
// This policy was configured in the deprecated loadBalancingPolicy
|
||||
|
|
@ -622,7 +622,7 @@ class XdsClusterImplLbFactory : public LoadBalancingPolicyFactory {
|
|||
"config instead.");
|
||||
return nullptr;
|
||||
}
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
// Child policy.
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> child_policy;
|
||||
auto it = json.object_value().find("childPolicy");
|
||||
|
|
@ -630,12 +630,12 @@ class XdsClusterImplLbFactory : public LoadBalancingPolicyFactory {
|
|||
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"field:childPolicy error:required field missing"));
|
||||
} else {
|
||||
grpc_error* parse_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle parse_error = GRPC_ERROR_NONE;
|
||||
child_policy = LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(
|
||||
it->second, &parse_error);
|
||||
if (child_policy == nullptr) {
|
||||
GPR_DEBUG_ASSERT(parse_error != GRPC_ERROR_NONE);
|
||||
std::vector<grpc_error*> child_errors;
|
||||
std::vector<grpc_error_handle> child_errors;
|
||||
child_errors.push_back(parse_error);
|
||||
error_list.push_back(
|
||||
GRPC_ERROR_CREATE_FROM_VECTOR("field:childPolicy", &child_errors));
|
||||
|
|
@ -694,7 +694,7 @@ class XdsClusterImplLbFactory : public LoadBalancingPolicyFactory {
|
|||
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"field:dropCategories error:required field missing"));
|
||||
} else {
|
||||
std::vector<grpc_error*> child_errors =
|
||||
std::vector<grpc_error_handle> child_errors =
|
||||
ParseDropCategories(it->second, drop_config.get());
|
||||
if (!child_errors.empty()) {
|
||||
error_list.push_back(GRPC_ERROR_CREATE_FROM_VECTOR(
|
||||
|
|
@ -713,9 +713,9 @@ class XdsClusterImplLbFactory : public LoadBalancingPolicyFactory {
|
|||
}
|
||||
|
||||
private:
|
||||
static std::vector<grpc_error*> ParseDropCategories(
|
||||
static std::vector<grpc_error_handle> ParseDropCategories(
|
||||
const Json& json, XdsApi::EdsUpdate::DropConfig* drop_config) {
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
if (json.type() != Json::Type::ARRAY) {
|
||||
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"dropCategories field is not an array"));
|
||||
|
|
@ -723,10 +723,10 @@ class XdsClusterImplLbFactory : public LoadBalancingPolicyFactory {
|
|||
}
|
||||
for (size_t i = 0; i < json.array_value().size(); ++i) {
|
||||
const Json& entry = json.array_value()[i];
|
||||
std::vector<grpc_error*> child_errors =
|
||||
std::vector<grpc_error_handle> child_errors =
|
||||
ParseDropCategory(entry, drop_config);
|
||||
if (!child_errors.empty()) {
|
||||
grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
grpc_error_handle error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrCat("errors parsing index ", i).c_str());
|
||||
for (size_t i = 0; i < child_errors.size(); ++i) {
|
||||
error = grpc_error_add_child(error, child_errors[i]);
|
||||
|
|
@ -737,9 +737,9 @@ class XdsClusterImplLbFactory : public LoadBalancingPolicyFactory {
|
|||
return error_list;
|
||||
}
|
||||
|
||||
static std::vector<grpc_error*> ParseDropCategory(
|
||||
static std::vector<grpc_error_handle> ParseDropCategory(
|
||||
const Json& json, XdsApi::EdsUpdate::DropConfig* drop_config) {
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
if (json.type() != Json::Type::OBJECT) {
|
||||
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"dropCategories entry is not an object"));
|
||||
|
|
|
|||
|
|
@ -162,8 +162,8 @@ class XdsClusterManagerLb : public LoadBalancingPolicy {
|
|||
OrphanablePtr<LoadBalancingPolicy> CreateChildPolicyLocked(
|
||||
const grpc_channel_args* args);
|
||||
|
||||
static void OnDelayedRemovalTimer(void* arg, grpc_error* error);
|
||||
void OnDelayedRemovalTimerLocked(grpc_error* error);
|
||||
static void OnDelayedRemovalTimer(void* arg, grpc_error_handle error);
|
||||
void OnDelayedRemovalTimerLocked(grpc_error_handle error);
|
||||
|
||||
// The owning LB policy.
|
||||
RefCountedPtr<XdsClusterManagerLb> xds_cluster_manager_policy_;
|
||||
|
|
@ -369,7 +369,7 @@ void XdsClusterManagerLb::UpdateStateLocked() {
|
|||
absl::make_unique<QueuePicker>(Ref(DEBUG_LOCATION, "QueuePicker"));
|
||||
break;
|
||||
default:
|
||||
grpc_error* error = grpc_error_set_int(
|
||||
grpc_error_handle error = grpc_error_set_int(
|
||||
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"TRANSIENT_FAILURE from XdsClusterManagerLb"),
|
||||
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
|
||||
|
|
@ -513,7 +513,7 @@ void XdsClusterManagerLb::ClusterChild::DeactivateLocked() {
|
|||
}
|
||||
|
||||
void XdsClusterManagerLb::ClusterChild::OnDelayedRemovalTimer(
|
||||
void* arg, grpc_error* error) {
|
||||
void* arg, grpc_error_handle error) {
|
||||
ClusterChild* self = static_cast<ClusterChild*>(arg);
|
||||
GRPC_ERROR_REF(error); // Ref owned by the lambda
|
||||
self->xds_cluster_manager_policy_->work_serializer()->Run(
|
||||
|
|
@ -522,7 +522,7 @@ void XdsClusterManagerLb::ClusterChild::OnDelayedRemovalTimer(
|
|||
}
|
||||
|
||||
void XdsClusterManagerLb::ClusterChild::OnDelayedRemovalTimerLocked(
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
delayed_removal_timer_callback_pending_ = false;
|
||||
if (error == GRPC_ERROR_NONE && !shutdown_) {
|
||||
xds_cluster_manager_policy_->children_.erase(name_);
|
||||
|
|
@ -616,7 +616,7 @@ class XdsClusterManagerLbFactory : public LoadBalancingPolicyFactory {
|
|||
const char* name() const override { return kXdsClusterManager; }
|
||||
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
|
||||
const Json& json, grpc_error** error) const override {
|
||||
const Json& json, grpc_error_handle* error) const override {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
if (json.type() == Json::Type::JSON_NULL) {
|
||||
// xds_cluster_manager was mentioned as a policy in the deprecated
|
||||
|
|
@ -627,7 +627,7 @@ class XdsClusterManagerLbFactory : public LoadBalancingPolicyFactory {
|
|||
"config instead.");
|
||||
return nullptr;
|
||||
}
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
XdsClusterManagerLbConfig::ClusterMap cluster_map;
|
||||
std::set<std::string /*cluster_name*/> clusters_to_be_used;
|
||||
auto it = json.object_value().find("children");
|
||||
|
|
@ -646,14 +646,14 @@ class XdsClusterManagerLbFactory : public LoadBalancingPolicyFactory {
|
|||
continue;
|
||||
}
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> child_config;
|
||||
std::vector<grpc_error*> child_errors =
|
||||
std::vector<grpc_error_handle> child_errors =
|
||||
ParseChildConfig(p.second, &child_config);
|
||||
if (!child_errors.empty()) {
|
||||
// Can't use GRPC_ERROR_CREATE_FROM_VECTOR() here, because the error
|
||||
// string is not static in this case.
|
||||
grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
grpc_error_handle error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrCat("field:children name:", child_name).c_str());
|
||||
for (grpc_error* child_error : child_errors) {
|
||||
for (grpc_error_handle child_error : child_errors) {
|
||||
error = grpc_error_add_child(error, child_error);
|
||||
}
|
||||
error_list.push_back(error);
|
||||
|
|
@ -676,10 +676,10 @@ class XdsClusterManagerLbFactory : public LoadBalancingPolicyFactory {
|
|||
}
|
||||
|
||||
private:
|
||||
static std::vector<grpc_error*> ParseChildConfig(
|
||||
static std::vector<grpc_error_handle> ParseChildConfig(
|
||||
const Json& json,
|
||||
RefCountedPtr<LoadBalancingPolicy::Config>* child_config) {
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
if (json.type() != Json::Type::OBJECT) {
|
||||
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"value should be of type object"));
|
||||
|
|
@ -690,12 +690,12 @@ class XdsClusterManagerLbFactory : public LoadBalancingPolicyFactory {
|
|||
error_list.push_back(
|
||||
GRPC_ERROR_CREATE_FROM_STATIC_STRING("did not find childPolicy"));
|
||||
} else {
|
||||
grpc_error* parse_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle parse_error = GRPC_ERROR_NONE;
|
||||
*child_config = LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(
|
||||
it->second, &parse_error);
|
||||
if (*child_config == nullptr) {
|
||||
GPR_DEBUG_ASSERT(parse_error != GRPC_ERROR_NONE);
|
||||
std::vector<grpc_error*> child_errors;
|
||||
std::vector<grpc_error_handle> child_errors;
|
||||
child_errors.push_back(parse_error);
|
||||
error_list.push_back(
|
||||
GRPC_ERROR_CREATE_FROM_VECTOR("field:childPolicy", &child_errors));
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ class XdsClusterResolverLb : public LoadBalancingPolicy {
|
|||
void OnEndpointChanged(XdsApi::EdsUpdate update) override {
|
||||
new Notifier(discovery_mechanism_, std::move(update));
|
||||
}
|
||||
void OnError(grpc_error* error) override {
|
||||
void OnError(grpc_error_handle error) override {
|
||||
new Notifier(discovery_mechanism_, error);
|
||||
}
|
||||
void OnResourceDoesNotExist() override {
|
||||
|
|
@ -198,7 +198,7 @@ class XdsClusterResolverLb : public LoadBalancingPolicy {
|
|||
Notifier(RefCountedPtr<EdsDiscoveryMechanism> discovery_mechanism,
|
||||
XdsApi::EdsUpdate update);
|
||||
Notifier(RefCountedPtr<EdsDiscoveryMechanism> discovery_mechanism,
|
||||
grpc_error* error);
|
||||
grpc_error_handle error);
|
||||
explicit Notifier(
|
||||
RefCountedPtr<EdsDiscoveryMechanism> discovery_mechanism);
|
||||
~Notifier() { discovery_mechanism_.reset(DEBUG_LOCATION, "Notifier"); }
|
||||
|
|
@ -206,8 +206,8 @@ class XdsClusterResolverLb : public LoadBalancingPolicy {
|
|||
private:
|
||||
enum Type { kUpdate, kError, kDoesNotExist };
|
||||
|
||||
static void RunInExecCtx(void* arg, grpc_error* error);
|
||||
void RunInWorkSerializer(grpc_error* error);
|
||||
static void RunInExecCtx(void* arg, grpc_error_handle error);
|
||||
void RunInWorkSerializer(grpc_error_handle error);
|
||||
|
||||
RefCountedPtr<EdsDiscoveryMechanism> discovery_mechanism_;
|
||||
grpc_closure closure_;
|
||||
|
|
@ -250,7 +250,7 @@ class XdsClusterResolverLb : public LoadBalancingPolicy {
|
|||
|
||||
void ReturnResult(Resolver::Result result) override;
|
||||
|
||||
void ReturnError(grpc_error* error) override;
|
||||
void ReturnError(grpc_error_handle error) override;
|
||||
|
||||
private:
|
||||
RefCountedPtr<LogicalDNSDiscoveryMechanism> discovery_mechanism_;
|
||||
|
|
@ -304,7 +304,7 @@ class XdsClusterResolverLb : public LoadBalancingPolicy {
|
|||
void ShutdownLocked() override;
|
||||
|
||||
void OnEndpointChanged(size_t index, XdsApi::EdsUpdate update);
|
||||
void OnError(size_t index, grpc_error* error);
|
||||
void OnError(size_t index, grpc_error_handle error);
|
||||
void OnResourceDoesNotExist(size_t index);
|
||||
|
||||
void MaybeDestroyChildPolicyLocked();
|
||||
|
|
@ -430,7 +430,7 @@ XdsClusterResolverLb::EdsDiscoveryMechanism::EndpointWatcher::Notifier::
|
|||
XdsClusterResolverLb::EdsDiscoveryMechanism::EndpointWatcher::Notifier::
|
||||
Notifier(RefCountedPtr<XdsClusterResolverLb::EdsDiscoveryMechanism>
|
||||
discovery_mechanism,
|
||||
grpc_error* error)
|
||||
grpc_error_handle error)
|
||||
: discovery_mechanism_(std::move(discovery_mechanism)), type_(kError) {
|
||||
GRPC_CLOSURE_INIT(&closure_, &RunInExecCtx, this, nullptr);
|
||||
ExecCtx::Run(DEBUG_LOCATION, &closure_, error);
|
||||
|
|
@ -446,7 +446,7 @@ XdsClusterResolverLb::EdsDiscoveryMechanism::EndpointWatcher::Notifier::
|
|||
}
|
||||
|
||||
void XdsClusterResolverLb::EdsDiscoveryMechanism::EndpointWatcher::Notifier::
|
||||
RunInExecCtx(void* arg, grpc_error* error) {
|
||||
RunInExecCtx(void* arg, grpc_error_handle error) {
|
||||
Notifier* self = static_cast<Notifier*>(arg);
|
||||
GRPC_ERROR_REF(error);
|
||||
self->discovery_mechanism_->parent()->work_serializer()->Run(
|
||||
|
|
@ -454,7 +454,7 @@ void XdsClusterResolverLb::EdsDiscoveryMechanism::EndpointWatcher::Notifier::
|
|||
}
|
||||
|
||||
void XdsClusterResolverLb::EdsDiscoveryMechanism::EndpointWatcher::Notifier::
|
||||
RunInWorkSerializer(grpc_error* error) {
|
||||
RunInWorkSerializer(grpc_error_handle error) {
|
||||
switch (type_) {
|
||||
case kUpdate:
|
||||
discovery_mechanism_->parent()->OnEndpointChanged(
|
||||
|
|
@ -542,7 +542,7 @@ void XdsClusterResolverLb::LogicalDNSDiscoveryMechanism::ResolverResultHandler::
|
|||
}
|
||||
|
||||
void XdsClusterResolverLb::LogicalDNSDiscoveryMechanism::ResolverResultHandler::
|
||||
ReturnError(grpc_error* error) {
|
||||
ReturnError(grpc_error_handle error) {
|
||||
discovery_mechanism_->parent()->OnError(discovery_mechanism_->index(), error);
|
||||
}
|
||||
|
||||
|
|
@ -730,7 +730,7 @@ void XdsClusterResolverLb::OnEndpointChanged(size_t index,
|
|||
UpdatePriorityList(std::move(priority_list));
|
||||
}
|
||||
|
||||
void XdsClusterResolverLb::OnError(size_t index, grpc_error* error) {
|
||||
void XdsClusterResolverLb::OnError(size_t index, grpc_error_handle error) {
|
||||
gpr_log(GPR_ERROR,
|
||||
"[xds_cluster_resolver_lb %p] discovery mechanism %" PRIuPTR
|
||||
" xds watcher reported error: %s",
|
||||
|
|
@ -1002,7 +1002,7 @@ XdsClusterResolverLb::CreateChildPolicyConfigLocked() {
|
|||
"[xds_cluster_resolver_lb %p] generated config for child policy: %s",
|
||||
this, json_str.c_str());
|
||||
}
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> config =
|
||||
LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(json, &error);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
|
|
@ -1106,7 +1106,7 @@ class XdsClusterResolverLbFactory : public LoadBalancingPolicyFactory {
|
|||
XdsClient::GetFromChannelArgs(*args.args);
|
||||
if (xds_client == nullptr) {
|
||||
if (!is_xds_uri) {
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
xds_client = XdsClient::GetOrCreate(args.args, &error);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
gpr_log(GPR_ERROR,
|
||||
|
|
@ -1130,7 +1130,7 @@ class XdsClusterResolverLbFactory : public LoadBalancingPolicyFactory {
|
|||
const char* name() const override { return kXdsClusterResolver; }
|
||||
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
|
||||
const Json& json, grpc_error** error) const override {
|
||||
const Json& json, grpc_error_handle* error) const override {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
if (json.type() == Json::Type::JSON_NULL) {
|
||||
// xds_cluster_resolver was mentioned as a policy in the deprecated
|
||||
|
|
@ -1141,7 +1141,7 @@ class XdsClusterResolverLbFactory : public LoadBalancingPolicyFactory {
|
|||
"Please use loadBalancingConfig field of service config instead.");
|
||||
return nullptr;
|
||||
}
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
std::vector<XdsClusterResolverLbConfig::DiscoveryMechanism>
|
||||
discovery_mechanisms;
|
||||
auto it = json.object_value().find("discoveryMechanisms");
|
||||
|
|
@ -1155,13 +1155,13 @@ class XdsClusterResolverLbFactory : public LoadBalancingPolicyFactory {
|
|||
const Json::Array& array = it->second.array_value();
|
||||
for (size_t i = 0; i < array.size(); ++i) {
|
||||
XdsClusterResolverLbConfig::DiscoveryMechanism discovery_mechanism;
|
||||
std::vector<grpc_error*> discovery_mechanism_errors =
|
||||
std::vector<grpc_error_handle> discovery_mechanism_errors =
|
||||
ParseDiscoveryMechanism(array[i], &discovery_mechanism);
|
||||
if (!discovery_mechanism_errors.empty()) {
|
||||
grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
grpc_error_handle error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrCat("field:discovery_mechanism element: ", i, " error")
|
||||
.c_str());
|
||||
for (grpc_error* discovery_mechanism_error :
|
||||
for (grpc_error_handle discovery_mechanism_error :
|
||||
discovery_mechanism_errors) {
|
||||
error = grpc_error_add_child(error, discovery_mechanism_error);
|
||||
}
|
||||
|
|
@ -1276,10 +1276,10 @@ class XdsClusterResolverLbFactory : public LoadBalancingPolicyFactory {
|
|||
}
|
||||
|
||||
private:
|
||||
static std::vector<grpc_error*> ParseDiscoveryMechanism(
|
||||
static std::vector<grpc_error_handle> ParseDiscoveryMechanism(
|
||||
const Json& json,
|
||||
XdsClusterResolverLbConfig::DiscoveryMechanism* discovery_mechanism) {
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
if (json.type() != Json::Type::OBJECT) {
|
||||
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"value should be of type object"));
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class LoadBalancingPolicyFactory {
|
|||
virtual const char* name() const = 0;
|
||||
|
||||
virtual RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
|
||||
const Json& json, grpc_error** error) const = 0;
|
||||
const Json& json, grpc_error_handle* error) const = 0;
|
||||
};
|
||||
|
||||
} // namespace grpc_core
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ bool LoadBalancingPolicyRegistry::LoadBalancingPolicyExists(
|
|||
return false;
|
||||
}
|
||||
if (requires_config != nullptr) {
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
// Check if the load balancing policy allows an empty config
|
||||
*requires_config =
|
||||
factory->ParseLoadBalancingConfig(Json(), &error) == nullptr;
|
||||
|
|
@ -122,7 +122,7 @@ namespace {
|
|||
|
||||
// Returns the JSON node of policy (with both policy name and config content)
|
||||
// given the JSON node of a LoadBalancingConfig array.
|
||||
grpc_error* ParseLoadBalancingConfigHelper(
|
||||
grpc_error_handle ParseLoadBalancingConfigHelper(
|
||||
const Json& lb_config_array, Json::Object::const_iterator* result) {
|
||||
if (lb_config_array.type() != Json::Type::ARRAY) {
|
||||
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("type should be array");
|
||||
|
|
@ -163,8 +163,8 @@ grpc_error* ParseLoadBalancingConfigHelper(
|
|||
} // namespace
|
||||
|
||||
RefCountedPtr<LoadBalancingPolicy::Config>
|
||||
LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(const Json& json,
|
||||
grpc_error** error) {
|
||||
LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(
|
||||
const Json& json, grpc_error_handle* error) {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
GPR_ASSERT(g_state != nullptr);
|
||||
Json::Object::const_iterator policy;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class LoadBalancingPolicyRegistry {
|
|||
/// Returns a parsed object of the load balancing policy to be used from a
|
||||
/// LoadBalancingConfig array \a json.
|
||||
static RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
|
||||
const Json& json, grpc_error** error);
|
||||
const Json& json, grpc_error_handle* error);
|
||||
};
|
||||
|
||||
} // namespace grpc_core
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class Resolver : public InternallyRefCounted<Resolver> {
|
|||
struct Result {
|
||||
ServerAddressList addresses;
|
||||
RefCountedPtr<ServiceConfig> service_config;
|
||||
grpc_error* service_config_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle service_config_error = GRPC_ERROR_NONE;
|
||||
const grpc_channel_args* args = nullptr;
|
||||
|
||||
// TODO(roth): Remove everything below once grpc_error and
|
||||
|
|
@ -81,7 +81,7 @@ class Resolver : public InternallyRefCounted<Resolver> {
|
|||
/// Returns a transient error to the channel.
|
||||
/// If the resolver does not set the GRPC_ERROR_INT_GRPC_STATUS
|
||||
/// attribute on the error, calls will be failed with status UNKNOWN.
|
||||
virtual void ReturnError(grpc_error* error) = 0;
|
||||
virtual void ReturnError(grpc_error_handle error) = 0;
|
||||
|
||||
// TODO(yashkt): As part of the service config error handling
|
||||
// changes, add a method to parse the service config JSON string.
|
||||
|
|
|
|||
|
|
@ -80,10 +80,10 @@ class AresDnsResolver : public Resolver {
|
|||
void MaybeStartResolvingLocked();
|
||||
void StartResolvingLocked();
|
||||
|
||||
static void OnNextResolution(void* arg, grpc_error* error);
|
||||
static void OnResolved(void* arg, grpc_error* error);
|
||||
void OnNextResolutionLocked(grpc_error* error);
|
||||
void OnResolvedLocked(grpc_error* error);
|
||||
static void OnNextResolution(void* arg, grpc_error_handle error);
|
||||
static void OnResolved(void* arg, grpc_error_handle error);
|
||||
void OnNextResolutionLocked(grpc_error_handle error);
|
||||
void OnResolvedLocked(grpc_error_handle error);
|
||||
|
||||
/// DNS server to use (if not system default)
|
||||
std::string dns_server_;
|
||||
|
|
@ -193,14 +193,14 @@ void AresDnsResolver::ShutdownLocked() {
|
|||
}
|
||||
}
|
||||
|
||||
void AresDnsResolver::OnNextResolution(void* arg, grpc_error* error) {
|
||||
void AresDnsResolver::OnNextResolution(void* arg, grpc_error_handle error) {
|
||||
AresDnsResolver* r = static_cast<AresDnsResolver*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
r->work_serializer_->Run([r, error]() { r->OnNextResolutionLocked(error); },
|
||||
DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
void AresDnsResolver::OnNextResolutionLocked(grpc_error* error) {
|
||||
void AresDnsResolver::OnNextResolutionLocked(grpc_error_handle error) {
|
||||
GRPC_CARES_TRACE_LOG(
|
||||
"resolver:%p re-resolution timer fired. error: %s. shutdown_initiated_: "
|
||||
"%d",
|
||||
|
|
@ -227,7 +227,7 @@ bool ValueInJsonArray(const Json::Array& array, const char* value) {
|
|||
}
|
||||
|
||||
std::string ChooseServiceConfig(char* service_config_choice_json,
|
||||
grpc_error** error) {
|
||||
grpc_error_handle* error) {
|
||||
Json json = Json::Parse(service_config_choice_json, error);
|
||||
if (*error != GRPC_ERROR_NONE) return "";
|
||||
if (json.type() != Json::Type::ARRAY) {
|
||||
|
|
@ -236,7 +236,7 @@ std::string ChooseServiceConfig(char* service_config_choice_json,
|
|||
return "";
|
||||
}
|
||||
const Json* service_config = nullptr;
|
||||
absl::InlinedVector<grpc_error*, 4> error_list;
|
||||
absl::InlinedVector<grpc_error_handle, 4> error_list;
|
||||
for (const Json& choice : json.array_value()) {
|
||||
if (choice.type() != Json::Type::OBJECT) {
|
||||
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
|
|
@ -305,14 +305,14 @@ std::string ChooseServiceConfig(char* service_config_choice_json,
|
|||
return service_config->Dump();
|
||||
}
|
||||
|
||||
void AresDnsResolver::OnResolved(void* arg, grpc_error* error) {
|
||||
void AresDnsResolver::OnResolved(void* arg, grpc_error_handle error) {
|
||||
AresDnsResolver* r = static_cast<AresDnsResolver*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
r->work_serializer_->Run([r, error]() { r->OnResolvedLocked(error); },
|
||||
DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
void AresDnsResolver::OnResolvedLocked(grpc_error* error) {
|
||||
void AresDnsResolver::OnResolvedLocked(grpc_error_handle error) {
|
||||
GPR_ASSERT(resolving_);
|
||||
resolving_ = false;
|
||||
gpr_free(pending_request_);
|
||||
|
|
@ -455,7 +455,7 @@ class AresDnsResolverFactory : public ResolverFactory {
|
|||
extern grpc_address_resolver_vtable* grpc_resolve_address_impl;
|
||||
static grpc_address_resolver_vtable* default_resolver;
|
||||
|
||||
static grpc_error* blocking_resolve_address_ares(
|
||||
static grpc_error_handle blocking_resolve_address_ares(
|
||||
const char* name, const char* default_port,
|
||||
grpc_resolved_addresses** addresses) {
|
||||
return default_resolver->blocking_resolve_address(name, default_port,
|
||||
|
|
@ -490,7 +490,7 @@ void grpc_resolver_dns_ares_init() {
|
|||
g_use_ares_dns_resolver = true;
|
||||
gpr_log(GPR_DEBUG, "Using ares dns resolver");
|
||||
address_sorting_init();
|
||||
grpc_error* error = grpc_ares_init();
|
||||
grpc_error_handle error = grpc_ares_init();
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
GRPC_LOG_IF_ERROR("grpc_ares_init() failed", error);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class GrpcPolledFd {
|
|||
virtual bool IsFdStillReadableLocked() = 0;
|
||||
/* Called once and only once. Must cause cancellation of any pending
|
||||
* read/write callbacks. */
|
||||
virtual void ShutdownLocked(grpc_error* error) = 0;
|
||||
virtual void ShutdownLocked(grpc_error_handle error) = 0;
|
||||
/* Get the underlying ares_socket_t that this was created from */
|
||||
virtual ares_socket_t GetWrappedAresSocketLocked() = 0;
|
||||
/* A unique name, for logging */
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class GrpcPolledFdLibuv : public GrpcPolledFd {
|
|||
return false;
|
||||
}
|
||||
|
||||
void ShutdownInternalLocked(grpc_error* error) {
|
||||
void ShutdownInternalLocked(grpc_error_handle error) {
|
||||
uv_poll_stop(handle_);
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(handle_), ares_uv_poll_close_cb);
|
||||
if (read_closure_ != nullptr) {
|
||||
|
|
@ -88,7 +88,7 @@ class GrpcPolledFdLibuv : public GrpcPolledFd {
|
|||
}
|
||||
}
|
||||
|
||||
void ShutdownLocked(grpc_error* error) override {
|
||||
void ShutdownLocked(grpc_error_handle error) override {
|
||||
if (grpc_core::ExecCtx::Get() == nullptr) {
|
||||
grpc_core::ExecCtx exec_ctx;
|
||||
ShutdownInternalLocked(error);
|
||||
|
|
@ -127,7 +127,7 @@ static void ares_uv_poll_cb_locked(AresUvPollCbArg* arg) {
|
|||
int events = arg_struct->events;
|
||||
GrpcPolledFdLibuv* polled_fd =
|
||||
reinterpret_cast<GrpcPolledFdLibuv*>(handle->data);
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
if (status < 0) {
|
||||
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("cares polling error");
|
||||
error =
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class GrpcPolledFdPosix : public GrpcPolledFd {
|
|||
bytes_available > 0;
|
||||
}
|
||||
|
||||
void ShutdownLocked(grpc_error* error) override {
|
||||
void ShutdownLocked(grpc_error_handle error) override {
|
||||
grpc_fd_shutdown(fd_, error);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,12 +131,12 @@ class GrpcPolledFdWindows {
|
|||
grpc_winsocket_destroy(winsocket_);
|
||||
}
|
||||
|
||||
void ScheduleAndNullReadClosure(grpc_error* error) {
|
||||
void ScheduleAndNullReadClosure(grpc_error_handle error) {
|
||||
grpc_core::ExecCtx::Run(DEBUG_LOCATION, read_closure_, error);
|
||||
read_closure_ = nullptr;
|
||||
}
|
||||
|
||||
void ScheduleAndNullWriteClosure(grpc_error* error) {
|
||||
void ScheduleAndNullWriteClosure(grpc_error_handle error) {
|
||||
grpc_core::ExecCtx::Run(DEBUG_LOCATION, write_closure_, error);
|
||||
write_closure_ = nullptr;
|
||||
}
|
||||
|
|
@ -253,7 +253,7 @@ class GrpcPolledFdWindows {
|
|||
|
||||
bool IsFdStillReadableLocked() { return read_buf_has_data_; }
|
||||
|
||||
void ShutdownLocked(grpc_error* error) {
|
||||
void ShutdownLocked(grpc_error_handle error) {
|
||||
grpc_winsocket_shutdown(winsocket_);
|
||||
}
|
||||
|
||||
|
|
@ -420,7 +420,7 @@ class GrpcPolledFdWindows {
|
|||
abort();
|
||||
}
|
||||
|
||||
static void OnTcpConnect(void* arg, grpc_error* error) {
|
||||
static void OnTcpConnect(void* arg, grpc_error_handle error) {
|
||||
GrpcPolledFdWindows* grpc_polled_fd =
|
||||
static_cast<GrpcPolledFdWindows*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
|
|
@ -431,7 +431,7 @@ class GrpcPolledFdWindows {
|
|||
DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
void OnTcpConnectLocked(grpc_error* error) {
|
||||
void OnTcpConnectLocked(grpc_error_handle error) {
|
||||
GRPC_CARES_TRACE_LOG(
|
||||
"fd:%s InnerOnTcpConnectLocked error:|%s| "
|
||||
"pending_register_for_readable:%d"
|
||||
|
|
@ -576,7 +576,7 @@ class GrpcPolledFdWindows {
|
|||
return out;
|
||||
}
|
||||
|
||||
static void OnIocpReadable(void* arg, grpc_error* error) {
|
||||
static void OnIocpReadable(void* arg, grpc_error_handle error) {
|
||||
GrpcPolledFdWindows* polled_fd = static_cast<GrpcPolledFdWindows*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
polled_fd->work_serializer_->Run(
|
||||
|
|
@ -589,7 +589,7 @@ class GrpcPolledFdWindows {
|
|||
// c-ares reads from this socket later, but it shouldn't necessarily cancel
|
||||
// the entire resolution attempt. Doing so will allow the "inject broken
|
||||
// nameserver list" test to pass on Windows.
|
||||
void OnIocpReadableLocked(grpc_error* error) {
|
||||
void OnIocpReadableLocked(grpc_error_handle error) {
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
if (winsocket_->read_info.wsa_error != 0) {
|
||||
/* WSAEMSGSIZE would be due to receiving more data
|
||||
|
|
@ -621,7 +621,7 @@ class GrpcPolledFdWindows {
|
|||
ScheduleAndNullReadClosure(error);
|
||||
}
|
||||
|
||||
static void OnIocpWriteable(void* arg, grpc_error* error) {
|
||||
static void OnIocpWriteable(void* arg, grpc_error_handle error) {
|
||||
GrpcPolledFdWindows* polled_fd = static_cast<GrpcPolledFdWindows*>(arg);
|
||||
GRPC_ERROR_REF(error); // error owned by lambda
|
||||
polled_fd->work_serializer_->Run(
|
||||
|
|
@ -629,7 +629,7 @@ class GrpcPolledFdWindows {
|
|||
DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
void OnIocpWriteableLocked(grpc_error* error) {
|
||||
void OnIocpWriteableLocked(grpc_error_handle error) {
|
||||
GRPC_CARES_TRACE_LOG("OnIocpWriteableInner. fd:|%s|", GetName());
|
||||
GPR_ASSERT(socket_type_ == SOCK_STREAM);
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
|
|
@ -851,7 +851,7 @@ class GrpcPolledFdWindowsWrapper : public GrpcPolledFd {
|
|||
return wrapped_->IsFdStillReadableLocked();
|
||||
}
|
||||
|
||||
void ShutdownLocked(grpc_error* error) override {
|
||||
void ShutdownLocked(grpc_error_handle error) override {
|
||||
wrapped_->ShutdownLocked(error);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ struct grpc_ares_request {
|
|||
size_t pending_queries;
|
||||
|
||||
/** the errors explaining query failures, appended to in query callbacks */
|
||||
grpc_error* error;
|
||||
grpc_error_handle error;
|
||||
};
|
||||
|
||||
typedef struct fd_node {
|
||||
|
|
@ -268,7 +268,8 @@ static grpc_millis calculate_next_ares_backup_poll_alarm_ms(
|
|||
grpc_core::ExecCtx::Get()->Now();
|
||||
}
|
||||
|
||||
static void on_timeout_locked(grpc_ares_ev_driver* driver, grpc_error* error) {
|
||||
static void on_timeout_locked(grpc_ares_ev_driver* driver,
|
||||
grpc_error_handle error) {
|
||||
GRPC_CARES_TRACE_LOG(
|
||||
"request:%p ev_driver=%p on_timeout_locked. driver->shutting_down=%d. "
|
||||
"err=%s",
|
||||
|
|
@ -280,7 +281,7 @@ static void on_timeout_locked(grpc_ares_ev_driver* driver, grpc_error* error) {
|
|||
GRPC_ERROR_UNREF(error);
|
||||
}
|
||||
|
||||
static void on_timeout(void* arg, grpc_error* error) {
|
||||
static void on_timeout(void* arg, grpc_error_handle error) {
|
||||
grpc_ares_ev_driver* driver = static_cast<grpc_ares_ev_driver*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
driver->work_serializer->Run(
|
||||
|
|
@ -290,9 +291,9 @@ static void on_timeout(void* arg, grpc_error* error) {
|
|||
static void grpc_ares_notify_on_event_locked(grpc_ares_ev_driver* ev_driver);
|
||||
|
||||
static void on_ares_backup_poll_alarm_locked(grpc_ares_ev_driver* driver,
|
||||
grpc_error* error);
|
||||
grpc_error_handle error);
|
||||
|
||||
static void on_ares_backup_poll_alarm(void* arg, grpc_error* error) {
|
||||
static void on_ares_backup_poll_alarm(void* arg, grpc_error_handle error) {
|
||||
grpc_ares_ev_driver* driver = static_cast<grpc_ares_ev_driver*>(arg);
|
||||
GRPC_ERROR_REF(error);
|
||||
driver->work_serializer->Run(
|
||||
|
|
@ -309,7 +310,7 @@ static void on_ares_backup_poll_alarm(void* arg, grpc_error* error) {
|
|||
* For the latter, we use this backup poller. Also see
|
||||
* https://github.com/grpc/grpc/pull/17688 description for more details. */
|
||||
static void on_ares_backup_poll_alarm_locked(grpc_ares_ev_driver* driver,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
GRPC_CARES_TRACE_LOG(
|
||||
"request:%p ev_driver=%p on_ares_backup_poll_alarm_locked. "
|
||||
"driver->shutting_down=%d. "
|
||||
|
|
@ -345,7 +346,7 @@ static void on_ares_backup_poll_alarm_locked(grpc_ares_ev_driver* driver,
|
|||
GRPC_ERROR_UNREF(error);
|
||||
}
|
||||
|
||||
static void on_readable_locked(fd_node* fdn, grpc_error* error) {
|
||||
static void on_readable_locked(fd_node* fdn, grpc_error_handle error) {
|
||||
GPR_ASSERT(fdn->readable_registered);
|
||||
grpc_ares_ev_driver* ev_driver = fdn->ev_driver;
|
||||
const ares_socket_t as = fdn->grpc_polled_fd->GetWrappedAresSocketLocked();
|
||||
|
|
@ -370,14 +371,14 @@ static void on_readable_locked(fd_node* fdn, grpc_error* error) {
|
|||
GRPC_ERROR_UNREF(error);
|
||||
}
|
||||
|
||||
static void on_readable(void* arg, grpc_error* error) {
|
||||
static void on_readable(void* arg, grpc_error_handle error) {
|
||||
fd_node* fdn = static_cast<fd_node*>(arg);
|
||||
GRPC_ERROR_REF(error); /* ref owned by lambda */
|
||||
fdn->ev_driver->work_serializer->Run(
|
||||
[fdn, error]() { on_readable_locked(fdn, error); }, DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
static void on_writable_locked(fd_node* fdn, grpc_error* error) {
|
||||
static void on_writable_locked(fd_node* fdn, grpc_error_handle error) {
|
||||
GPR_ASSERT(fdn->writable_registered);
|
||||
grpc_ares_ev_driver* ev_driver = fdn->ev_driver;
|
||||
const ares_socket_t as = fdn->grpc_polled_fd->GetWrappedAresSocketLocked();
|
||||
|
|
@ -400,7 +401,7 @@ static void on_writable_locked(fd_node* fdn, grpc_error* error) {
|
|||
GRPC_ERROR_UNREF(error);
|
||||
}
|
||||
|
||||
static void on_writable(void* arg, grpc_error* error) {
|
||||
static void on_writable(void* arg, grpc_error_handle error) {
|
||||
fd_node* fdn = static_cast<fd_node*>(arg);
|
||||
GRPC_ERROR_REF(error); /* ref owned by lambda */
|
||||
fdn->ev_driver->work_serializer->Run(
|
||||
|
|
@ -516,7 +517,7 @@ static void noop_inject_channel_config(ares_channel /*channel*/) {}
|
|||
void (*grpc_ares_test_only_inject_config)(ares_channel channel) =
|
||||
noop_inject_channel_config;
|
||||
|
||||
grpc_error* grpc_ares_ev_driver_create_locked(
|
||||
grpc_error_handle grpc_ares_ev_driver_create_locked(
|
||||
grpc_ares_ev_driver** ev_driver, grpc_pollset_set* pollset_set,
|
||||
int query_timeout_ms,
|
||||
std::shared_ptr<grpc_core::WorkSerializer> work_serializer,
|
||||
|
|
@ -529,7 +530,7 @@ grpc_error* grpc_ares_ev_driver_create_locked(
|
|||
grpc_ares_test_only_inject_config((*ev_driver)->channel);
|
||||
GRPC_CARES_TRACE_LOG("request:%p grpc_ares_ev_driver_create_locked", request);
|
||||
if (status != ARES_SUCCESS) {
|
||||
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
grpc_error_handle err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrCat("Failed to init ares channel. C-ares error: ",
|
||||
ares_strerror(status))
|
||||
.c_str());
|
||||
|
|
@ -713,7 +714,8 @@ static void on_hostbyname_done_locked(void* arg, int status, int /*timeouts*/,
|
|||
hr->qtype, hr->host, hr->is_balancer, ares_strerror(status));
|
||||
GRPC_CARES_TRACE_LOG("request:%p on_hostbyname_done_locked: %s", r,
|
||||
error_msg.c_str());
|
||||
grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_msg.c_str());
|
||||
grpc_error_handle error =
|
||||
GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_msg.c_str());
|
||||
r->error = grpc_error_add_child(error, r->error);
|
||||
}
|
||||
destroy_hostbyname_request_locked(hr);
|
||||
|
|
@ -757,7 +759,8 @@ static void on_srv_query_done_locked(void* arg, int status, int /*timeouts*/,
|
|||
ares_strerror(status));
|
||||
GRPC_CARES_TRACE_LOG("request:%p on_srv_query_done_locked: %s", r,
|
||||
error_msg.c_str());
|
||||
grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_msg.c_str());
|
||||
grpc_error_handle error =
|
||||
GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_msg.c_str());
|
||||
r->error = grpc_error_add_child(error, r->error);
|
||||
}
|
||||
delete q;
|
||||
|
|
@ -773,7 +776,7 @@ static void on_txt_done_locked(void* arg, int status, int /*timeouts*/,
|
|||
const size_t prefix_len = sizeof(g_service_config_attribute_prefix) - 1;
|
||||
struct ares_txt_ext* result = nullptr;
|
||||
struct ares_txt_ext* reply = nullptr;
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
if (status != ARES_SUCCESS) goto fail;
|
||||
GRPC_CARES_TRACE_LOG("request:%p on_txt_done_locked name=%s ARES_SUCCESS", r,
|
||||
q->name().c_str());
|
||||
|
|
@ -825,7 +828,7 @@ void grpc_dns_lookup_ares_continue_after_check_localhost_and_ip_literals_locked(
|
|||
const char* default_port, grpc_pollset_set* interested_parties,
|
||||
int query_timeout_ms,
|
||||
std::shared_ptr<grpc_core::WorkSerializer> work_serializer) {
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
grpc_ares_hostbyname_request* hr = nullptr;
|
||||
/* parse name, splitting it into host and port parts */
|
||||
std::string host;
|
||||
|
|
@ -1116,7 +1119,7 @@ void (*grpc_cancel_ares_request_locked)(grpc_ares_request* r) =
|
|||
// Windows. Calling them may cause race conditions when other parts of the
|
||||
// binary calls these functions concurrently.
|
||||
#ifdef GPR_WINDOWS
|
||||
grpc_error* grpc_ares_init(void) {
|
||||
grpc_error_handle grpc_ares_init(void) {
|
||||
int status = ares_library_init(ARES_LIB_INIT_ALL);
|
||||
if (status != ARES_SUCCESS) {
|
||||
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
|
|
@ -1128,7 +1131,7 @@ grpc_error* grpc_ares_init(void) {
|
|||
|
||||
void grpc_ares_cleanup(void) { ares_library_cleanup(); }
|
||||
#else
|
||||
grpc_error* grpc_ares_init(void) { return GRPC_ERROR_NONE; }
|
||||
grpc_error_handle grpc_ares_init(void) { return GRPC_ERROR_NONE; }
|
||||
void grpc_ares_cleanup(void) {}
|
||||
#endif // GPR_WINDOWS
|
||||
|
||||
|
|
@ -1159,7 +1162,7 @@ typedef struct grpc_resolve_address_ares_request {
|
|||
} grpc_resolve_address_ares_request;
|
||||
|
||||
static void on_dns_lookup_done_locked(grpc_resolve_address_ares_request* r,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
gpr_free(r->ares_request);
|
||||
grpc_resolved_addresses** resolved_addresses = r->addrs_out;
|
||||
if (r->addresses == nullptr || r->addresses->empty()) {
|
||||
|
|
@ -1180,7 +1183,7 @@ static void on_dns_lookup_done_locked(grpc_resolve_address_ares_request* r,
|
|||
delete r;
|
||||
}
|
||||
|
||||
static void on_dns_lookup_done(void* arg, grpc_error* error) {
|
||||
static void on_dns_lookup_done(void* arg, grpc_error_handle error) {
|
||||
grpc_resolve_address_ares_request* r =
|
||||
static_cast<grpc_resolve_address_ares_request*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ extern void (*grpc_cancel_ares_request_locked)(grpc_ares_request* request);
|
|||
|
||||
/* Initialize gRPC ares wrapper. Must be called at least once before
|
||||
grpc_resolve_address_ares(). */
|
||||
grpc_error* grpc_ares_init(void);
|
||||
grpc_error_handle grpc_ares_init(void);
|
||||
|
||||
/* Uninitialized gRPC ares wrapper. If there was more than one previous call to
|
||||
grpc_ares_init(), this function uninitializes the gRPC ares wrapper only if
|
||||
|
|
|
|||
|
|
@ -68,10 +68,10 @@ class NativeDnsResolver : public Resolver {
|
|||
void MaybeStartResolvingLocked();
|
||||
void StartResolvingLocked();
|
||||
|
||||
static void OnNextResolution(void* arg, grpc_error* error);
|
||||
void OnNextResolutionLocked(grpc_error* error);
|
||||
static void OnResolved(void* arg, grpc_error* error);
|
||||
void OnResolvedLocked(grpc_error* error);
|
||||
static void OnNextResolution(void* arg, grpc_error_handle error);
|
||||
void OnNextResolutionLocked(grpc_error_handle error);
|
||||
static void OnResolved(void* arg, grpc_error_handle error);
|
||||
void OnResolvedLocked(grpc_error_handle error);
|
||||
|
||||
/// name to resolve
|
||||
std::string name_to_resolve_;
|
||||
|
|
@ -148,14 +148,14 @@ void NativeDnsResolver::ShutdownLocked() {
|
|||
}
|
||||
}
|
||||
|
||||
void NativeDnsResolver::OnNextResolution(void* arg, grpc_error* error) {
|
||||
void NativeDnsResolver::OnNextResolution(void* arg, grpc_error_handle error) {
|
||||
NativeDnsResolver* r = static_cast<NativeDnsResolver*>(arg);
|
||||
GRPC_ERROR_REF(error); // ref owned by lambda
|
||||
r->work_serializer_->Run([r, error]() { r->OnNextResolutionLocked(error); },
|
||||
DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
void NativeDnsResolver::OnNextResolutionLocked(grpc_error* error) {
|
||||
void NativeDnsResolver::OnNextResolutionLocked(grpc_error_handle error) {
|
||||
have_next_resolution_timer_ = false;
|
||||
if (error == GRPC_ERROR_NONE && !resolving_) {
|
||||
StartResolvingLocked();
|
||||
|
|
@ -164,14 +164,14 @@ void NativeDnsResolver::OnNextResolutionLocked(grpc_error* error) {
|
|||
GRPC_ERROR_UNREF(error);
|
||||
}
|
||||
|
||||
void NativeDnsResolver::OnResolved(void* arg, grpc_error* error) {
|
||||
void NativeDnsResolver::OnResolved(void* arg, grpc_error_handle error) {
|
||||
NativeDnsResolver* r = static_cast<NativeDnsResolver*>(arg);
|
||||
GRPC_ERROR_REF(error); // owned by lambda
|
||||
r->work_serializer_->Run([r, error]() { r->OnResolvedLocked(error); },
|
||||
DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
void NativeDnsResolver::OnResolvedLocked(grpc_error* error) {
|
||||
void NativeDnsResolver::OnResolvedLocked(grpc_error_handle error) {
|
||||
GPR_ASSERT(resolving_);
|
||||
resolving_ = false;
|
||||
if (shutdown_) {
|
||||
|
|
|
|||
|
|
@ -48,15 +48,15 @@ class GoogleCloud2ProdResolver : public Resolver {
|
|||
void Orphan() override;
|
||||
|
||||
private:
|
||||
static void OnHttpRequestDone(void* arg, grpc_error* error);
|
||||
static void OnHttpRequestDone(void* arg, grpc_error_handle error);
|
||||
|
||||
// Calls OnDone() if not already called. Releases a ref.
|
||||
void MaybeCallOnDone(grpc_error* error);
|
||||
void MaybeCallOnDone(grpc_error_handle error);
|
||||
|
||||
// If error is not GRPC_ERROR_NONE, then it's not safe to look at response.
|
||||
virtual void OnDone(GoogleCloud2ProdResolver* resolver,
|
||||
const grpc_http_response* response,
|
||||
grpc_error* error) = 0;
|
||||
grpc_error_handle error) = 0;
|
||||
|
||||
RefCountedPtr<GoogleCloud2ProdResolver> resolver_;
|
||||
grpc_httpcli_context context_;
|
||||
|
|
@ -73,7 +73,8 @@ class GoogleCloud2ProdResolver : public Resolver {
|
|||
|
||||
private:
|
||||
void OnDone(GoogleCloud2ProdResolver* resolver,
|
||||
const grpc_http_response* response, grpc_error* error) override;
|
||||
const grpc_http_response* response,
|
||||
grpc_error_handle error) override;
|
||||
};
|
||||
|
||||
// A metadata server query to get the IPv6 address.
|
||||
|
|
@ -84,7 +85,8 @@ class GoogleCloud2ProdResolver : public Resolver {
|
|||
|
||||
private:
|
||||
void OnDone(GoogleCloud2ProdResolver* resolver,
|
||||
const grpc_http_response* response, grpc_error* error) override;
|
||||
const grpc_http_response* response,
|
||||
grpc_error_handle error) override;
|
||||
};
|
||||
|
||||
void ZoneQueryDone(std::string zone);
|
||||
|
|
@ -143,13 +145,13 @@ void GoogleCloud2ProdResolver::MetadataQuery::Orphan() {
|
|||
}
|
||||
|
||||
void GoogleCloud2ProdResolver::MetadataQuery::OnHttpRequestDone(
|
||||
void* arg, grpc_error* error) {
|
||||
void* arg, grpc_error_handle error) {
|
||||
auto* self = static_cast<MetadataQuery*>(arg);
|
||||
self->MaybeCallOnDone(GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
void GoogleCloud2ProdResolver::MetadataQuery::MaybeCallOnDone(
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
bool expected = false;
|
||||
if (!on_done_called_.CompareExchangeStrong(
|
||||
&expected, true, MemoryOrder::RELAXED, MemoryOrder::RELAXED)) {
|
||||
|
|
@ -180,7 +182,7 @@ GoogleCloud2ProdResolver::ZoneQuery::ZoneQuery(
|
|||
|
||||
void GoogleCloud2ProdResolver::ZoneQuery::OnDone(
|
||||
GoogleCloud2ProdResolver* resolver, const grpc_http_response* response,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
gpr_log(GPR_ERROR, "error fetching zone from metadata server: %s",
|
||||
grpc_error_string(error));
|
||||
|
|
@ -213,7 +215,7 @@ GoogleCloud2ProdResolver::IPv6Query::IPv6Query(
|
|||
|
||||
void GoogleCloud2ProdResolver::IPv6Query::OnDone(
|
||||
GoogleCloud2ProdResolver* resolver, const grpc_http_response* response,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
gpr_log(GPR_ERROR, "error fetching IPv6 address from metadata server: %s",
|
||||
grpc_error_string(error));
|
||||
|
|
|
|||
|
|
@ -83,14 +83,14 @@ class XdsResolver : public Resolver {
|
|||
public:
|
||||
Notifier(RefCountedPtr<XdsResolver> resolver, XdsApi::LdsUpdate update);
|
||||
Notifier(RefCountedPtr<XdsResolver> resolver, XdsApi::RdsUpdate update);
|
||||
Notifier(RefCountedPtr<XdsResolver> resolver, grpc_error* error);
|
||||
Notifier(RefCountedPtr<XdsResolver> resolver, grpc_error_handle error);
|
||||
explicit Notifier(RefCountedPtr<XdsResolver> resolver);
|
||||
|
||||
private:
|
||||
enum Type { kLdsUpdate, kRdsUpdate, kError, kDoesNotExist };
|
||||
|
||||
static void RunInExecCtx(void* arg, grpc_error* error);
|
||||
void RunInWorkSerializer(grpc_error* error);
|
||||
static void RunInExecCtx(void* arg, grpc_error_handle error);
|
||||
void RunInWorkSerializer(grpc_error_handle error);
|
||||
|
||||
RefCountedPtr<XdsResolver> resolver_;
|
||||
grpc_closure closure_;
|
||||
|
|
@ -105,7 +105,9 @@ class XdsResolver : public Resolver {
|
|||
void OnListenerChanged(XdsApi::LdsUpdate listener) override {
|
||||
new Notifier(resolver_, std::move(listener));
|
||||
}
|
||||
void OnError(grpc_error* error) override { new Notifier(resolver_, error); }
|
||||
void OnError(grpc_error_handle error) override {
|
||||
new Notifier(resolver_, error);
|
||||
}
|
||||
void OnResourceDoesNotExist() override { new Notifier(resolver_); }
|
||||
|
||||
private:
|
||||
|
|
@ -119,7 +121,9 @@ class XdsResolver : public Resolver {
|
|||
void OnRouteConfigChanged(XdsApi::RdsUpdate route_config) override {
|
||||
new Notifier(resolver_, std::move(route_config));
|
||||
}
|
||||
void OnError(grpc_error* error) override { new Notifier(resolver_, error); }
|
||||
void OnError(grpc_error_handle error) override {
|
||||
new Notifier(resolver_, error);
|
||||
}
|
||||
void OnResourceDoesNotExist() override { new Notifier(resolver_); }
|
||||
|
||||
private:
|
||||
|
|
@ -145,7 +149,8 @@ class XdsResolver : public Resolver {
|
|||
|
||||
class XdsConfigSelector : public ConfigSelector {
|
||||
public:
|
||||
XdsConfigSelector(RefCountedPtr<XdsResolver> resolver, grpc_error** error);
|
||||
XdsConfigSelector(RefCountedPtr<XdsResolver> resolver,
|
||||
grpc_error_handle* error);
|
||||
~XdsConfigSelector() override;
|
||||
|
||||
const char* name() const override { return "XdsConfigSelector"; }
|
||||
|
|
@ -184,7 +189,7 @@ class XdsResolver : public Resolver {
|
|||
using RouteTable = std::vector<Route>;
|
||||
|
||||
void MaybeAddCluster(const std::string& name);
|
||||
grpc_error* CreateMethodConfig(
|
||||
grpc_error_handle CreateMethodConfig(
|
||||
const XdsApi::Route& route,
|
||||
const XdsApi::Route::ClusterWeight* cluster_weight,
|
||||
RefCountedPtr<ServiceConfig>* method_config);
|
||||
|
|
@ -193,15 +198,16 @@ class XdsResolver : public Resolver {
|
|||
RouteTable route_table_;
|
||||
std::map<absl::string_view, RefCountedPtr<ClusterState>> clusters_;
|
||||
std::vector<const grpc_channel_filter*> filters_;
|
||||
grpc_error* filter_error_ = GRPC_ERROR_NONE;
|
||||
grpc_error_handle filter_error_ = GRPC_ERROR_NONE;
|
||||
};
|
||||
|
||||
void OnListenerUpdate(XdsApi::LdsUpdate listener);
|
||||
void OnRouteConfigUpdate(XdsApi::RdsUpdate rds_update);
|
||||
void OnError(grpc_error* error);
|
||||
void OnError(grpc_error_handle error);
|
||||
void OnResourceDoesNotExist();
|
||||
|
||||
grpc_error* CreateServiceConfig(RefCountedPtr<ServiceConfig>* service_config);
|
||||
grpc_error_handle CreateServiceConfig(
|
||||
RefCountedPtr<ServiceConfig>* service_config);
|
||||
void GenerateResult();
|
||||
void MaybeRemoveUnusedClusters();
|
||||
|
||||
|
|
@ -248,7 +254,7 @@ XdsResolver::Notifier::Notifier(RefCountedPtr<XdsResolver> resolver,
|
|||
}
|
||||
|
||||
XdsResolver::Notifier::Notifier(RefCountedPtr<XdsResolver> resolver,
|
||||
grpc_error* error)
|
||||
grpc_error_handle error)
|
||||
: resolver_(std::move(resolver)), type_(kError) {
|
||||
GRPC_CLOSURE_INIT(&closure_, &RunInExecCtx, this, nullptr);
|
||||
ExecCtx::Run(DEBUG_LOCATION, &closure_, error);
|
||||
|
|
@ -260,14 +266,14 @@ XdsResolver::Notifier::Notifier(RefCountedPtr<XdsResolver> resolver)
|
|||
ExecCtx::Run(DEBUG_LOCATION, &closure_, GRPC_ERROR_NONE);
|
||||
}
|
||||
|
||||
void XdsResolver::Notifier::RunInExecCtx(void* arg, grpc_error* error) {
|
||||
void XdsResolver::Notifier::RunInExecCtx(void* arg, grpc_error_handle error) {
|
||||
Notifier* self = static_cast<Notifier*>(arg);
|
||||
GRPC_ERROR_REF(error);
|
||||
self->resolver_->work_serializer_->Run(
|
||||
[self, error]() { self->RunInWorkSerializer(error); }, DEBUG_LOCATION);
|
||||
}
|
||||
|
||||
void XdsResolver::Notifier::RunInWorkSerializer(grpc_error* error) {
|
||||
void XdsResolver::Notifier::RunInWorkSerializer(grpc_error_handle error) {
|
||||
if (resolver_->xds_client_ == nullptr) {
|
||||
GRPC_ERROR_UNREF(error);
|
||||
delete this;
|
||||
|
|
@ -319,7 +325,7 @@ bool XdsResolver::XdsConfigSelector::Route::operator==(
|
|||
//
|
||||
|
||||
XdsResolver::XdsConfigSelector::XdsConfigSelector(
|
||||
RefCountedPtr<XdsResolver> resolver, grpc_error** error)
|
||||
RefCountedPtr<XdsResolver> resolver, grpc_error_handle* error)
|
||||
: resolver_(std::move(resolver)) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_resolver_trace)) {
|
||||
gpr_log(GPR_INFO, "[xds_resolver %p] creating XdsConfigSelector %p",
|
||||
|
|
@ -430,7 +436,7 @@ const XdsHttpFilterImpl::FilterConfig* FindFilterConfigOverride(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
grpc_error* XdsResolver::XdsConfigSelector::CreateMethodConfig(
|
||||
grpc_error_handle XdsResolver::XdsConfigSelector::CreateMethodConfig(
|
||||
const XdsApi::Route& route,
|
||||
const XdsApi::Route::ClusterWeight* cluster_weight,
|
||||
RefCountedPtr<ServiceConfig>* method_config) {
|
||||
|
|
@ -487,7 +493,7 @@ grpc_error* XdsResolver::XdsConfigSelector::CreateMethodConfig(
|
|||
"\n ]"));
|
||||
}
|
||||
// Construct service config.
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
if (!fields.empty()) {
|
||||
std::string json = absl::StrCat(
|
||||
"{\n"
|
||||
|
|
@ -689,7 +695,7 @@ ConfigSelector::CallConfig XdsResolver::XdsConfigSelector::GetCallConfig(
|
|||
// the data plane mutex.
|
||||
DEBUG_LOCATION,
|
||||
GRPC_CLOSURE_CREATE(
|
||||
[](void* arg, grpc_error* /*error*/) {
|
||||
[](void* arg, grpc_error_handle /*error*/) {
|
||||
auto* resolver = static_cast<XdsResolver*>(arg);
|
||||
resolver->work_serializer_->Run(
|
||||
[resolver]() {
|
||||
|
|
@ -711,7 +717,7 @@ ConfigSelector::CallConfig XdsResolver::XdsConfigSelector::GetCallConfig(
|
|||
//
|
||||
|
||||
void XdsResolver::StartLocked() {
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
xds_client_ = XdsClient::GetOrCreate(args_, &error);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
gpr_log(GPR_ERROR,
|
||||
|
|
@ -814,7 +820,7 @@ void XdsResolver::OnRouteConfigUpdate(XdsApi::RdsUpdate rds_update) {
|
|||
GenerateResult();
|
||||
}
|
||||
|
||||
void XdsResolver::OnError(grpc_error* error) {
|
||||
void XdsResolver::OnError(grpc_error_handle error) {
|
||||
gpr_log(GPR_ERROR, "[xds_resolver %p] received error from XdsClient: %s",
|
||||
this, grpc_error_string(error));
|
||||
Result result;
|
||||
|
|
@ -837,7 +843,7 @@ void XdsResolver::OnResourceDoesNotExist() {
|
|||
result_handler_->ReturnResult(std::move(result));
|
||||
}
|
||||
|
||||
grpc_error* XdsResolver::CreateServiceConfig(
|
||||
grpc_error_handle XdsResolver::CreateServiceConfig(
|
||||
RefCountedPtr<ServiceConfig>* service_config) {
|
||||
std::vector<std::string> clusters;
|
||||
for (const auto& cluster : cluster_state_map_) {
|
||||
|
|
@ -864,7 +870,7 @@ grpc_error* XdsResolver::CreateServiceConfig(
|
|||
" ]\n"
|
||||
"}");
|
||||
std::string json = absl::StrJoin(config_parts, "");
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
*service_config = ServiceConfig::Create(args_, json.c_str(), &error);
|
||||
return error;
|
||||
}
|
||||
|
|
@ -873,7 +879,7 @@ void XdsResolver::GenerateResult() {
|
|||
if (current_virtual_host_.routes.empty()) return;
|
||||
// First create XdsConfigSelector, which may add new entries to the cluster
|
||||
// state map, and then CreateServiceConfig for LB policies.
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
auto config_selector = MakeRefCounted<XdsConfigSelector>(Ref(), &error);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
OnError(error);
|
||||
|
|
|
|||
|
|
@ -62,14 +62,14 @@ void ClientChannelServiceConfigParser::Register() {
|
|||
namespace {
|
||||
|
||||
absl::optional<std::string> ParseHealthCheckConfig(const Json& field,
|
||||
grpc_error** error) {
|
||||
grpc_error_handle* error) {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
if (field.type() != Json::Type::OBJECT) {
|
||||
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"field:healthCheckConfig error:should be of type object");
|
||||
return absl::nullopt;
|
||||
}
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
absl::optional<std::string> service_name;
|
||||
auto it = field.object_value().find("serviceName");
|
||||
if (it != field.object_value().end()) {
|
||||
|
|
@ -89,18 +89,19 @@ absl::optional<std::string> ParseHealthCheckConfig(const Json& field,
|
|||
|
||||
std::unique_ptr<ServiceConfigParser::ParsedConfig>
|
||||
ClientChannelServiceConfigParser::ParseGlobalParams(
|
||||
const grpc_channel_args* /*args*/, const Json& json, grpc_error** error) {
|
||||
const grpc_channel_args* /*args*/, const Json& json,
|
||||
grpc_error_handle* error) {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
// Parse LB config.
|
||||
RefCountedPtr<LoadBalancingPolicy::Config> parsed_lb_config;
|
||||
auto it = json.object_value().find("loadBalancingConfig");
|
||||
if (it != json.object_value().end()) {
|
||||
grpc_error* parse_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle parse_error = GRPC_ERROR_NONE;
|
||||
parsed_lb_config = LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(
|
||||
it->second, &parse_error);
|
||||
if (parsed_lb_config == nullptr) {
|
||||
std::vector<grpc_error*> lb_errors;
|
||||
std::vector<grpc_error_handle> lb_errors;
|
||||
lb_errors.push_back(parse_error);
|
||||
error_list.push_back(GRPC_ERROR_CREATE_FROM_VECTOR(
|
||||
"field:loadBalancingConfig", &lb_errors));
|
||||
|
|
@ -136,7 +137,7 @@ ClientChannelServiceConfigParser::ParseGlobalParams(
|
|||
absl::optional<std::string> health_check_service_name;
|
||||
it = json.object_value().find("healthCheckConfig");
|
||||
if (it != json.object_value().end()) {
|
||||
grpc_error* parsing_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle parsing_error = GRPC_ERROR_NONE;
|
||||
health_check_service_name =
|
||||
ParseHealthCheckConfig(it->second, &parsing_error);
|
||||
if (parsing_error != GRPC_ERROR_NONE) {
|
||||
|
|
@ -155,9 +156,10 @@ ClientChannelServiceConfigParser::ParseGlobalParams(
|
|||
|
||||
std::unique_ptr<ServiceConfigParser::ParsedConfig>
|
||||
ClientChannelServiceConfigParser::ParsePerMethodParams(
|
||||
const grpc_channel_args* /*args*/, const Json& json, grpc_error** error) {
|
||||
const grpc_channel_args* /*args*/, const Json& json,
|
||||
grpc_error_handle* error) {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
// Parse waitForReady.
|
||||
absl::optional<bool> wait_for_ready;
|
||||
auto it = json.object_value().find("waitForReady");
|
||||
|
|
|
|||
|
|
@ -83,11 +83,11 @@ class ClientChannelServiceConfigParser : public ServiceConfigParser::Parser {
|
|||
public:
|
||||
std::unique_ptr<ServiceConfigParser::ParsedConfig> ParseGlobalParams(
|
||||
const grpc_channel_args* /*args*/, const Json& json,
|
||||
grpc_error** error) override;
|
||||
grpc_error_handle* error) override;
|
||||
|
||||
std::unique_ptr<ServiceConfigParser::ParsedConfig> ParsePerMethodParams(
|
||||
const grpc_channel_args* /*args*/, const Json& json,
|
||||
grpc_error** error) override;
|
||||
grpc_error_handle* error) override;
|
||||
|
||||
static size_t ParserIndex();
|
||||
static void Register();
|
||||
|
|
|
|||
|
|
@ -119,11 +119,11 @@ class RetryFilter {
|
|||
public:
|
||||
class CallData;
|
||||
|
||||
static grpc_error* Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
static grpc_error_handle Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
GPR_ASSERT(args->is_last);
|
||||
GPR_ASSERT(elem->filter == &kRetryFilterVtable);
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
new (elem->channel_data) RetryFilter(args->channel_args, &error);
|
||||
return error;
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ class RetryFilter {
|
|||
{DEFAULT_PER_RPC_RETRY_BUFFER_SIZE, 0, INT_MAX}));
|
||||
}
|
||||
|
||||
RetryFilter(const grpc_channel_args* args, grpc_error** error)
|
||||
RetryFilter(const grpc_channel_args* args, grpc_error_handle* error)
|
||||
: client_channel_(grpc_channel_args_find_pointer<ClientChannel>(
|
||||
args, GRPC_ARG_CLIENT_CHANNEL)),
|
||||
per_rpc_retry_buffer_size_(GetMaxPerRpcRetryBufferSize(args)) {
|
||||
|
|
@ -190,8 +190,8 @@ class RetryFilter {
|
|||
|
||||
class RetryFilter::CallData {
|
||||
public:
|
||||
static grpc_error* Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args);
|
||||
static grpc_error_handle Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args);
|
||||
static void Destroy(grpc_call_element* elem,
|
||||
const grpc_call_final_info* /*final_info*/,
|
||||
grpc_closure* then_schedule_closure);
|
||||
|
|
@ -268,20 +268,20 @@ class RetryFilter::CallData {
|
|||
|
||||
// Invokes recv_initial_metadata_ready for a batch.
|
||||
static void InvokeRecvInitialMetadataCallback(void* arg,
|
||||
grpc_error* error);
|
||||
grpc_error_handle error);
|
||||
// Intercepts recv_initial_metadata_ready callback for retries.
|
||||
// Commits the call and returns the initial metadata up the stack.
|
||||
static void RecvInitialMetadataReady(void* arg, grpc_error* error);
|
||||
static void RecvInitialMetadataReady(void* arg, grpc_error_handle error);
|
||||
|
||||
// Invokes recv_message_ready for a batch.
|
||||
static void InvokeRecvMessageCallback(void* arg, grpc_error* error);
|
||||
static void InvokeRecvMessageCallback(void* arg, grpc_error_handle error);
|
||||
// Intercepts recv_message_ready callback for retries.
|
||||
// Commits the call and returns the message up the stack.
|
||||
static void RecvMessageReady(void* arg, grpc_error* error);
|
||||
static void RecvMessageReady(void* arg, grpc_error_handle error);
|
||||
|
||||
// Adds recv_trailing_metadata_ready closure to closures.
|
||||
void AddClosureForRecvTrailingMetadataReady(
|
||||
grpc_error* error, CallCombinerClosureList* closures);
|
||||
grpc_error_handle error, CallCombinerClosureList* closures);
|
||||
// Adds any necessary closures for deferred recv_initial_metadata and
|
||||
// recv_message callbacks to closures.
|
||||
void AddClosuresForDeferredRecvCallbacks(
|
||||
|
|
@ -289,17 +289,17 @@ class RetryFilter::CallData {
|
|||
// For any pending batch containing an op that has not yet been started,
|
||||
// adds the pending batch's completion closures to closures.
|
||||
void AddClosuresToFailUnstartedPendingBatches(
|
||||
grpc_error* error, CallCombinerClosureList* closures);
|
||||
grpc_error_handle error, CallCombinerClosureList* closures);
|
||||
// Runs necessary closures upon completion of a call attempt.
|
||||
void RunClosuresForCompletedCall(grpc_error* error);
|
||||
void RunClosuresForCompletedCall(grpc_error_handle error);
|
||||
// Intercepts recv_trailing_metadata_ready callback for retries.
|
||||
// Commits the call and returns the trailing metadata up the stack.
|
||||
static void RecvTrailingMetadataReady(void* arg, grpc_error* error);
|
||||
static void RecvTrailingMetadataReady(void* arg, grpc_error_handle error);
|
||||
|
||||
// Adds the on_complete closure for the pending batch completed in
|
||||
// batch_data to closures.
|
||||
void AddClosuresForCompletedPendingBatch(
|
||||
grpc_error* error, CallCombinerClosureList* closures);
|
||||
grpc_error_handle error, CallCombinerClosureList* closures);
|
||||
|
||||
// If there are any cached ops to replay or pending ops to start on the
|
||||
// LB call, adds them to closures.
|
||||
|
|
@ -307,7 +307,7 @@ class RetryFilter::CallData {
|
|||
CallCombinerClosureList* closures);
|
||||
|
||||
// Callback used to intercept on_complete from LB calls.
|
||||
static void OnComplete(void* arg, grpc_error* error);
|
||||
static void OnComplete(void* arg, grpc_error_handle error);
|
||||
|
||||
RefCountedPtr<CallAttempt> call_attempt_;
|
||||
// The batch to use in the LB call.
|
||||
|
|
@ -390,9 +390,9 @@ class RetryFilter::CallData {
|
|||
bool completed_recv_trailing_metadata_ : 1;
|
||||
// State for callback processing.
|
||||
BatchData* recv_initial_metadata_ready_deferred_batch_ = nullptr;
|
||||
grpc_error* recv_initial_metadata_error_ = GRPC_ERROR_NONE;
|
||||
grpc_error_handle recv_initial_metadata_error_ = GRPC_ERROR_NONE;
|
||||
BatchData* recv_message_ready_deferred_batch_ = nullptr;
|
||||
grpc_error* recv_message_error_ = GRPC_ERROR_NONE;
|
||||
grpc_error_handle recv_message_error_ = GRPC_ERROR_NONE;
|
||||
BatchData* recv_trailing_metadata_internal_batch_ = nullptr;
|
||||
// NOTE: Do not move this next to the metadata bitfields above. That would
|
||||
// save space but will also result in a data race because compiler
|
||||
|
|
@ -411,9 +411,10 @@ class RetryFilter::CallData {
|
|||
PendingBatch* PendingBatchesAdd(grpc_transport_stream_op_batch* batch);
|
||||
void PendingBatchClear(PendingBatch* pending);
|
||||
void MaybeClearPendingBatch(PendingBatch* pending);
|
||||
static void FailPendingBatchInCallCombiner(void* arg, grpc_error* error);
|
||||
static void FailPendingBatchInCallCombiner(void* arg,
|
||||
grpc_error_handle error);
|
||||
// Fails all pending batches. Does NOT yield call combiner.
|
||||
void PendingBatchesFail(grpc_error* error);
|
||||
void PendingBatchesFail(grpc_error_handle error);
|
||||
// Returns a pointer to the first pending batch for which predicate(batch)
|
||||
// returns true, or null if not found.
|
||||
template <typename Predicate>
|
||||
|
|
@ -433,7 +434,7 @@ class RetryFilter::CallData {
|
|||
|
||||
// Starts a retry after appropriate back-off.
|
||||
void DoRetry(grpc_millis server_pushback_ms);
|
||||
static void OnRetryTimer(void* arg, grpc_error* error);
|
||||
static void OnRetryTimer(void* arg, grpc_error_handle error);
|
||||
|
||||
RefCountedPtr<ClientChannel::LoadBalancedCall> CreateLoadBalancedCall();
|
||||
|
||||
|
|
@ -572,7 +573,8 @@ class RetryFilter::CallData::CallStackDestructionBarrier
|
|||
}
|
||||
|
||||
private:
|
||||
static void OnLbCallDestructionComplete(void* arg, grpc_error* /*error*/) {
|
||||
static void OnLbCallDestructionComplete(void* arg,
|
||||
grpc_error_handle /*error*/) {
|
||||
auto* self = static_cast<CallStackDestructionBarrier*>(arg);
|
||||
self->Unref();
|
||||
}
|
||||
|
|
@ -593,7 +595,7 @@ class RetryFilter::CallData::Canceller {
|
|||
}
|
||||
|
||||
private:
|
||||
static void Cancel(void* arg, grpc_error* error) {
|
||||
static void Cancel(void* arg, grpc_error_handle error) {
|
||||
auto* self = static_cast<Canceller*>(arg);
|
||||
auto* calld = self->calld_;
|
||||
{
|
||||
|
|
@ -1065,7 +1067,7 @@ bool RetryFilter::CallData::CallAttempt::BatchData::MaybeRetry(
|
|||
//
|
||||
|
||||
void RetryFilter::CallData::CallAttempt::BatchData::
|
||||
InvokeRecvInitialMetadataCallback(void* arg, grpc_error* error) {
|
||||
InvokeRecvInitialMetadataCallback(void* arg, grpc_error_handle error) {
|
||||
auto* batch_data = static_cast<CallAttempt::BatchData*>(arg);
|
||||
auto* call_attempt = batch_data->call_attempt_.get();
|
||||
// Find pending batch.
|
||||
|
|
@ -1097,7 +1099,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::
|
|||
}
|
||||
|
||||
void RetryFilter::CallData::CallAttempt::BatchData::RecvInitialMetadataReady(
|
||||
void* arg, grpc_error* error) {
|
||||
void* arg, grpc_error_handle error) {
|
||||
CallAttempt::BatchData* batch_data =
|
||||
static_cast<CallAttempt::BatchData*>(arg);
|
||||
CallAttempt* call_attempt = batch_data->call_attempt_.get();
|
||||
|
|
@ -1156,7 +1158,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::RecvInitialMetadataReady(
|
|||
//
|
||||
|
||||
void RetryFilter::CallData::CallAttempt::BatchData::InvokeRecvMessageCallback(
|
||||
void* arg, grpc_error* error) {
|
||||
void* arg, grpc_error_handle error) {
|
||||
CallAttempt::BatchData* batch_data =
|
||||
static_cast<CallAttempt::BatchData*>(arg);
|
||||
CallAttempt* call_attempt = batch_data->call_attempt_.get();
|
||||
|
|
@ -1185,7 +1187,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::InvokeRecvMessageCallback(
|
|||
}
|
||||
|
||||
void RetryFilter::CallData::CallAttempt::BatchData::RecvMessageReady(
|
||||
void* arg, grpc_error* error) {
|
||||
void* arg, grpc_error_handle error) {
|
||||
CallAttempt::BatchData* batch_data =
|
||||
static_cast<CallAttempt::BatchData*>(arg);
|
||||
CallAttempt* call_attempt = batch_data->call_attempt_.get();
|
||||
|
|
@ -1245,7 +1247,7 @@ namespace {
|
|||
// Sets *status, *server_pushback_md, and *is_lb_drop based on md_batch
|
||||
// and error.
|
||||
void GetCallStatus(grpc_millis deadline, grpc_metadata_batch* md_batch,
|
||||
grpc_error* error, grpc_status_code* status,
|
||||
grpc_error_handle error, grpc_status_code* status,
|
||||
grpc_mdelem** server_pushback_md, bool* is_lb_drop) {
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
grpc_error_get_status(error, deadline, status, nullptr, nullptr, nullptr);
|
||||
|
|
@ -1268,7 +1270,7 @@ void GetCallStatus(grpc_millis deadline, grpc_metadata_batch* md_batch,
|
|||
} // namespace
|
||||
|
||||
void RetryFilter::CallData::CallAttempt::BatchData::
|
||||
AddClosureForRecvTrailingMetadataReady(grpc_error* error,
|
||||
AddClosureForRecvTrailingMetadataReady(grpc_error_handle error,
|
||||
CallCombinerClosureList* closures) {
|
||||
auto* calld = call_attempt_->calld_;
|
||||
// Find pending batch.
|
||||
|
|
@ -1333,7 +1335,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::
|
|||
|
||||
void RetryFilter::CallData::CallAttempt::BatchData::
|
||||
AddClosuresToFailUnstartedPendingBatches(
|
||||
grpc_error* error, CallCombinerClosureList* closures) {
|
||||
grpc_error_handle error, CallCombinerClosureList* closures) {
|
||||
auto* calld = call_attempt_->calld_;
|
||||
for (size_t i = 0; i < GPR_ARRAY_SIZE(calld->pending_batches_); ++i) {
|
||||
PendingBatch* pending = &calld->pending_batches_[i];
|
||||
|
|
@ -1354,7 +1356,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::
|
|||
}
|
||||
|
||||
void RetryFilter::CallData::CallAttempt::BatchData::RunClosuresForCompletedCall(
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
// Construct list of closures to execute.
|
||||
CallCombinerClosureList closures;
|
||||
// First, add closure for recv_trailing_metadata_ready.
|
||||
|
|
@ -1373,7 +1375,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::RunClosuresForCompletedCall(
|
|||
}
|
||||
|
||||
void RetryFilter::CallData::CallAttempt::BatchData::RecvTrailingMetadataReady(
|
||||
void* arg, grpc_error* error) {
|
||||
void* arg, grpc_error_handle error) {
|
||||
CallAttempt::BatchData* batch_data =
|
||||
static_cast<CallAttempt::BatchData*>(arg);
|
||||
CallAttempt* call_attempt = batch_data->call_attempt_.get();
|
||||
|
|
@ -1423,7 +1425,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::RecvTrailingMetadataReady(
|
|||
//
|
||||
|
||||
void RetryFilter::CallData::CallAttempt::BatchData::
|
||||
AddClosuresForCompletedPendingBatch(grpc_error* error,
|
||||
AddClosuresForCompletedPendingBatch(grpc_error_handle error,
|
||||
CallCombinerClosureList* closures) {
|
||||
auto* calld = call_attempt_->calld_;
|
||||
PendingBatch* pending = calld->PendingBatchFind(
|
||||
|
|
@ -1482,7 +1484,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::
|
|||
}
|
||||
|
||||
void RetryFilter::CallData::CallAttempt::BatchData::OnComplete(
|
||||
void* arg, grpc_error* error) {
|
||||
void* arg, grpc_error_handle error) {
|
||||
CallAttempt::BatchData* batch_data =
|
||||
static_cast<CallAttempt::BatchData*>(arg);
|
||||
CallAttempt* call_attempt = batch_data->call_attempt_.get();
|
||||
|
|
@ -1571,7 +1573,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::
|
|||
grpc_mdelem retry_md = grpc_mdelem_create(
|
||||
GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS,
|
||||
*retry_count_strings[calld->num_attempts_completed_ - 1], nullptr);
|
||||
grpc_error* error = grpc_metadata_batch_add_tail(
|
||||
grpc_error_handle error = grpc_metadata_batch_add_tail(
|
||||
&call_attempt_->send_initial_metadata_,
|
||||
&call_attempt_->send_initial_metadata_storage_
|
||||
[calld->send_initial_metadata_.list.count],
|
||||
|
|
@ -1672,8 +1674,8 @@ void RetryFilter::CallData::CallAttempt::BatchData::
|
|||
// CallData vtable functions
|
||||
//
|
||||
|
||||
grpc_error* RetryFilter::CallData::Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
grpc_error_handle RetryFilter::CallData::Init(
|
||||
grpc_call_element* elem, const grpc_call_element_args* args) {
|
||||
auto* chand = static_cast<RetryFilter*>(elem->channel_data);
|
||||
new (elem->call_data) CallData(chand, *args);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
|
||||
|
|
@ -1775,7 +1777,7 @@ void RetryFilter::CallData::StartTransportStreamOpBatch(
|
|||
}
|
||||
// Handle cancellation.
|
||||
if (GPR_UNLIKELY(batch->cancel_stream)) {
|
||||
grpc_error* cancel_error = batch->payload->cancel_stream.cancel_error;
|
||||
grpc_error_handle cancel_error = batch->payload->cancel_stream.cancel_error;
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
|
||||
gpr_log(GPR_INFO, "chand=%p calld=%p: cancelled from surface: %s", chand_,
|
||||
this, grpc_error_string(cancel_error));
|
||||
|
|
@ -1854,7 +1856,7 @@ void RetryFilter::CallData::CreateCallAttempt() {
|
|||
|
||||
namespace {
|
||||
|
||||
void StartBatchInCallCombiner(void* arg, grpc_error* /*ignored*/) {
|
||||
void StartBatchInCallCombiner(void* arg, grpc_error_handle /*ignored*/) {
|
||||
grpc_transport_stream_op_batch* batch =
|
||||
static_cast<grpc_transport_stream_op_batch*>(arg);
|
||||
auto* lb_call = static_cast<ClientChannel::LoadBalancedCall*>(
|
||||
|
|
@ -2050,8 +2052,8 @@ void RetryFilter::CallData::MaybeClearPendingBatch(PendingBatch* pending) {
|
|||
}
|
||||
|
||||
// This is called via the call combiner, so access to calld is synchronized.
|
||||
void RetryFilter::CallData::FailPendingBatchInCallCombiner(void* arg,
|
||||
grpc_error* error) {
|
||||
void RetryFilter::CallData::FailPendingBatchInCallCombiner(
|
||||
void* arg, grpc_error_handle error) {
|
||||
grpc_transport_stream_op_batch* batch =
|
||||
static_cast<grpc_transport_stream_op_batch*>(arg);
|
||||
CallData* call = static_cast<CallData*>(batch->handler_private.extra_arg);
|
||||
|
|
@ -2061,7 +2063,7 @@ void RetryFilter::CallData::FailPendingBatchInCallCombiner(void* arg,
|
|||
}
|
||||
|
||||
// This is called via the call combiner, so access to calld is synchronized.
|
||||
void RetryFilter::CallData::PendingBatchesFail(grpc_error* error) {
|
||||
void RetryFilter::CallData::PendingBatchesFail(grpc_error_handle error) {
|
||||
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace)) {
|
||||
size_t num_batches = 0;
|
||||
|
|
@ -2150,7 +2152,7 @@ void RetryFilter::CallData::DoRetry(grpc_millis server_pushback_ms) {
|
|||
grpc_timer_init(&retry_timer_, next_attempt_time, &retry_closure_);
|
||||
}
|
||||
|
||||
void RetryFilter::CallData::OnRetryTimer(void* arg, grpc_error* error) {
|
||||
void RetryFilter::CallData::OnRetryTimer(void* arg, grpc_error_handle error) {
|
||||
auto* calld = static_cast<CallData*>(arg);
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
bool start_attempt = false;
|
||||
|
|
|
|||
|
|
@ -60,13 +60,14 @@ void RetryServiceConfigParser::Register() {
|
|||
|
||||
namespace {
|
||||
|
||||
grpc_error* ParseRetryThrottling(const Json& json, intptr_t* max_milli_tokens,
|
||||
intptr_t* milli_token_ratio) {
|
||||
grpc_error_handle ParseRetryThrottling(const Json& json,
|
||||
intptr_t* max_milli_tokens,
|
||||
intptr_t* milli_token_ratio) {
|
||||
if (json.type() != Json::Type::OBJECT) {
|
||||
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"field:retryThrottling error:Type should be object");
|
||||
}
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
// Parse maxTokens.
|
||||
auto it = json.object_value().find("maxTokens");
|
||||
if (it == json.object_value().end()) {
|
||||
|
|
@ -142,7 +143,7 @@ grpc_error* ParseRetryThrottling(const Json& json, intptr_t* max_milli_tokens,
|
|||
std::unique_ptr<ServiceConfigParser::ParsedConfig>
|
||||
RetryServiceConfigParser::ParseGlobalParams(const grpc_channel_args* /*args*/,
|
||||
const Json& json,
|
||||
grpc_error** error) {
|
||||
grpc_error_handle* error) {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
auto it = json.object_value().find("retryThrottling");
|
||||
if (it == json.object_value().end()) return nullptr;
|
||||
|
|
@ -157,16 +158,16 @@ RetryServiceConfigParser::ParseGlobalParams(const grpc_channel_args* /*args*/,
|
|||
|
||||
namespace {
|
||||
|
||||
grpc_error* ParseRetryPolicy(const Json& json, int* max_attempts,
|
||||
grpc_millis* initial_backoff,
|
||||
grpc_millis* max_backoff,
|
||||
float* backoff_multiplier,
|
||||
StatusCodeSet* retryable_status_codes) {
|
||||
grpc_error_handle ParseRetryPolicy(const Json& json, int* max_attempts,
|
||||
grpc_millis* initial_backoff,
|
||||
grpc_millis* max_backoff,
|
||||
float* backoff_multiplier,
|
||||
StatusCodeSet* retryable_status_codes) {
|
||||
if (json.type() != Json::Type::OBJECT) {
|
||||
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"field:retryPolicy error:should be of type object");
|
||||
}
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
// Parse maxAttempts.
|
||||
auto it = json.object_value().find("maxAttempts");
|
||||
if (it != json.object_value().end()) {
|
||||
|
|
@ -262,7 +263,8 @@ grpc_error* ParseRetryPolicy(const Json& json, int* max_attempts,
|
|||
|
||||
std::unique_ptr<ServiceConfigParser::ParsedConfig>
|
||||
RetryServiceConfigParser::ParsePerMethodParams(
|
||||
const grpc_channel_args* /*args*/, const Json& json, grpc_error** error) {
|
||||
const grpc_channel_args* /*args*/, const Json& json,
|
||||
grpc_error_handle* error) {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
// Parse retry policy.
|
||||
auto it = json.object_value().find("retryPolicy");
|
||||
|
|
|
|||
|
|
@ -74,11 +74,11 @@ class RetryServiceConfigParser : public ServiceConfigParser::Parser {
|
|||
public:
|
||||
std::unique_ptr<ServiceConfigParser::ParsedConfig> ParseGlobalParams(
|
||||
const grpc_channel_args* /*args*/, const Json& json,
|
||||
grpc_error** error) override;
|
||||
grpc_error_handle* error) override;
|
||||
|
||||
std::unique_ptr<ServiceConfigParser::ParsedConfig> ParsePerMethodParams(
|
||||
const grpc_channel_args* /*args*/, const Json& json,
|
||||
grpc_error** error) override;
|
||||
grpc_error_handle* error) override;
|
||||
|
||||
static size_t ParserIndex();
|
||||
static void Register();
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace grpc_core {
|
|||
|
||||
RefCountedPtr<ServiceConfig> ServiceConfig::Create(
|
||||
const grpc_channel_args* args, absl::string_view json_string,
|
||||
grpc_error** error) {
|
||||
grpc_error_handle* error) {
|
||||
GPR_DEBUG_ASSERT(error != nullptr);
|
||||
Json json = Json::Parse(json_string, error);
|
||||
if (*error != GRPC_ERROR_NONE) return nullptr;
|
||||
|
|
@ -42,7 +42,7 @@ RefCountedPtr<ServiceConfig> ServiceConfig::Create(
|
|||
|
||||
ServiceConfig::ServiceConfig(const grpc_channel_args* args,
|
||||
std::string json_string, Json json,
|
||||
grpc_error** error)
|
||||
grpc_error_handle* error)
|
||||
: json_string_(std::move(json_string)), json_(std::move(json)) {
|
||||
GPR_DEBUG_ASSERT(error != nullptr);
|
||||
if (json_.type() != Json::Type::OBJECT) {
|
||||
|
|
@ -50,12 +50,12 @@ ServiceConfig::ServiceConfig(const grpc_channel_args* args,
|
|||
GRPC_ERROR_CREATE_FROM_STATIC_STRING("JSON value is not an object");
|
||||
return;
|
||||
}
|
||||
std::vector<grpc_error*> error_list;
|
||||
grpc_error* global_error = GRPC_ERROR_NONE;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
grpc_error_handle global_error = GRPC_ERROR_NONE;
|
||||
parsed_global_configs_ =
|
||||
ServiceConfigParser::ParseGlobalParameters(args, json_, &global_error);
|
||||
if (global_error != GRPC_ERROR_NONE) error_list.push_back(global_error);
|
||||
grpc_error* local_error = ParsePerMethodParams(args);
|
||||
grpc_error_handle local_error = ParsePerMethodParams(args);
|
||||
if (local_error != GRPC_ERROR_NONE) error_list.push_back(local_error);
|
||||
if (!error_list.empty()) {
|
||||
*error = GRPC_ERROR_CREATE_FROM_VECTOR("Service config parsing error",
|
||||
|
|
@ -69,13 +69,13 @@ ServiceConfig::~ServiceConfig() {
|
|||
}
|
||||
}
|
||||
|
||||
grpc_error* ServiceConfig::ParseJsonMethodConfig(const grpc_channel_args* args,
|
||||
const Json& json) {
|
||||
std::vector<grpc_error*> error_list;
|
||||
grpc_error_handle ServiceConfig::ParseJsonMethodConfig(
|
||||
const grpc_channel_args* args, const Json& json) {
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
// Parse method config with each registered parser.
|
||||
auto parsed_configs =
|
||||
absl::make_unique<ServiceConfigParser::ParsedConfigVector>();
|
||||
grpc_error* parser_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle parser_error = GRPC_ERROR_NONE;
|
||||
*parsed_configs =
|
||||
ServiceConfigParser::ParsePerMethodParameters(args, json, &parser_error);
|
||||
if (parser_error != GRPC_ERROR_NONE) {
|
||||
|
|
@ -94,7 +94,7 @@ grpc_error* ServiceConfig::ParseJsonMethodConfig(const grpc_channel_args* args,
|
|||
}
|
||||
const Json::Array& name_array = it->second.array_value();
|
||||
for (const Json& name : name_array) {
|
||||
grpc_error* parse_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle parse_error = GRPC_ERROR_NONE;
|
||||
std::string path = ParseJsonMethodName(name, &parse_error);
|
||||
if (parse_error != GRPC_ERROR_NONE) {
|
||||
error_list.push_back(parse_error);
|
||||
|
|
@ -130,8 +130,9 @@ grpc_error* ServiceConfig::ParseJsonMethodConfig(const grpc_channel_args* args,
|
|||
return GRPC_ERROR_CREATE_FROM_VECTOR("methodConfig", &error_list);
|
||||
}
|
||||
|
||||
grpc_error* ServiceConfig::ParsePerMethodParams(const grpc_channel_args* args) {
|
||||
std::vector<grpc_error*> error_list;
|
||||
grpc_error_handle ServiceConfig::ParsePerMethodParams(
|
||||
const grpc_channel_args* args) {
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
auto it = json_.object_value().find("methodConfig");
|
||||
if (it != json_.object_value().end()) {
|
||||
if (it->second.type() != Json::Type::ARRAY) {
|
||||
|
|
@ -144,7 +145,7 @@ grpc_error* ServiceConfig::ParsePerMethodParams(const grpc_channel_args* args) {
|
|||
"field:methodConfig error:not of type Object"));
|
||||
continue;
|
||||
}
|
||||
grpc_error* error = ParseJsonMethodConfig(args, method_config);
|
||||
grpc_error_handle error = ParseJsonMethodConfig(args, method_config);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
error_list.push_back(error);
|
||||
}
|
||||
|
|
@ -154,7 +155,7 @@ grpc_error* ServiceConfig::ParsePerMethodParams(const grpc_channel_args* args) {
|
|||
}
|
||||
|
||||
std::string ServiceConfig::ParseJsonMethodName(const Json& json,
|
||||
grpc_error** error) {
|
||||
grpc_error_handle* error) {
|
||||
if (json.type() != Json::Type::OBJECT) {
|
||||
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"field:name error:type is not object");
|
||||
|
|
|
|||
|
|
@ -67,10 +67,10 @@ class ServiceConfig : public RefCounted<ServiceConfig> {
|
|||
/// Returns null on parse error.
|
||||
static RefCountedPtr<ServiceConfig> Create(const grpc_channel_args* args,
|
||||
absl::string_view json_string,
|
||||
grpc_error** error);
|
||||
grpc_error_handle* error);
|
||||
|
||||
ServiceConfig(const grpc_channel_args* args, std::string json_string,
|
||||
Json json, grpc_error** error);
|
||||
Json json, grpc_error_handle* error);
|
||||
~ServiceConfig() override;
|
||||
|
||||
const std::string& json_string() const { return json_string_; }
|
||||
|
|
@ -91,13 +91,14 @@ class ServiceConfig : public RefCounted<ServiceConfig> {
|
|||
|
||||
private:
|
||||
// Helper functions for parsing the method configs.
|
||||
grpc_error* ParsePerMethodParams(const grpc_channel_args* args);
|
||||
grpc_error* ParseJsonMethodConfig(const grpc_channel_args* args,
|
||||
const Json& json);
|
||||
grpc_error_handle ParsePerMethodParams(const grpc_channel_args* args);
|
||||
grpc_error_handle ParseJsonMethodConfig(const grpc_channel_args* args,
|
||||
const Json& json);
|
||||
|
||||
// Returns a path string for the JSON name object specified by json.
|
||||
// Sets *error on error.
|
||||
static std::string ParseJsonMethodName(const Json& json, grpc_error** error);
|
||||
static std::string ParseJsonMethodName(const Json& json,
|
||||
grpc_error_handle* error);
|
||||
|
||||
std::string json_string_;
|
||||
Json json_;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class ServiceConfigChannelArgChannelData {
|
|||
const char* service_config_str = grpc_channel_args_find_string(
|
||||
args->channel_args, GRPC_ARG_SERVICE_CONFIG);
|
||||
if (service_config_str != nullptr) {
|
||||
grpc_error* service_config_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle service_config_error = GRPC_ERROR_NONE;
|
||||
auto service_config = ServiceConfig::Create(
|
||||
args->channel_args, service_config_str, &service_config_error);
|
||||
if (service_config_error == GRPC_ERROR_NONE) {
|
||||
|
|
@ -73,7 +73,7 @@ class ServiceConfigChannelArgCallData {
|
|||
}
|
||||
};
|
||||
|
||||
grpc_error* ServiceConfigChannelArgInitCallElem(
|
||||
grpc_error_handle ServiceConfigChannelArgInitCallElem(
|
||||
grpc_call_element* elem, const grpc_call_element_args* args) {
|
||||
ServiceConfigChannelArgCallData* calld =
|
||||
static_cast<ServiceConfigChannelArgCallData*>(elem->call_data);
|
||||
|
|
@ -89,7 +89,7 @@ void ServiceConfigChannelArgDestroyCallElem(
|
|||
calld->~ServiceConfigChannelArgCallData();
|
||||
}
|
||||
|
||||
grpc_error* ServiceConfigChannelArgInitChannelElem(
|
||||
grpc_error_handle ServiceConfigChannelArgInitChannelElem(
|
||||
grpc_channel_element* elem, grpc_channel_element_args* args) {
|
||||
ServiceConfigChannelArgChannelData* chand =
|
||||
static_cast<ServiceConfigChannelArgChannelData*>(elem->channel_data);
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ size_t ServiceConfigParser::RegisterParser(std::unique_ptr<Parser> parser) {
|
|||
ServiceConfigParser::ParsedConfigVector
|
||||
ServiceConfigParser::ParseGlobalParameters(const grpc_channel_args* args,
|
||||
const Json& json,
|
||||
grpc_error** error) {
|
||||
grpc_error_handle* error) {
|
||||
ParsedConfigVector parsed_global_configs;
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
for (size_t i = 0; i < g_registered_parsers->size(); i++) {
|
||||
grpc_error* parser_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle parser_error = GRPC_ERROR_NONE;
|
||||
auto parsed_config = (*g_registered_parsers)[i]->ParseGlobalParams(
|
||||
args, json, &parser_error);
|
||||
if (parser_error != GRPC_ERROR_NONE) {
|
||||
|
|
@ -68,11 +68,11 @@ ServiceConfigParser::ParseGlobalParameters(const grpc_channel_args* args,
|
|||
ServiceConfigParser::ParsedConfigVector
|
||||
ServiceConfigParser::ParsePerMethodParameters(const grpc_channel_args* args,
|
||||
const Json& json,
|
||||
grpc_error** error) {
|
||||
grpc_error_handle* error) {
|
||||
ParsedConfigVector parsed_method_configs;
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
for (size_t i = 0; i < g_registered_parsers->size(); i++) {
|
||||
grpc_error* parser_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle parser_error = GRPC_ERROR_NONE;
|
||||
auto parsed_config = (*g_registered_parsers)[i]->ParsePerMethodParams(
|
||||
args, json, &parser_error);
|
||||
if (parser_error != GRPC_ERROR_NONE) {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ class ServiceConfigParser {
|
|||
virtual ~Parser() = default;
|
||||
|
||||
virtual std::unique_ptr<ParsedConfig> ParseGlobalParams(
|
||||
const grpc_channel_args*, const Json& /* json */, grpc_error** error) {
|
||||
const grpc_channel_args*, const Json& /* json */,
|
||||
grpc_error_handle* error) {
|
||||
// Avoid unused parameter warning on debug-only parameter
|
||||
(void)error;
|
||||
GPR_DEBUG_ASSERT(error != nullptr);
|
||||
|
|
@ -55,7 +56,8 @@ class ServiceConfigParser {
|
|||
}
|
||||
|
||||
virtual std::unique_ptr<ParsedConfig> ParsePerMethodParams(
|
||||
const grpc_channel_args*, const Json& /* json */, grpc_error** error) {
|
||||
const grpc_channel_args*, const Json& /* json */,
|
||||
grpc_error_handle* error) {
|
||||
// Avoid unused parameter warning on debug-only parameter
|
||||
(void)error;
|
||||
GPR_DEBUG_ASSERT(error != nullptr);
|
||||
|
|
@ -81,10 +83,11 @@ class ServiceConfigParser {
|
|||
|
||||
static ParsedConfigVector ParseGlobalParameters(const grpc_channel_args* args,
|
||||
const Json& json,
|
||||
grpc_error** error);
|
||||
grpc_error_handle* error);
|
||||
|
||||
static ParsedConfigVector ParsePerMethodParameters(
|
||||
const grpc_channel_args* args, const Json& json, grpc_error** error);
|
||||
const grpc_channel_args* args, const Json& json,
|
||||
grpc_error_handle* error);
|
||||
};
|
||||
|
||||
} // namespace grpc_core
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ size_t ConnectedSubchannel::GetInitialCallSizeEstimate() const {
|
|||
//
|
||||
|
||||
RefCountedPtr<SubchannelCall> SubchannelCall::Create(Args args,
|
||||
grpc_error** error) {
|
||||
grpc_error_handle* error) {
|
||||
const size_t allocation_size =
|
||||
args.connected_subchannel->GetInitialCallSizeEstimate();
|
||||
Arena* arena = args.arena;
|
||||
|
|
@ -139,7 +139,7 @@ RefCountedPtr<SubchannelCall> SubchannelCall::Create(Args args,
|
|||
arena->Alloc(allocation_size)) SubchannelCall(std::move(args), error));
|
||||
}
|
||||
|
||||
SubchannelCall::SubchannelCall(Args args, grpc_error** error)
|
||||
SubchannelCall::SubchannelCall(Args args, grpc_error_handle* error)
|
||||
: connected_subchannel_(std::move(args.connected_subchannel)),
|
||||
deadline_(args.deadline) {
|
||||
grpc_call_stack* callstk = SUBCHANNEL_CALL_TO_CALL_STACK(this);
|
||||
|
|
@ -207,7 +207,7 @@ void SubchannelCall::Unref(const DebugLocation& /*location*/,
|
|||
GRPC_CALL_STACK_UNREF(SUBCHANNEL_CALL_TO_CALL_STACK(this), reason);
|
||||
}
|
||||
|
||||
void SubchannelCall::Destroy(void* arg, grpc_error* /*error*/) {
|
||||
void SubchannelCall::Destroy(void* arg, grpc_error_handle /*error*/) {
|
||||
GPR_TIMER_SCOPE("subchannel_call_destroy", 0);
|
||||
SubchannelCall* self = static_cast<SubchannelCall*>(arg);
|
||||
// Keep some members before destroying the subchannel call.
|
||||
|
|
@ -252,7 +252,7 @@ namespace {
|
|||
|
||||
// Sets *status based on the rest of the parameters.
|
||||
void GetCallStatus(grpc_status_code* status, grpc_millis deadline,
|
||||
grpc_metadata_batch* md_batch, grpc_error* error) {
|
||||
grpc_metadata_batch* md_batch, grpc_error_handle error) {
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
grpc_error_get_status(error, deadline, status, nullptr, nullptr, nullptr);
|
||||
} else {
|
||||
|
|
@ -268,7 +268,8 @@ void GetCallStatus(grpc_status_code* status, grpc_millis deadline,
|
|||
|
||||
} // namespace
|
||||
|
||||
void SubchannelCall::RecvTrailingMetadataReady(void* arg, grpc_error* error) {
|
||||
void SubchannelCall::RecvTrailingMetadataReady(void* arg,
|
||||
grpc_error_handle error) {
|
||||
SubchannelCall* call = static_cast<SubchannelCall*>(arg);
|
||||
GPR_ASSERT(call->recv_trailing_metadata_ != nullptr);
|
||||
grpc_status_code status = GRPC_STATUS_OK;
|
||||
|
|
@ -375,7 +376,7 @@ class Subchannel::AsyncWatcherNotifierLocked {
|
|||
ExecCtx::Run(DEBUG_LOCATION,
|
||||
GRPC_CLOSURE_INIT(
|
||||
&closure_,
|
||||
[](void* arg, grpc_error* /*error*/) {
|
||||
[](void* arg, grpc_error_handle /*error*/) {
|
||||
auto* self =
|
||||
static_cast<AsyncWatcherNotifierLocked*>(arg);
|
||||
self->watcher_->OnConnectivityStateChange();
|
||||
|
|
@ -963,7 +964,7 @@ void Subchannel::MaybeStartConnectingLocked() {
|
|||
}
|
||||
}
|
||||
|
||||
void Subchannel::OnRetryAlarm(void* arg, grpc_error* error) {
|
||||
void Subchannel::OnRetryAlarm(void* arg, grpc_error_handle error) {
|
||||
WeakRefCountedPtr<Subchannel> c(static_cast<Subchannel*>(arg));
|
||||
MutexLock lock(&c->mu_);
|
||||
c->have_retry_alarm_ = false;
|
||||
|
|
@ -998,7 +999,7 @@ void Subchannel::ContinueConnectingLocked() {
|
|||
connector_->Connect(args, &connecting_result_, &on_connecting_finished_);
|
||||
}
|
||||
|
||||
void Subchannel::OnConnectingFinished(void* arg, grpc_error* error) {
|
||||
void Subchannel::OnConnectingFinished(void* arg, grpc_error_handle error) {
|
||||
WeakRefCountedPtr<Subchannel> c(static_cast<Subchannel*>(arg));
|
||||
const grpc_channel_args* delete_channel_args =
|
||||
c->connecting_result_.channel_args;
|
||||
|
|
@ -1020,7 +1021,7 @@ void Subchannel::OnConnectingFinished(void* arg, grpc_error* error) {
|
|||
|
||||
namespace {
|
||||
|
||||
void ConnectionDestroy(void* arg, grpc_error* /*error*/) {
|
||||
void ConnectionDestroy(void* arg, grpc_error_handle /*error*/) {
|
||||
grpc_channel_stack* stk = static_cast<grpc_channel_stack*>(arg);
|
||||
grpc_channel_stack_destroy(stk);
|
||||
gpr_free(stk);
|
||||
|
|
@ -1040,7 +1041,7 @@ bool Subchannel::PublishTransportLocked() {
|
|||
return false;
|
||||
}
|
||||
grpc_channel_stack* stk;
|
||||
grpc_error* error = grpc_channel_stack_builder_finish(
|
||||
grpc_error_handle error = grpc_channel_stack_builder_finish(
|
||||
builder, 0, 1, ConnectionDestroy, nullptr,
|
||||
reinterpret_cast<void**>(&stk));
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,8 @@ class SubchannelCall {
|
|||
grpc_call_context_element* context;
|
||||
CallCombiner* call_combiner;
|
||||
};
|
||||
static RefCountedPtr<SubchannelCall> Create(Args args, grpc_error** error);
|
||||
static RefCountedPtr<SubchannelCall> Create(Args args,
|
||||
grpc_error_handle* error);
|
||||
|
||||
// Continues processing a transport stream op batch.
|
||||
void StartTransportStreamOpBatch(grpc_transport_stream_op_batch* batch);
|
||||
|
|
@ -113,20 +114,20 @@ class SubchannelCall {
|
|||
template <typename T>
|
||||
friend class RefCountedPtr;
|
||||
|
||||
SubchannelCall(Args args, grpc_error** error);
|
||||
SubchannelCall(Args args, grpc_error_handle* error);
|
||||
|
||||
// If channelz is enabled, intercepts recv_trailing so that we may check the
|
||||
// status and associate it to a subchannel.
|
||||
void MaybeInterceptRecvTrailingMetadata(
|
||||
grpc_transport_stream_op_batch* batch);
|
||||
|
||||
static void RecvTrailingMetadataReady(void* arg, grpc_error* error);
|
||||
static void RecvTrailingMetadataReady(void* arg, grpc_error_handle error);
|
||||
|
||||
// Interface of RefCounted<>.
|
||||
void IncrementRefCount();
|
||||
void IncrementRefCount(const DebugLocation& location, const char* reason);
|
||||
|
||||
static void Destroy(void* arg, grpc_error* error);
|
||||
static void Destroy(void* arg, grpc_error_handle error);
|
||||
|
||||
RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
|
||||
grpc_closure* after_call_stack_destroy_ = nullptr;
|
||||
|
|
@ -340,10 +341,10 @@ class Subchannel : public DualRefCounted<Subchannel> {
|
|||
|
||||
// Methods for connection.
|
||||
void MaybeStartConnectingLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
||||
static void OnRetryAlarm(void* arg, grpc_error* error)
|
||||
static void OnRetryAlarm(void* arg, grpc_error_handle error)
|
||||
ABSL_LOCKS_EXCLUDED(mu_);
|
||||
void ContinueConnectingLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
||||
static void OnConnectingFinished(void* arg, grpc_error* error)
|
||||
static void OnConnectingFinished(void* arg, grpc_error_handle error)
|
||||
ABSL_LOCKS_EXCLUDED(mu_);
|
||||
bool PublishTransportLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
||||
|
||||
|
|
|
|||
|
|
@ -126,8 +126,8 @@ grpc_millis GetClientIdleTimeout(const grpc_channel_args* args) {
|
|||
|
||||
class ChannelData {
|
||||
public:
|
||||
static grpc_error* Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args);
|
||||
static grpc_error_handle Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args);
|
||||
static void Destroy(grpc_channel_element* elem);
|
||||
|
||||
static void StartTransportOp(grpc_channel_element* elem,
|
||||
|
|
@ -139,11 +139,12 @@ class ChannelData {
|
|||
|
||||
private:
|
||||
ChannelData(grpc_channel_element* elem, grpc_channel_element_args* args,
|
||||
grpc_error** error);
|
||||
grpc_error_handle* error);
|
||||
~ChannelData() = default;
|
||||
|
||||
static void IdleTimerCallback(void* arg, grpc_error* error);
|
||||
static void IdleTransportOpCompleteCallback(void* arg, grpc_error* error);
|
||||
static void IdleTimerCallback(void* arg, grpc_error_handle error);
|
||||
static void IdleTransportOpCompleteCallback(void* arg,
|
||||
grpc_error_handle error);
|
||||
|
||||
void StartIdleTimer();
|
||||
|
||||
|
|
@ -170,9 +171,9 @@ class ChannelData {
|
|||
grpc_closure idle_transport_op_complete_callback_;
|
||||
};
|
||||
|
||||
grpc_error* ChannelData::Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle ChannelData::Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
new (elem->channel_data) ChannelData(elem, args, &error);
|
||||
return error;
|
||||
}
|
||||
|
|
@ -283,7 +284,7 @@ void ChannelData::DecreaseCallCount() {
|
|||
|
||||
ChannelData::ChannelData(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args,
|
||||
grpc_error** /*error*/)
|
||||
grpc_error_handle* /*error*/)
|
||||
: elem_(elem),
|
||||
channel_stack_(args->channel_stack),
|
||||
client_idle_timeout_(GetClientIdleTimeout(args->channel_args)) {
|
||||
|
|
@ -303,7 +304,7 @@ ChannelData::ChannelData(grpc_channel_element* elem,
|
|||
grpc_schedule_on_exec_ctx);
|
||||
}
|
||||
|
||||
void ChannelData::IdleTimerCallback(void* arg, grpc_error* error) {
|
||||
void ChannelData::IdleTimerCallback(void* arg, grpc_error_handle error) {
|
||||
GRPC_IDLE_FILTER_LOG("timer alarms");
|
||||
ChannelData* chand = static_cast<ChannelData*>(arg);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
|
|
@ -352,7 +353,7 @@ void ChannelData::IdleTimerCallback(void* arg, grpc_error* error) {
|
|||
}
|
||||
|
||||
void ChannelData::IdleTransportOpCompleteCallback(void* arg,
|
||||
grpc_error* /*error*/) {
|
||||
grpc_error_handle /*error*/) {
|
||||
ChannelData* chand = static_cast<ChannelData*>(arg);
|
||||
GRPC_CHANNEL_STACK_UNREF(chand->channel_stack_, "idle transport op");
|
||||
}
|
||||
|
|
@ -381,15 +382,15 @@ void ChannelData::EnterIdle() {
|
|||
|
||||
class CallData {
|
||||
public:
|
||||
static grpc_error* Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args);
|
||||
static grpc_error_handle Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args);
|
||||
static void Destroy(grpc_call_element* elem,
|
||||
const grpc_call_final_info* final_info,
|
||||
grpc_closure* then_schedule_closure);
|
||||
};
|
||||
|
||||
grpc_error* CallData::Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* /*args*/) {
|
||||
grpc_error_handle CallData::Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* /*args*/) {
|
||||
ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
|
||||
chand->IncreaseCallCount();
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class TimerState {
|
|||
private:
|
||||
// The on_complete callback used when sending a cancel_error batch down the
|
||||
// filter stack. Yields the call combiner when the batch returns.
|
||||
static void YieldCallCombiner(void* arg, grpc_error* /*ignored*/) {
|
||||
static void YieldCallCombiner(void* arg, grpc_error_handle /*ignored*/) {
|
||||
TimerState* self = static_cast<TimerState*>(arg);
|
||||
grpc_deadline_state* deadline_state =
|
||||
static_cast<grpc_deadline_state*>(self->elem_->call_data);
|
||||
|
|
@ -62,7 +62,7 @@ class TimerState {
|
|||
|
||||
// This is called via the call combiner, so access to deadline_state is
|
||||
// synchronized.
|
||||
static void SendCancelOpInCallCombiner(void* arg, grpc_error* error) {
|
||||
static void SendCancelOpInCallCombiner(void* arg, grpc_error_handle error) {
|
||||
TimerState* self = static_cast<TimerState*>(arg);
|
||||
grpc_transport_stream_op_batch* batch = grpc_make_transport_stream_op(
|
||||
GRPC_CLOSURE_INIT(&self->closure_, YieldCallCombiner, self, nullptr));
|
||||
|
|
@ -72,7 +72,7 @@ class TimerState {
|
|||
}
|
||||
|
||||
// Timer callback.
|
||||
static void TimerCallback(void* arg, grpc_error* error) {
|
||||
static void TimerCallback(void* arg, grpc_error_handle error) {
|
||||
TimerState* self = static_cast<TimerState*>(arg);
|
||||
grpc_deadline_state* deadline_state =
|
||||
static_cast<grpc_deadline_state*>(self->elem_->call_data);
|
||||
|
|
@ -135,7 +135,7 @@ static void cancel_timer_if_needed(grpc_deadline_state* deadline_state) {
|
|||
}
|
||||
|
||||
// Callback run when we receive trailing metadata.
|
||||
static void recv_trailing_metadata_ready(void* arg, grpc_error* error) {
|
||||
static void recv_trailing_metadata_ready(void* arg, grpc_error_handle error) {
|
||||
grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(arg);
|
||||
cancel_timer_if_needed(deadline_state);
|
||||
// Invoke the original callback.
|
||||
|
|
@ -168,7 +168,7 @@ struct start_timer_after_init_state {
|
|||
grpc_millis deadline;
|
||||
grpc_closure closure;
|
||||
};
|
||||
static void start_timer_after_init(void* arg, grpc_error* error) {
|
||||
static void start_timer_after_init(void* arg, grpc_error_handle error) {
|
||||
struct start_timer_after_init_state* state =
|
||||
static_cast<struct start_timer_after_init_state*>(arg);
|
||||
grpc_deadline_state* deadline_state =
|
||||
|
|
@ -241,8 +241,8 @@ void grpc_deadline_state_client_start_transport_stream_op_batch(
|
|||
//
|
||||
|
||||
// Constructor for channel_data. Used for both client and server filters.
|
||||
static grpc_error* deadline_init_channel_elem(grpc_channel_element* /*elem*/,
|
||||
grpc_channel_element_args* args) {
|
||||
static grpc_error_handle deadline_init_channel_elem(
|
||||
grpc_channel_element* /*elem*/, grpc_channel_element_args* args) {
|
||||
GPR_ASSERT(!args->is_last);
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
|
@ -268,8 +268,8 @@ typedef struct server_call_data {
|
|||
} server_call_data;
|
||||
|
||||
// Constructor for call_data. Used for both client and server filters.
|
||||
static grpc_error* deadline_init_call_elem(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
static grpc_error_handle deadline_init_call_elem(
|
||||
grpc_call_element* elem, const grpc_call_element_args* args) {
|
||||
new (elem->call_data) grpc_deadline_state(elem, *args, args->deadline);
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
|
@ -292,7 +292,7 @@ static void deadline_client_start_transport_stream_op_batch(
|
|||
}
|
||||
|
||||
// Callback for receiving initial metadata on the server.
|
||||
static void recv_initial_metadata_ready(void* arg, grpc_error* error) {
|
||||
static void recv_initial_metadata_ready(void* arg, grpc_error_handle error) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
|
||||
server_call_data* calld = static_cast<server_call_data*>(elem->call_data);
|
||||
start_timer_if_needed(elem, calld->recv_initial_metadata->deadline);
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ inline bool UnderFraction(const uint32_t numerator,
|
|||
|
||||
class ChannelData {
|
||||
public:
|
||||
static grpc_error* Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args);
|
||||
static grpc_error_handle Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args);
|
||||
static void Destroy(grpc_channel_element* elem);
|
||||
|
||||
int index() const { return index_; }
|
||||
|
|
@ -99,8 +99,8 @@ class ChannelData {
|
|||
|
||||
class CallData {
|
||||
public:
|
||||
static grpc_error* Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args);
|
||||
static grpc_error_handle Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args);
|
||||
|
||||
static void Destroy(grpc_call_element* elem,
|
||||
const grpc_call_final_info* /*final_info*/,
|
||||
|
|
@ -129,7 +129,7 @@ class CallData {
|
|||
// GRPC_ERROR_NONE.
|
||||
// If this call is already been delay injected, skip the active faults
|
||||
// quota check.
|
||||
grpc_error* MaybeAbort();
|
||||
grpc_error_handle MaybeAbort();
|
||||
|
||||
// Delays the stream operations batch.
|
||||
void DelayBatch(grpc_call_element* elem,
|
||||
|
|
@ -144,11 +144,11 @@ class CallData {
|
|||
}
|
||||
|
||||
// This is a callback that will be invoked after the delay timer is up.
|
||||
static void ResumeBatch(void* arg, grpc_error* error);
|
||||
static void ResumeBatch(void* arg, grpc_error_handle error);
|
||||
|
||||
// This is a callback invoked upon completion of recv_trailing_metadata.
|
||||
// Injects the abort_error_ to the recv_trailing_metadata batch if needed.
|
||||
static void HijackedRecvTrailingMetadataReady(void* arg, grpc_error*);
|
||||
static void HijackedRecvTrailingMetadataReady(void* arg, grpc_error_handle);
|
||||
|
||||
// Used to track the policy structs that needs to be destroyed in dtor.
|
||||
bool fi_policy_owned_ = false;
|
||||
|
|
@ -166,7 +166,7 @@ class CallData {
|
|||
ResumeBatchCanceller* resume_batch_canceller_ ABSL_GUARDED_BY(delay_mu_);
|
||||
grpc_transport_stream_op_batch* delayed_batch_ ABSL_GUARDED_BY(delay_mu_);
|
||||
// Abort states
|
||||
grpc_error* abort_error_ = GRPC_ERROR_NONE;
|
||||
grpc_error_handle abort_error_ = GRPC_ERROR_NONE;
|
||||
grpc_closure recv_trailing_metadata_ready_;
|
||||
grpc_closure* original_recv_trailing_metadata_ready_;
|
||||
// Protects the asynchronous delay, resume, and cancellation.
|
||||
|
|
@ -175,8 +175,8 @@ class CallData {
|
|||
|
||||
// ChannelData
|
||||
|
||||
grpc_error* ChannelData::Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
grpc_error_handle ChannelData::Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
GPR_ASSERT(elem->filter == &FaultInjectionFilterVtable);
|
||||
new (elem->channel_data) ChannelData(elem, args);
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -204,7 +204,7 @@ class CallData::ResumeBatchCanceller {
|
|||
}
|
||||
|
||||
private:
|
||||
static void Cancel(void* arg, grpc_error* error) {
|
||||
static void Cancel(void* arg, grpc_error_handle error) {
|
||||
auto* self = static_cast<ResumeBatchCanceller*>(arg);
|
||||
auto* chand = static_cast<ChannelData*>(self->elem_->channel_data);
|
||||
auto* calld = static_cast<CallData*>(self->elem_->call_data);
|
||||
|
|
@ -237,8 +237,8 @@ class CallData::ResumeBatchCanceller {
|
|||
|
||||
// CallData
|
||||
|
||||
grpc_error* CallData::Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
grpc_error_handle CallData::Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
auto* calld = new (elem->call_data) CallData(elem, args);
|
||||
if (calld->fi_policy_ == nullptr) {
|
||||
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
|
|
@ -273,7 +273,7 @@ void CallData::StartTransportStreamOpBatch(
|
|||
calld->DelayBatch(elem, batch);
|
||||
return;
|
||||
}
|
||||
grpc_error* abort_error = calld->MaybeAbort();
|
||||
grpc_error_handle abort_error = calld->MaybeAbort();
|
||||
if (abort_error != GRPC_ERROR_NONE) {
|
||||
calld->abort_error_ = abort_error;
|
||||
grpc_transport_stream_op_batch_finish_with_failure(
|
||||
|
|
@ -414,7 +414,7 @@ bool CallData::MaybeDelay() {
|
|||
return false;
|
||||
}
|
||||
|
||||
grpc_error* CallData::MaybeAbort() {
|
||||
grpc_error_handle CallData::MaybeAbort() {
|
||||
if (abort_request_ && (delay_request_ || HaveActiveFaultsQuota(false))) {
|
||||
return grpc_error_set_int(
|
||||
GRPC_ERROR_CREATE_FROM_COPIED_STRING(fi_policy_->abort_message.c_str()),
|
||||
|
|
@ -434,7 +434,7 @@ void CallData::DelayBatch(grpc_call_element* elem,
|
|||
grpc_timer_init(&delay_timer_, resume_time, &batch->handler_private.closure);
|
||||
}
|
||||
|
||||
void CallData::ResumeBatch(void* arg, grpc_error* error) {
|
||||
void CallData::ResumeBatch(void* arg, grpc_error_handle error) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
|
||||
auto* calld = static_cast<CallData*>(elem->call_data);
|
||||
MutexLock lock(&calld->delay_mu_);
|
||||
|
|
@ -462,7 +462,8 @@ void CallData::ResumeBatch(void* arg, grpc_error* error) {
|
|||
grpc_call_next_op(elem, calld->delayed_batch_);
|
||||
}
|
||||
|
||||
void CallData::HijackedRecvTrailingMetadataReady(void* arg, grpc_error* error) {
|
||||
void CallData::HijackedRecvTrailingMetadataReady(void* arg,
|
||||
grpc_error_handle error) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
|
||||
auto* calld = static_cast<CallData*>(elem->call_data);
|
||||
if (calld->abort_error_ != GRPC_ERROR_NONE) {
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ size_t g_fault_injection_parser_index;
|
|||
|
||||
std::vector<FaultInjectionMethodParsedConfig::FaultInjectionPolicy>
|
||||
ParseFaultInjectionPolicy(const Json::Array& policies_json_array,
|
||||
std::vector<grpc_error*>* error_list) {
|
||||
std::vector<grpc_error_handle>* error_list) {
|
||||
std::vector<FaultInjectionMethodParsedConfig::FaultInjectionPolicy> policies;
|
||||
for (size_t i = 0; i < policies_json_array.size(); i++) {
|
||||
FaultInjectionMethodParsedConfig::FaultInjectionPolicy
|
||||
fault_injection_policy;
|
||||
std::vector<grpc_error*> sub_error_list;
|
||||
std::vector<grpc_error_handle> sub_error_list;
|
||||
if (policies_json_array[i].type() != Json::Type::OBJECT) {
|
||||
error_list->push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrCat("faultInjectionPolicy index ", i,
|
||||
|
|
@ -135,7 +135,7 @@ ParseFaultInjectionPolicy(const Json::Array& policies_json_array,
|
|||
if (!sub_error_list.empty()) {
|
||||
// Can't use GRPC_ERROR_CREATE_FROM_VECTOR() here, because the error
|
||||
// string is not static in this case.
|
||||
grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
grpc_error_handle error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrCat("failed to parse faultInjectionPolicy index ", i)
|
||||
.c_str());
|
||||
for (size_t i = 0; i < sub_error_list.size(); ++i) {
|
||||
|
|
@ -152,7 +152,7 @@ ParseFaultInjectionPolicy(const Json::Array& policies_json_array,
|
|||
|
||||
std::unique_ptr<ServiceConfigParser::ParsedConfig>
|
||||
FaultInjectionServiceConfigParser::ParsePerMethodParams(
|
||||
const grpc_channel_args* args, const Json& json, grpc_error** error) {
|
||||
const grpc_channel_args* args, const Json& json, grpc_error_handle* error) {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
// Only parse fault injection policy if the following channel arg is present.
|
||||
if (!grpc_channel_args_find_bool(
|
||||
|
|
@ -162,7 +162,7 @@ FaultInjectionServiceConfigParser::ParsePerMethodParams(
|
|||
// Parse fault injection policy from given Json
|
||||
std::vector<FaultInjectionMethodParsedConfig::FaultInjectionPolicy>
|
||||
fault_injection_policies;
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
const Json::Array* policies_json_array;
|
||||
if (ParseJsonObjectField(json.object_value(), "faultInjectionPolicy",
|
||||
&policies_json_array, &error_list)) {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class FaultInjectionServiceConfigParser : public ServiceConfigParser::Parser {
|
|||
// Parses the per-method service config for fault injection filter.
|
||||
std::unique_ptr<ServiceConfigParser::ParsedConfig> ParsePerMethodParams(
|
||||
const grpc_channel_args* args, const Json& json,
|
||||
grpc_error** error) override;
|
||||
grpc_error_handle* error) override;
|
||||
// Returns the parser index for FaultInjectionServiceConfigParser.
|
||||
static size_t ParserIndex();
|
||||
// Registers FaultInjectionServiceConfigParser to ServiceConfigParser.
|
||||
|
|
|
|||
|
|
@ -48,10 +48,12 @@
|
|||
/* default maximum size of payload eligible for GET request */
|
||||
static constexpr size_t kMaxPayloadSizeForGet = 2048;
|
||||
|
||||
static void recv_initial_metadata_ready(void* user_data, grpc_error* error);
|
||||
static void recv_trailing_metadata_ready(void* user_data, grpc_error* error);
|
||||
static void on_send_message_next_done(void* arg, grpc_error* error);
|
||||
static void send_message_on_complete(void* arg, grpc_error* error);
|
||||
static void recv_initial_metadata_ready(void* user_data,
|
||||
grpc_error_handle error);
|
||||
static void recv_trailing_metadata_ready(void* user_data,
|
||||
grpc_error_handle error);
|
||||
static void on_send_message_next_done(void* arg, grpc_error_handle error);
|
||||
static void send_message_on_complete(void* arg, grpc_error_handle error);
|
||||
|
||||
namespace {
|
||||
struct call_data {
|
||||
|
|
@ -81,14 +83,14 @@ struct call_data {
|
|||
grpc_linked_mdelem user_agent;
|
||||
// State for handling recv_initial_metadata ops.
|
||||
grpc_metadata_batch* recv_initial_metadata;
|
||||
grpc_error* recv_initial_metadata_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle recv_initial_metadata_error = GRPC_ERROR_NONE;
|
||||
grpc_closure* original_recv_initial_metadata_ready = nullptr;
|
||||
grpc_closure recv_initial_metadata_ready;
|
||||
// State for handling recv_trailing_metadata ops.
|
||||
grpc_metadata_batch* recv_trailing_metadata;
|
||||
grpc_closure* original_recv_trailing_metadata_ready;
|
||||
grpc_closure recv_trailing_metadata_ready;
|
||||
grpc_error* recv_trailing_metadata_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle recv_trailing_metadata_error = GRPC_ERROR_NONE;
|
||||
bool seen_recv_trailing_metadata_ready = false;
|
||||
// State for handling send_message ops.
|
||||
grpc_transport_stream_op_batch* send_message_batch;
|
||||
|
|
@ -108,7 +110,8 @@ struct channel_data {
|
|||
};
|
||||
} // namespace
|
||||
|
||||
static grpc_error* client_filter_incoming_metadata(grpc_metadata_batch* b) {
|
||||
static grpc_error_handle client_filter_incoming_metadata(
|
||||
grpc_metadata_batch* b) {
|
||||
if (b->idx.named.status != nullptr) {
|
||||
/* If both gRPC status and HTTP status are provided in the response, we
|
||||
* should prefer the gRPC status code, as mentioned in
|
||||
|
|
@ -123,7 +126,7 @@ static grpc_error* client_filter_incoming_metadata(grpc_metadata_batch* b) {
|
|||
GPR_DUMP_ASCII);
|
||||
std::string msg =
|
||||
absl::StrCat("Received http2 header with status: ", val);
|
||||
grpc_error* e = grpc_error_set_str(
|
||||
grpc_error_handle e = grpc_error_set_str(
|
||||
grpc_error_set_int(
|
||||
grpc_error_set_str(
|
||||
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
|
|
@ -182,7 +185,8 @@ static grpc_error* client_filter_incoming_metadata(grpc_metadata_batch* b) {
|
|||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
static void recv_initial_metadata_ready(void* user_data, grpc_error* error) {
|
||||
static void recv_initial_metadata_ready(void* user_data,
|
||||
grpc_error_handle error) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(user_data);
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
|
|
@ -201,7 +205,8 @@ static void recv_initial_metadata_ready(void* user_data, grpc_error* error) {
|
|||
grpc_core::Closure::Run(DEBUG_LOCATION, closure, error);
|
||||
}
|
||||
|
||||
static void recv_trailing_metadata_ready(void* user_data, grpc_error* error) {
|
||||
static void recv_trailing_metadata_ready(void* user_data,
|
||||
grpc_error_handle error) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(user_data);
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
if (calld->original_recv_initial_metadata_ready != nullptr) {
|
||||
|
|
@ -223,7 +228,7 @@ static void recv_trailing_metadata_ready(void* user_data, grpc_error* error) {
|
|||
calld->original_recv_trailing_metadata_ready, error);
|
||||
}
|
||||
|
||||
static void send_message_on_complete(void* arg, grpc_error* error) {
|
||||
static void send_message_on_complete(void* arg, grpc_error_handle error) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
calld->send_message_cache.Destroy();
|
||||
|
|
@ -234,9 +239,10 @@ static void send_message_on_complete(void* arg, grpc_error* error) {
|
|||
|
||||
// Pulls a slice from the send_message byte stream, updating
|
||||
// calld->send_message_bytes_read.
|
||||
static grpc_error* pull_slice_from_send_message(call_data* calld) {
|
||||
static grpc_error_handle pull_slice_from_send_message(call_data* calld) {
|
||||
grpc_slice incoming_slice;
|
||||
grpc_error* error = calld->send_message_caching_stream->Pull(&incoming_slice);
|
||||
grpc_error_handle error =
|
||||
calld->send_message_caching_stream->Pull(&incoming_slice);
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
calld->send_message_bytes_read += GRPC_SLICE_LENGTH(incoming_slice);
|
||||
grpc_slice_unref_internal(incoming_slice);
|
||||
|
|
@ -249,10 +255,11 @@ static grpc_error* pull_slice_from_send_message(call_data* calld) {
|
|||
// calld->send_message_caching_stream->length(), then we have completed
|
||||
// reading from the byte stream; otherwise, an async read has been dispatched
|
||||
// and on_send_message_next_done() will be invoked when it is complete.
|
||||
static grpc_error* read_all_available_send_message_data(call_data* calld) {
|
||||
static grpc_error_handle read_all_available_send_message_data(
|
||||
call_data* calld) {
|
||||
while (calld->send_message_caching_stream->Next(
|
||||
SIZE_MAX, &calld->on_send_message_next_done)) {
|
||||
grpc_error* error = pull_slice_from_send_message(calld);
|
||||
grpc_error_handle error = pull_slice_from_send_message(calld);
|
||||
if (error != GRPC_ERROR_NONE) return error;
|
||||
if (calld->send_message_bytes_read ==
|
||||
calld->send_message_caching_stream->length()) {
|
||||
|
|
@ -263,7 +270,7 @@ static grpc_error* read_all_available_send_message_data(call_data* calld) {
|
|||
}
|
||||
|
||||
// Async callback for ByteStream::Next().
|
||||
static void on_send_message_next_done(void* arg, grpc_error* error) {
|
||||
static void on_send_message_next_done(void* arg, grpc_error_handle error) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
|
|
@ -301,8 +308,8 @@ static char* slice_buffer_to_string(grpc_slice_buffer* slice_buffer) {
|
|||
|
||||
// Modifies the path entry in the batch's send_initial_metadata to
|
||||
// append the base64-encoded query for a GET request.
|
||||
static grpc_error* update_path_for_get(grpc_call_element* elem,
|
||||
grpc_transport_stream_op_batch* batch) {
|
||||
static grpc_error_handle update_path_for_get(
|
||||
grpc_call_element* elem, grpc_transport_stream_op_batch* batch) {
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
grpc_slice path_slice =
|
||||
GRPC_MDVALUE(batch->payload->send_initial_metadata.send_initial_metadata
|
||||
|
|
@ -376,7 +383,7 @@ static void http_client_start_transport_stream_op_batch(
|
|||
&calld->recv_trailing_metadata_ready;
|
||||
}
|
||||
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
bool batch_will_be_handled_asynchronously = false;
|
||||
if (batch->send_initial_metadata) {
|
||||
// Decide which HTTP VERB to use. We use GET if the request is marked
|
||||
|
|
@ -475,7 +482,7 @@ done:
|
|||
}
|
||||
|
||||
/* Constructor for call_data */
|
||||
static grpc_error* http_client_init_call_elem(
|
||||
static grpc_error_handle http_client_init_call_elem(
|
||||
grpc_call_element* elem, const grpc_call_element_args* args) {
|
||||
new (elem->call_data) call_data(elem, *args);
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -561,7 +568,7 @@ static grpc_core::ManagedMemorySlice user_agent_from_args(
|
|||
}
|
||||
|
||||
/* Constructor for channel_data */
|
||||
static grpc_error* http_client_init_channel_elem(
|
||||
static grpc_error_handle http_client_init_channel_elem(
|
||||
grpc_channel_element* elem, grpc_channel_element_args* args) {
|
||||
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
|
||||
GPR_ASSERT(!args->is_last);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ void client_authority_start_transport_stream_op_batch(
|
|||
if (batch->send_initial_metadata &&
|
||||
batch->payload->send_initial_metadata.send_initial_metadata->idx.named
|
||||
.authority == nullptr) {
|
||||
grpc_error* error = grpc_metadata_batch_add_head(
|
||||
grpc_error_handle error = grpc_metadata_batch_add_head(
|
||||
batch->payload->send_initial_metadata.send_initial_metadata,
|
||||
&calld->authority_storage,
|
||||
GRPC_MDELEM_REF(chand->default_authority_mdelem), GRPC_BATCH_AUTHORITY);
|
||||
|
|
@ -72,7 +72,7 @@ void client_authority_start_transport_stream_op_batch(
|
|||
}
|
||||
|
||||
/* Constructor for call_data */
|
||||
grpc_error* client_authority_init_call_elem(
|
||||
grpc_error_handle client_authority_init_call_elem(
|
||||
grpc_call_element* elem, const grpc_call_element_args* args) {
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
calld->call_combiner = args->call_combiner;
|
||||
|
|
@ -85,7 +85,7 @@ void client_authority_destroy_call_elem(
|
|||
grpc_closure* /*ignored*/) {}
|
||||
|
||||
/* Constructor for channel_data */
|
||||
grpc_error* client_authority_init_channel_elem(
|
||||
grpc_error_handle client_authority_init_channel_elem(
|
||||
grpc_channel_element* elem, grpc_channel_element_args* args) {
|
||||
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
|
||||
const grpc_arg* default_authority_arg =
|
||||
|
|
|
|||
|
|
@ -131,25 +131,25 @@ class CallData {
|
|||
bool SkipMessageCompression();
|
||||
void InitializeState(grpc_call_element* elem);
|
||||
|
||||
grpc_error* ProcessSendInitialMetadata(grpc_call_element* elem,
|
||||
grpc_metadata_batch* initial_metadata);
|
||||
grpc_error_handle ProcessSendInitialMetadata(
|
||||
grpc_call_element* elem, grpc_metadata_batch* initial_metadata);
|
||||
|
||||
// Methods for processing a send_message batch
|
||||
static void StartSendMessageBatch(void* elem_arg, grpc_error* unused);
|
||||
static void OnSendMessageNextDone(void* elem_arg, grpc_error* error);
|
||||
grpc_error* PullSliceFromSendMessage();
|
||||
static void StartSendMessageBatch(void* elem_arg, grpc_error_handle unused);
|
||||
static void OnSendMessageNextDone(void* elem_arg, grpc_error_handle error);
|
||||
grpc_error_handle PullSliceFromSendMessage();
|
||||
void ContinueReadingSendMessage(grpc_call_element* elem);
|
||||
void FinishSendMessage(grpc_call_element* elem);
|
||||
void SendMessageBatchContinue(grpc_call_element* elem);
|
||||
static void FailSendMessageBatchInCallCombiner(void* calld_arg,
|
||||
grpc_error* error);
|
||||
grpc_error_handle error);
|
||||
|
||||
static void SendMessageOnComplete(void* calld_arg, grpc_error* error);
|
||||
static void SendMessageOnComplete(void* calld_arg, grpc_error_handle error);
|
||||
|
||||
grpc_core::CallCombiner* call_combiner_;
|
||||
grpc_message_compression_algorithm message_compression_algorithm_ =
|
||||
GRPC_MESSAGE_COMPRESS_NONE;
|
||||
grpc_error* cancel_error_ = GRPC_ERROR_NONE;
|
||||
grpc_error_handle cancel_error_ = GRPC_ERROR_NONE;
|
||||
grpc_transport_stream_op_batch* send_message_batch_ = nullptr;
|
||||
bool seen_initial_metadata_ = false;
|
||||
/* Set to true, if the fields below are initialized. */
|
||||
|
|
@ -232,7 +232,7 @@ void CallData::InitializeState(grpc_call_element* elem) {
|
|||
grpc_schedule_on_exec_ctx);
|
||||
}
|
||||
|
||||
grpc_error* CallData::ProcessSendInitialMetadata(
|
||||
grpc_error_handle CallData::ProcessSendInitialMetadata(
|
||||
grpc_call_element* elem, grpc_metadata_batch* initial_metadata) {
|
||||
ChannelData* channeld = static_cast<ChannelData*>(elem->channel_data);
|
||||
// Find the compression algorithm.
|
||||
|
|
@ -246,7 +246,7 @@ grpc_error* CallData::ProcessSendInitialMetadata(
|
|||
grpc_compression_algorithm_to_stream_compression_algorithm(
|
||||
compression_algorithm);
|
||||
// Hint compression algorithm.
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
if (message_compression_algorithm_ != GRPC_MESSAGE_COMPRESS_NONE) {
|
||||
InitializeState(elem);
|
||||
error = grpc_metadata_batch_add_tail(
|
||||
|
|
@ -281,7 +281,7 @@ grpc_error* CallData::ProcessSendInitialMetadata(
|
|||
return error;
|
||||
}
|
||||
|
||||
void CallData::SendMessageOnComplete(void* calld_arg, grpc_error* error) {
|
||||
void CallData::SendMessageOnComplete(void* calld_arg, grpc_error_handle error) {
|
||||
CallData* calld = static_cast<CallData*>(calld_arg);
|
||||
grpc_slice_buffer_reset_and_unref_internal(&calld->slices_);
|
||||
grpc_core::Closure::Run(DEBUG_LOCATION,
|
||||
|
|
@ -348,7 +348,7 @@ void CallData::FinishSendMessage(grpc_call_element* elem) {
|
|||
}
|
||||
|
||||
void CallData::FailSendMessageBatchInCallCombiner(void* calld_arg,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
CallData* calld = static_cast<CallData*>(calld_arg);
|
||||
if (calld->send_message_batch_ != nullptr) {
|
||||
grpc_transport_stream_op_batch_finish_with_failure(
|
||||
|
|
@ -359,9 +359,9 @@ void CallData::FailSendMessageBatchInCallCombiner(void* calld_arg,
|
|||
}
|
||||
|
||||
// Pulls a slice from the send_message byte stream and adds it to slices_.
|
||||
grpc_error* CallData::PullSliceFromSendMessage() {
|
||||
grpc_error_handle CallData::PullSliceFromSendMessage() {
|
||||
grpc_slice incoming_slice;
|
||||
grpc_error* error =
|
||||
grpc_error_handle error =
|
||||
send_message_batch_->payload->send_message.send_message->Pull(
|
||||
&incoming_slice);
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
|
|
@ -382,7 +382,7 @@ void CallData::ContinueReadingSendMessage(grpc_call_element* elem) {
|
|||
}
|
||||
while (send_message_batch_->payload->send_message.send_message->Next(
|
||||
~static_cast<size_t>(0), &on_send_message_next_done_)) {
|
||||
grpc_error* error = PullSliceFromSendMessage();
|
||||
grpc_error_handle error = PullSliceFromSendMessage();
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
// Closure callback; does not take ownership of error.
|
||||
FailSendMessageBatchInCallCombiner(this, error);
|
||||
|
|
@ -398,7 +398,7 @@ void CallData::ContinueReadingSendMessage(grpc_call_element* elem) {
|
|||
}
|
||||
|
||||
// Async callback for ByteStream::Next().
|
||||
void CallData::OnSendMessageNextDone(void* elem_arg, grpc_error* error) {
|
||||
void CallData::OnSendMessageNextDone(void* elem_arg, grpc_error_handle error) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(elem_arg);
|
||||
CallData* calld = static_cast<CallData*>(elem->call_data);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
|
|
@ -421,7 +421,8 @@ void CallData::OnSendMessageNextDone(void* elem_arg, grpc_error* error) {
|
|||
}
|
||||
}
|
||||
|
||||
void CallData::StartSendMessageBatch(void* elem_arg, grpc_error* /*unused*/) {
|
||||
void CallData::StartSendMessageBatch(void* elem_arg,
|
||||
grpc_error_handle /*unused*/) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(elem_arg);
|
||||
CallData* calld = static_cast<CallData*>(elem->call_data);
|
||||
if (calld->SkipMessageCompression()) {
|
||||
|
|
@ -458,7 +459,7 @@ void CallData::CompressStartTransportStreamOpBatch(
|
|||
// Handle send_initial_metadata.
|
||||
if (batch->send_initial_metadata) {
|
||||
GPR_ASSERT(!seen_initial_metadata_);
|
||||
grpc_error* error = ProcessSendInitialMetadata(
|
||||
grpc_error_handle error = ProcessSendInitialMetadata(
|
||||
elem, batch->payload->send_initial_metadata.send_initial_metadata);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
grpc_transport_stream_op_batch_finish_with_failure(batch, error,
|
||||
|
|
@ -503,8 +504,8 @@ void CompressStartTransportStreamOpBatch(
|
|||
}
|
||||
|
||||
/* Constructor for call_data */
|
||||
grpc_error* CompressInitCallElem(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
grpc_error_handle CompressInitCallElem(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
new (elem->call_data) CallData(elem, *args);
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
|
@ -518,8 +519,8 @@ void CompressDestroyCallElem(grpc_call_element* elem,
|
|||
}
|
||||
|
||||
/* Constructor for ChannelData */
|
||||
grpc_error* CompressInitChannelElem(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
grpc_error_handle CompressInitChannelElem(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
new (elem->channel_data) ChannelData(args);
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,24 +89,24 @@ class CallData {
|
|||
grpc_call_element* elem, grpc_transport_stream_op_batch* batch);
|
||||
|
||||
private:
|
||||
static void OnRecvInitialMetadataReady(void* arg, grpc_error* error);
|
||||
static void OnRecvInitialMetadataReady(void* arg, grpc_error_handle error);
|
||||
|
||||
// Methods for processing a receive message event
|
||||
void MaybeResumeOnRecvMessageReady();
|
||||
static void OnRecvMessageReady(void* arg, grpc_error* error);
|
||||
static void OnRecvMessageNextDone(void* arg, grpc_error* error);
|
||||
grpc_error* PullSliceFromRecvMessage();
|
||||
static void OnRecvMessageReady(void* arg, grpc_error_handle error);
|
||||
static void OnRecvMessageNextDone(void* arg, grpc_error_handle error);
|
||||
grpc_error_handle PullSliceFromRecvMessage();
|
||||
void ContinueReadingRecvMessage();
|
||||
void FinishRecvMessage();
|
||||
void ContinueRecvMessageReadyCallback(grpc_error* error);
|
||||
void ContinueRecvMessageReadyCallback(grpc_error_handle error);
|
||||
|
||||
// Methods for processing a recv_trailing_metadata event
|
||||
void MaybeResumeOnRecvTrailingMetadataReady();
|
||||
static void OnRecvTrailingMetadataReady(void* arg, grpc_error* error);
|
||||
static void OnRecvTrailingMetadataReady(void* arg, grpc_error_handle error);
|
||||
|
||||
CallCombiner* call_combiner_;
|
||||
// Overall error for the call
|
||||
grpc_error* error_ = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error_ = GRPC_ERROR_NONE;
|
||||
// Fields for handling recv_initial_metadata_ready callback
|
||||
grpc_closure on_recv_initial_metadata_ready_;
|
||||
grpc_closure* original_recv_initial_metadata_ready_ = nullptr;
|
||||
|
|
@ -130,7 +130,7 @@ class CallData {
|
|||
bool seen_recv_trailing_metadata_ready_ = false;
|
||||
grpc_closure on_recv_trailing_metadata_ready_;
|
||||
grpc_closure* original_recv_trailing_metadata_ready_ = nullptr;
|
||||
grpc_error* on_recv_trailing_metadata_ready_error_ = GRPC_ERROR_NONE;
|
||||
grpc_error_handle on_recv_trailing_metadata_ready_error_ = GRPC_ERROR_NONE;
|
||||
};
|
||||
|
||||
grpc_message_compression_algorithm DecodeMessageCompressionAlgorithm(
|
||||
|
|
@ -149,7 +149,7 @@ grpc_message_compression_algorithm DecodeMessageCompressionAlgorithm(
|
|||
return algorithm;
|
||||
}
|
||||
|
||||
void CallData::OnRecvInitialMetadataReady(void* arg, grpc_error* error) {
|
||||
void CallData::OnRecvInitialMetadataReady(void* arg, grpc_error_handle error) {
|
||||
CallData* calld = static_cast<CallData*>(arg);
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
grpc_linked_mdelem* grpc_encoding =
|
||||
|
|
@ -174,7 +174,7 @@ void CallData::MaybeResumeOnRecvMessageReady() {
|
|||
}
|
||||
}
|
||||
|
||||
void CallData::OnRecvMessageReady(void* arg, grpc_error* error) {
|
||||
void CallData::OnRecvMessageReady(void* arg, grpc_error_handle error) {
|
||||
CallData* calld = static_cast<CallData*>(arg);
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
if (calld->original_recv_initial_metadata_ready_ != nullptr) {
|
||||
|
|
@ -218,7 +218,7 @@ void CallData::ContinueReadingRecvMessage() {
|
|||
while ((*recv_message_)
|
||||
->Next((*recv_message_)->length() - recv_slices_.length,
|
||||
&on_recv_message_next_done_)) {
|
||||
grpc_error* error = PullSliceFromRecvMessage();
|
||||
grpc_error_handle error = PullSliceFromRecvMessage();
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
return ContinueRecvMessageReadyCallback(error);
|
||||
}
|
||||
|
|
@ -229,16 +229,16 @@ void CallData::ContinueReadingRecvMessage() {
|
|||
}
|
||||
}
|
||||
|
||||
grpc_error* CallData::PullSliceFromRecvMessage() {
|
||||
grpc_error_handle CallData::PullSliceFromRecvMessage() {
|
||||
grpc_slice incoming_slice;
|
||||
grpc_error* error = (*recv_message_)->Pull(&incoming_slice);
|
||||
grpc_error_handle error = (*recv_message_)->Pull(&incoming_slice);
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
grpc_slice_buffer_add(&recv_slices_, incoming_slice);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
void CallData::OnRecvMessageNextDone(void* arg, grpc_error* error) {
|
||||
void CallData::OnRecvMessageNextDone(void* arg, grpc_error_handle error) {
|
||||
CallData* calld = static_cast<CallData*>(arg);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
return calld->ContinueRecvMessageReadyCallback(GRPC_ERROR_REF(error));
|
||||
|
|
@ -283,7 +283,7 @@ void CallData::FinishRecvMessage() {
|
|||
ContinueRecvMessageReadyCallback(GRPC_ERROR_REF(error_));
|
||||
}
|
||||
|
||||
void CallData::ContinueRecvMessageReadyCallback(grpc_error* error) {
|
||||
void CallData::ContinueRecvMessageReadyCallback(grpc_error_handle error) {
|
||||
MaybeResumeOnRecvTrailingMetadataReady();
|
||||
// The surface will clean up the receiving stream if there is an error.
|
||||
grpc_closure* closure = original_recv_message_ready_;
|
||||
|
|
@ -294,14 +294,14 @@ void CallData::ContinueRecvMessageReadyCallback(grpc_error* error) {
|
|||
void CallData::MaybeResumeOnRecvTrailingMetadataReady() {
|
||||
if (seen_recv_trailing_metadata_ready_) {
|
||||
seen_recv_trailing_metadata_ready_ = false;
|
||||
grpc_error* error = on_recv_trailing_metadata_ready_error_;
|
||||
grpc_error_handle error = on_recv_trailing_metadata_ready_error_;
|
||||
on_recv_trailing_metadata_ready_error_ = GRPC_ERROR_NONE;
|
||||
GRPC_CALL_COMBINER_START(call_combiner_, &on_recv_trailing_metadata_ready_,
|
||||
error, "Continuing OnRecvTrailingMetadataReady");
|
||||
}
|
||||
}
|
||||
|
||||
void CallData::OnRecvTrailingMetadataReady(void* arg, grpc_error* error) {
|
||||
void CallData::OnRecvTrailingMetadataReady(void* arg, grpc_error_handle error) {
|
||||
CallData* calld = static_cast<CallData*>(arg);
|
||||
if (calld->original_recv_initial_metadata_ready_ != nullptr ||
|
||||
calld->original_recv_message_ready_ != nullptr) {
|
||||
|
|
@ -356,8 +356,8 @@ void DecompressStartTransportStreamOpBatch(
|
|||
calld->DecompressStartTransportStreamOpBatch(elem, batch);
|
||||
}
|
||||
|
||||
grpc_error* DecompressInitCallElem(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
grpc_error_handle DecompressInitCallElem(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
|
||||
new (elem->call_data) CallData(*args, chand);
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -370,8 +370,8 @@ void DecompressDestroyCallElem(grpc_call_element* elem,
|
|||
calld->~CallData();
|
||||
}
|
||||
|
||||
grpc_error* DecompressInitChannelElem(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
grpc_error_handle DecompressInitChannelElem(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
|
||||
new (chand) ChannelData(args);
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
|
|||
|
|
@ -35,9 +35,11 @@
|
|||
#define EXPECTED_CONTENT_TYPE "application/grpc"
|
||||
#define EXPECTED_CONTENT_TYPE_LENGTH (sizeof(EXPECTED_CONTENT_TYPE) - 1)
|
||||
|
||||
static void hs_recv_initial_metadata_ready(void* user_data, grpc_error* err);
|
||||
static void hs_recv_trailing_metadata_ready(void* user_data, grpc_error* err);
|
||||
static void hs_recv_message_ready(void* user_data, grpc_error* err);
|
||||
static void hs_recv_initial_metadata_ready(void* user_data,
|
||||
grpc_error_handle err);
|
||||
static void hs_recv_trailing_metadata_ready(void* user_data,
|
||||
grpc_error_handle err);
|
||||
static void hs_recv_message_ready(void* user_data, grpc_error_handle err);
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
@ -74,7 +76,7 @@ struct call_data {
|
|||
|
||||
// State for intercepting recv_initial_metadata.
|
||||
grpc_closure recv_initial_metadata_ready;
|
||||
grpc_error* recv_initial_metadata_ready_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle recv_initial_metadata_ready_error = GRPC_ERROR_NONE;
|
||||
grpc_closure* original_recv_initial_metadata_ready;
|
||||
grpc_metadata_batch* recv_initial_metadata = nullptr;
|
||||
uint32_t* recv_initial_metadata_flags;
|
||||
|
|
@ -89,7 +91,7 @@ struct call_data {
|
|||
// State for intercepting recv_trailing_metadata
|
||||
grpc_closure recv_trailing_metadata_ready;
|
||||
grpc_closure* original_recv_trailing_metadata_ready;
|
||||
grpc_error* recv_trailing_metadata_ready_error;
|
||||
grpc_error_handle recv_trailing_metadata_ready_error;
|
||||
bool seen_recv_trailing_metadata_ready = false;
|
||||
};
|
||||
|
||||
|
|
@ -99,7 +101,7 @@ struct channel_data {
|
|||
|
||||
} // namespace
|
||||
|
||||
static grpc_error* hs_filter_outgoing_metadata(grpc_metadata_batch* b) {
|
||||
static grpc_error_handle hs_filter_outgoing_metadata(grpc_metadata_batch* b) {
|
||||
if (b->idx.named.grpc_message != nullptr) {
|
||||
grpc_slice pct_encoded_msg = grpc_percent_encode_slice(
|
||||
GRPC_MDVALUE(b->idx.named.grpc_message->md),
|
||||
|
|
@ -114,8 +116,8 @@ static grpc_error* hs_filter_outgoing_metadata(grpc_metadata_batch* b) {
|
|||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
static void hs_add_error(const char* error_name, grpc_error** cumulative,
|
||||
grpc_error* new_err) {
|
||||
static void hs_add_error(const char* error_name, grpc_error_handle* cumulative,
|
||||
grpc_error_handle new_err) {
|
||||
if (new_err == GRPC_ERROR_NONE) return;
|
||||
if (*cumulative == GRPC_ERROR_NONE) {
|
||||
*cumulative = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_name);
|
||||
|
|
@ -149,10 +151,10 @@ static bool md_strict_equal(grpc_mdelem a, grpc_mdelem b_static) {
|
|||
}
|
||||
}
|
||||
|
||||
static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
|
||||
grpc_metadata_batch* b) {
|
||||
static grpc_error_handle hs_filter_incoming_metadata(grpc_call_element* elem,
|
||||
grpc_metadata_batch* b) {
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
static const char* error_name = "Failed processing incoming headers";
|
||||
|
||||
if (b->idx.named.method != nullptr) {
|
||||
|
|
@ -330,7 +332,8 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
|
|||
return error;
|
||||
}
|
||||
|
||||
static void hs_recv_initial_metadata_ready(void* user_data, grpc_error* err) {
|
||||
static void hs_recv_initial_metadata_ready(void* user_data,
|
||||
grpc_error_handle err) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(user_data);
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
calld->seen_recv_initial_metadata_ready = true;
|
||||
|
|
@ -367,7 +370,7 @@ static void hs_recv_initial_metadata_ready(void* user_data, grpc_error* err) {
|
|||
calld->original_recv_initial_metadata_ready, err);
|
||||
}
|
||||
|
||||
static void hs_recv_message_ready(void* user_data, grpc_error* err) {
|
||||
static void hs_recv_message_ready(void* user_data, grpc_error_handle err) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(user_data);
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
calld->seen_recv_message_ready = true;
|
||||
|
|
@ -392,7 +395,8 @@ static void hs_recv_message_ready(void* user_data, grpc_error* err) {
|
|||
}
|
||||
}
|
||||
|
||||
static void hs_recv_trailing_metadata_ready(void* user_data, grpc_error* err) {
|
||||
static void hs_recv_trailing_metadata_ready(void* user_data,
|
||||
grpc_error_handle err) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(user_data);
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
if (!calld->seen_recv_initial_metadata_ready) {
|
||||
|
|
@ -410,13 +414,13 @@ static void hs_recv_trailing_metadata_ready(void* user_data, grpc_error* err) {
|
|||
calld->original_recv_trailing_metadata_ready, err);
|
||||
}
|
||||
|
||||
static grpc_error* hs_mutate_op(grpc_call_element* elem,
|
||||
grpc_transport_stream_op_batch* op) {
|
||||
static grpc_error_handle hs_mutate_op(grpc_call_element* elem,
|
||||
grpc_transport_stream_op_batch* op) {
|
||||
/* grab pointers to our data from the call element */
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
|
||||
if (op->send_initial_metadata) {
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
static const char* error_name = "Failed sending initial metadata";
|
||||
hs_add_error(
|
||||
error_name, &error,
|
||||
|
|
@ -463,7 +467,7 @@ static grpc_error* hs_mutate_op(grpc_call_element* elem,
|
|||
}
|
||||
|
||||
if (op->send_trailing_metadata) {
|
||||
grpc_error* error = hs_filter_outgoing_metadata(
|
||||
grpc_error_handle error = hs_filter_outgoing_metadata(
|
||||
op->payload->send_trailing_metadata.send_trailing_metadata);
|
||||
if (error != GRPC_ERROR_NONE) return error;
|
||||
}
|
||||
|
|
@ -475,7 +479,7 @@ static void hs_start_transport_stream_op_batch(
|
|||
grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
|
||||
GPR_TIMER_SCOPE("hs_start_transport_stream_op_batch", 0);
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
grpc_error* error = hs_mutate_op(elem, op);
|
||||
grpc_error_handle error = hs_mutate_op(elem, op);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
grpc_transport_stream_op_batch_finish_with_failure(op, error,
|
||||
calld->call_combiner);
|
||||
|
|
@ -485,8 +489,8 @@ static void hs_start_transport_stream_op_batch(
|
|||
}
|
||||
|
||||
/* Constructor for call_data */
|
||||
static grpc_error* hs_init_call_elem(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
static grpc_error_handle hs_init_call_elem(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
new (elem->call_data) call_data(elem, *args);
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
|
@ -500,8 +504,8 @@ static void hs_destroy_call_elem(grpc_call_element* elem,
|
|||
}
|
||||
|
||||
/* Constructor for channel_data */
|
||||
static grpc_error* hs_init_channel_elem(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
static grpc_error_handle hs_init_channel_elem(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
|
||||
GPR_ASSERT(!args->is_last);
|
||||
chand->surface_user_agent = grpc_channel_arg_get_bool(
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ constexpr char kEncodedIpv6AddressLengthString[] = "32";
|
|||
constexpr char kEmptyAddressLengthString[] = "00";
|
||||
constexpr size_t kLengthPrefixSize = 2;
|
||||
|
||||
grpc_error* ServerLoadReportingChannelData::Init(
|
||||
grpc_error_handle ServerLoadReportingChannelData::Init(
|
||||
grpc_channel_element* /* elem */, grpc_channel_element_args* args) {
|
||||
GPR_ASSERT(!args->is_last);
|
||||
// Find and record the peer_identity.
|
||||
|
|
@ -232,8 +232,8 @@ grpc_filtered_mdelem ServerLoadReportingCallData::RecvInitialMetadataFilter(
|
|||
return GRPC_FILTERED_MDELEM(md);
|
||||
}
|
||||
|
||||
void ServerLoadReportingCallData::RecvInitialMetadataReady(void* arg,
|
||||
grpc_error* err) {
|
||||
void ServerLoadReportingCallData::RecvInitialMetadataReady(
|
||||
void* arg, grpc_error_handle err) {
|
||||
grpc_call_element* elem = reinterpret_cast<grpc_call_element*>(arg);
|
||||
ServerLoadReportingCallData* calld =
|
||||
reinterpret_cast<ServerLoadReportingCallData*>(elem->call_data);
|
||||
|
|
@ -264,7 +264,7 @@ void ServerLoadReportingCallData::RecvInitialMetadataReady(void* arg,
|
|||
GRPC_ERROR_REF(err));
|
||||
}
|
||||
|
||||
grpc_error* ServerLoadReportingCallData::Init(
|
||||
grpc_error_handle ServerLoadReportingCallData::Init(
|
||||
grpc_call_element* elem, const grpc_call_element_args* /*args*/) {
|
||||
service_method_ = grpc_empty_slice();
|
||||
GRPC_CLOSURE_INIT(&recv_initial_metadata_ready_, RecvInitialMetadataReady,
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ namespace grpc {
|
|||
|
||||
class ServerLoadReportingChannelData : public ChannelData {
|
||||
public:
|
||||
grpc_error* Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) override;
|
||||
grpc_error_handle Init(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) override;
|
||||
|
||||
// Getters.
|
||||
const char* peer_identity() { return peer_identity_; }
|
||||
|
|
@ -45,8 +45,8 @@ class ServerLoadReportingChannelData : public ChannelData {
|
|||
|
||||
class ServerLoadReportingCallData : public CallData {
|
||||
public:
|
||||
grpc_error* Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) override;
|
||||
grpc_error_handle Init(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) override;
|
||||
|
||||
void Destroy(grpc_call_element* elem, const grpc_call_final_info* final_info,
|
||||
grpc_closure* then_call_closure) override;
|
||||
|
|
@ -68,7 +68,7 @@ class ServerLoadReportingCallData : public CallData {
|
|||
static const char* GetStatusTagForStatus(grpc_status_code status);
|
||||
|
||||
// Records the call start.
|
||||
static void RecvInitialMetadataReady(void* arg, grpc_error* err);
|
||||
static void RecvInitialMetadataReady(void* arg, grpc_error_handle err);
|
||||
|
||||
// From the initial metadata, extracts the service_method_, target_host_, and
|
||||
// client_ip_and_lr_token_.
|
||||
|
|
|
|||
|
|
@ -206,7 +206,8 @@ static void decrease_call_count(channel_data* chand) {
|
|||
}
|
||||
}
|
||||
|
||||
static void start_max_idle_timer_after_init(void* arg, grpc_error* /*error*/) {
|
||||
static void start_max_idle_timer_after_init(void* arg,
|
||||
grpc_error_handle /*error*/) {
|
||||
channel_data* chand = static_cast<channel_data*>(arg);
|
||||
/* Decrease call_count. If there are no active calls at this time,
|
||||
max_idle_timer will start here. If the number of active calls is not 0,
|
||||
|
|
@ -258,7 +259,8 @@ class ConnectivityWatcher : public AsyncConnectivityStateWatcherInterface {
|
|||
|
||||
} // namespace grpc_core
|
||||
|
||||
static void start_max_age_timer_after_init(void* arg, grpc_error* /*error*/) {
|
||||
static void start_max_age_timer_after_init(void* arg,
|
||||
grpc_error_handle /*error*/) {
|
||||
channel_data* chand = static_cast<channel_data*>(arg);
|
||||
{
|
||||
grpc_core::MutexLock lock(&chand->max_age_timer_mu);
|
||||
|
|
@ -277,8 +279,8 @@ static void start_max_age_timer_after_init(void* arg, grpc_error* /*error*/) {
|
|||
"max_age start_max_age_timer_after_init");
|
||||
}
|
||||
|
||||
static void start_max_age_grace_timer_after_goaway_op(void* arg,
|
||||
grpc_error* /*error*/) {
|
||||
static void start_max_age_grace_timer_after_goaway_op(
|
||||
void* arg, grpc_error_handle /*error*/) {
|
||||
channel_data* chand = static_cast<channel_data*>(arg);
|
||||
{
|
||||
grpc_core::MutexLock lock(&chand->max_age_timer_mu);
|
||||
|
|
@ -307,7 +309,7 @@ static void close_max_idle_channel(channel_data* chand) {
|
|||
elem->filter->start_transport_op(elem, op);
|
||||
}
|
||||
|
||||
static void max_idle_timer_cb(void* arg, grpc_error* error) {
|
||||
static void max_idle_timer_cb(void* arg, grpc_error_handle error) {
|
||||
channel_data* chand = static_cast<channel_data*>(arg);
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
bool try_again = true;
|
||||
|
|
@ -351,7 +353,7 @@ static void max_idle_timer_cb(void* arg, grpc_error* error) {
|
|||
GRPC_CHANNEL_STACK_UNREF(chand->channel_stack, "max_age max_idle_timer");
|
||||
}
|
||||
|
||||
static void close_max_age_channel(void* arg, grpc_error* error) {
|
||||
static void close_max_age_channel(void* arg, grpc_error_handle error) {
|
||||
channel_data* chand = static_cast<channel_data*>(arg);
|
||||
{
|
||||
grpc_core::MutexLock lock(&chand->max_age_timer_mu);
|
||||
|
|
@ -374,7 +376,7 @@ static void close_max_age_channel(void* arg, grpc_error* error) {
|
|||
GRPC_CHANNEL_STACK_UNREF(chand->channel_stack, "max_age max_age_timer");
|
||||
}
|
||||
|
||||
static void force_close_max_age_channel(void* arg, grpc_error* error) {
|
||||
static void force_close_max_age_channel(void* arg, grpc_error_handle error) {
|
||||
channel_data* chand = static_cast<channel_data*>(arg);
|
||||
{
|
||||
grpc_core::MutexLock lock(&chand->max_age_timer_mu);
|
||||
|
|
@ -412,7 +414,7 @@ add_random_max_connection_age_jitter_and_convert_to_grpc_millis(int value) {
|
|||
}
|
||||
|
||||
/* Constructor for call_data. */
|
||||
static grpc_error* max_age_init_call_elem(
|
||||
static grpc_error_handle max_age_init_call_elem(
|
||||
grpc_call_element* elem, const grpc_call_element_args* /*args*/) {
|
||||
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
|
||||
increase_call_count(chand);
|
||||
|
|
@ -428,8 +430,8 @@ static void max_age_destroy_call_elem(
|
|||
}
|
||||
|
||||
/* Constructor for channel_data. */
|
||||
static grpc_error* max_age_init_channel_elem(grpc_channel_element* elem,
|
||||
grpc_channel_element_args* args) {
|
||||
static grpc_error_handle max_age_init_channel_elem(
|
||||
grpc_channel_element* elem, grpc_channel_element_args* args) {
|
||||
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
|
||||
new (chand) channel_data();
|
||||
chand->channel_stack = args->channel_stack;
|
||||
|
|
|
|||
|
|
@ -37,8 +37,9 @@
|
|||
#include "src/core/lib/surface/call.h"
|
||||
#include "src/core/lib/surface/channel_init.h"
|
||||
|
||||
static void recv_message_ready(void* user_data, grpc_error* error);
|
||||
static void recv_trailing_metadata_ready(void* user_data, grpc_error* error);
|
||||
static void recv_message_ready(void* user_data, grpc_error_handle error);
|
||||
static void recv_trailing_metadata_ready(void* user_data,
|
||||
grpc_error_handle error);
|
||||
|
||||
namespace grpc_core {
|
||||
|
||||
|
|
@ -67,9 +68,10 @@ const MessageSizeParsedConfig* MessageSizeParsedConfig::GetFromCallContext(
|
|||
|
||||
std::unique_ptr<ServiceConfigParser::ParsedConfig>
|
||||
MessageSizeParser::ParsePerMethodParams(const grpc_channel_args* /*args*/,
|
||||
const Json& json, grpc_error** error) {
|
||||
const Json& json,
|
||||
grpc_error_handle* error) {
|
||||
GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE);
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
// Max request size.
|
||||
int max_request_message_bytes = -1;
|
||||
auto it = json.object_value().find("maxRequestMessageBytes");
|
||||
|
|
@ -179,7 +181,7 @@ struct call_data {
|
|||
grpc_closure recv_message_ready;
|
||||
grpc_closure recv_trailing_metadata_ready;
|
||||
// The error caused by a message that is too large, or GRPC_ERROR_NONE
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
// Used by recv_message_ready.
|
||||
grpc_core::OrphanablePtr<grpc_core::ByteStream>* recv_message = nullptr;
|
||||
// Original recv_message_ready callback, invoked after our own.
|
||||
|
|
@ -187,20 +189,20 @@ struct call_data {
|
|||
// Original recv_trailing_metadata callback, invoked after our own.
|
||||
grpc_closure* original_recv_trailing_metadata_ready;
|
||||
bool seen_recv_trailing_metadata = false;
|
||||
grpc_error* recv_trailing_metadata_error;
|
||||
grpc_error_handle recv_trailing_metadata_error;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
// Callback invoked when we receive a message. Here we check the max
|
||||
// receive message size.
|
||||
static void recv_message_ready(void* user_data, grpc_error* error) {
|
||||
static void recv_message_ready(void* user_data, grpc_error_handle error) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(user_data);
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
if (*calld->recv_message != nullptr && calld->limits.max_recv_size >= 0 &&
|
||||
(*calld->recv_message)->length() >
|
||||
static_cast<size_t>(calld->limits.max_recv_size)) {
|
||||
grpc_error* new_error = grpc_error_set_int(
|
||||
grpc_error_handle new_error = grpc_error_set_int(
|
||||
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrFormat("Received message larger than max (%u vs. %d)",
|
||||
(*calld->recv_message)->length(),
|
||||
|
|
@ -233,7 +235,8 @@ static void recv_message_ready(void* user_data, grpc_error* error) {
|
|||
|
||||
// Callback invoked on completion of recv_trailing_metadata
|
||||
// Notifies the recv_trailing_metadata batch of any message size failures
|
||||
static void recv_trailing_metadata_ready(void* user_data, grpc_error* error) {
|
||||
static void recv_trailing_metadata_ready(void* user_data,
|
||||
grpc_error_handle error) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(user_data);
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
if (calld->next_recv_message_ready != nullptr) {
|
||||
|
|
@ -291,7 +294,7 @@ static void message_size_start_transport_stream_op_batch(
|
|||
}
|
||||
|
||||
// Constructor for call_data.
|
||||
static grpc_error* message_size_init_call_elem(
|
||||
static grpc_error_handle message_size_init_call_elem(
|
||||
grpc_call_element* elem, const grpc_call_element_args* args) {
|
||||
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
|
||||
new (elem->call_data) call_data(elem, *chand, *args);
|
||||
|
|
@ -315,7 +318,7 @@ grpc_core::MessageSizeParsedConfig::message_size_limits get_message_size_limits(
|
|||
}
|
||||
|
||||
// Constructor for channel_data.
|
||||
static grpc_error* message_size_init_channel_elem(
|
||||
static grpc_error_handle message_size_init_channel_elem(
|
||||
grpc_channel_element* elem, grpc_channel_element_args* args) {
|
||||
GPR_ASSERT(!args->is_last);
|
||||
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class MessageSizeParser : public ServiceConfigParser::Parser {
|
|||
public:
|
||||
std::unique_ptr<ServiceConfigParser::ParsedConfig> ParsePerMethodParams(
|
||||
const grpc_channel_args* /*args*/, const Json& json,
|
||||
grpc_error** error) override;
|
||||
grpc_error_handle* error) override;
|
||||
|
||||
static void Register();
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ static bool get_user_agent_mdelem(const grpc_metadata_batch* batch,
|
|||
}
|
||||
|
||||
// Callback invoked when we receive an initial metadata.
|
||||
static void recv_initial_metadata_ready(void* user_data, grpc_error* error) {
|
||||
static void recv_initial_metadata_ready(void* user_data,
|
||||
grpc_error_handle error) {
|
||||
grpc_call_element* elem = static_cast<grpc_call_element*>(user_data);
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
|
||||
|
|
@ -105,7 +106,7 @@ static void cronet_compression_start_transport_stream_op_batch(
|
|||
}
|
||||
|
||||
// Constructor for call_data.
|
||||
static grpc_error* cronet_compression_init_call_elem(
|
||||
static grpc_error_handle cronet_compression_init_call_elem(
|
||||
grpc_call_element* elem, const grpc_call_element_args* /*args*/) {
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
calld->next_recv_initial_metadata_ready = nullptr;
|
||||
|
|
@ -122,7 +123,7 @@ static void cronet_compression_destroy_call_elem(
|
|||
grpc_closure* /*ignored*/) {}
|
||||
|
||||
// Constructor for channel_data.
|
||||
static grpc_error* cronet_compression_init_channel_elem(
|
||||
static grpc_error_handle cronet_compression_init_channel_elem(
|
||||
grpc_channel_element* /*elem*/, grpc_channel_element_args* /*args*/) {
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ void Chttp2Connector::Connect(const Args& args, Result* result,
|
|||
args.channel_args, &addr, args.deadline);
|
||||
}
|
||||
|
||||
void Chttp2Connector::Shutdown(grpc_error* error) {
|
||||
void Chttp2Connector::Shutdown(grpc_error_handle error) {
|
||||
MutexLock lock(&mu_);
|
||||
shutdown_ = true;
|
||||
if (handshake_mgr_ != nullptr) {
|
||||
|
|
@ -89,7 +89,7 @@ void Chttp2Connector::Shutdown(grpc_error* error) {
|
|||
GRPC_ERROR_UNREF(error);
|
||||
}
|
||||
|
||||
void Chttp2Connector::Connected(void* arg, grpc_error* error) {
|
||||
void Chttp2Connector::Connected(void* arg, grpc_error_handle error) {
|
||||
Chttp2Connector* self = static_cast<Chttp2Connector*>(arg);
|
||||
bool unref = false;
|
||||
{
|
||||
|
|
@ -131,14 +131,14 @@ void Chttp2Connector::StartHandshakeLocked() {
|
|||
|
||||
namespace {
|
||||
void NullThenSchedClosure(const DebugLocation& location, grpc_closure** closure,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
grpc_closure* c = *closure;
|
||||
*closure = nullptr;
|
||||
ExecCtx::Run(location, c, error);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void Chttp2Connector::OnHandshakeDone(void* arg, grpc_error* error) {
|
||||
void Chttp2Connector::OnHandshakeDone(void* arg, grpc_error_handle error) {
|
||||
auto* args = static_cast<HandshakerArgs*>(arg);
|
||||
Chttp2Connector* self = static_cast<Chttp2Connector*>(args->user_data);
|
||||
{
|
||||
|
|
@ -194,7 +194,7 @@ void Chttp2Connector::OnHandshakeDone(void* arg, grpc_error* error) {
|
|||
self->Unref();
|
||||
}
|
||||
|
||||
void Chttp2Connector::OnReceiveSettings(void* arg, grpc_error* error) {
|
||||
void Chttp2Connector::OnReceiveSettings(void* arg, grpc_error_handle error) {
|
||||
Chttp2Connector* self = static_cast<Chttp2Connector*>(arg);
|
||||
{
|
||||
MutexLock lock(&self->mu_);
|
||||
|
|
@ -220,7 +220,7 @@ void Chttp2Connector::OnReceiveSettings(void* arg, grpc_error* error) {
|
|||
self->Unref();
|
||||
}
|
||||
|
||||
void Chttp2Connector::OnTimeout(void* arg, grpc_error* /*error*/) {
|
||||
void Chttp2Connector::OnTimeout(void* arg, grpc_error_handle /*error*/) {
|
||||
Chttp2Connector* self = static_cast<Chttp2Connector*>(arg);
|
||||
{
|
||||
MutexLock lock(&self->mu_);
|
||||
|
|
@ -245,7 +245,7 @@ void Chttp2Connector::OnTimeout(void* arg, grpc_error* /*error*/) {
|
|||
self->Unref();
|
||||
}
|
||||
|
||||
void Chttp2Connector::MaybeNotify(grpc_error* error) {
|
||||
void Chttp2Connector::MaybeNotify(grpc_error_handle error) {
|
||||
if (notify_error_.has_value()) {
|
||||
GRPC_ERROR_UNREF(error);
|
||||
NullThenSchedClosure(DEBUG_LOCATION, ¬ify_, notify_error_.value());
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@ class Chttp2Connector : public SubchannelConnector {
|
|||
~Chttp2Connector() override;
|
||||
|
||||
void Connect(const Args& args, Result* result, grpc_closure* notify) override;
|
||||
void Shutdown(grpc_error* error) override;
|
||||
void Shutdown(grpc_error_handle error) override;
|
||||
|
||||
private:
|
||||
static void Connected(void* arg, grpc_error* error);
|
||||
static void Connected(void* arg, grpc_error_handle error);
|
||||
void StartHandshakeLocked();
|
||||
static void OnHandshakeDone(void* arg, grpc_error* error);
|
||||
static void OnReceiveSettings(void* arg, grpc_error* error);
|
||||
static void OnTimeout(void* arg, grpc_error* error);
|
||||
static void OnHandshakeDone(void* arg, grpc_error_handle error);
|
||||
static void OnReceiveSettings(void* arg, grpc_error_handle error);
|
||||
static void OnTimeout(void* arg, grpc_error_handle error);
|
||||
|
||||
// We cannot invoke notify_ until both OnTimeout() and OnReceiveSettings()
|
||||
// have been called since that is an indicator to the upper layer that we are
|
||||
|
|
@ -51,7 +51,7 @@ class Chttp2Connector : public SubchannelConnector {
|
|||
// invoked, we call MaybeNotify() again to actually invoke the notify_
|
||||
// callback. Note that this only happens if the handshake is done and the
|
||||
// connector is waiting on the SETTINGS frame.
|
||||
void MaybeNotify(grpc_error* error);
|
||||
void MaybeNotify(grpc_error_handle error);
|
||||
|
||||
Mutex mu_;
|
||||
Args args_;
|
||||
|
|
@ -66,7 +66,7 @@ class Chttp2Connector : public SubchannelConnector {
|
|||
grpc_closure on_receive_settings_;
|
||||
grpc_timer timer_;
|
||||
grpc_closure on_timeout_;
|
||||
absl::optional<grpc_error*> notify_error_;
|
||||
absl::optional<grpc_error_handle> notify_error_;
|
||||
RefCountedPtr<HandshakeManager> handshake_mgr_;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class Chttp2InsecureClientChannelFactory : public ClientChannelFactory {
|
|||
namespace {
|
||||
|
||||
grpc_channel* CreateChannel(const char* target, const grpc_channel_args* args,
|
||||
grpc_error** error) {
|
||||
grpc_error_handle* error) {
|
||||
if (target == nullptr) {
|
||||
gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
|
||||
if (error != nullptr) {
|
||||
|
|
@ -106,7 +106,7 @@ grpc_channel* grpc_insecure_channel_create(const char* target,
|
|||
const char* arg_to_remove = arg.key;
|
||||
grpc_channel_args* new_args = grpc_channel_args_copy_and_add_and_remove(
|
||||
args, &arg_to_remove, 1, &arg, 1);
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
// Create channel.
|
||||
grpc_channel* channel = grpc_core::CreateChannel(target, new_args, &error);
|
||||
// Clean up.
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ grpc_channel* grpc_insecure_channel_create_from_fd(
|
|||
grpc_transport* transport =
|
||||
grpc_create_chttp2_transport(final_args, client, true);
|
||||
GPR_ASSERT(transport);
|
||||
grpc_error* error = nullptr;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
grpc_channel* channel =
|
||||
grpc_channel_create(target, final_args, GRPC_CLIENT_DIRECT_CHANNEL,
|
||||
transport, nullptr, &error);
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ class Chttp2SecureClientChannelFactory : public ClientChannelFactory {
|
|||
namespace {
|
||||
|
||||
grpc_channel* CreateChannel(const char* target, const grpc_channel_args* args,
|
||||
grpc_error** error) {
|
||||
grpc_error_handle* error) {
|
||||
if (target == nullptr) {
|
||||
gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
|
||||
if (error != nullptr) {
|
||||
|
|
@ -181,7 +181,7 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds,
|
|||
4, ((void*)creds, target, (void*)args, (void*)reserved));
|
||||
GPR_ASSERT(reserved == nullptr);
|
||||
grpc_channel* channel = nullptr;
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
if (creds != nullptr) {
|
||||
// Add channel args containing the client channel factory and channel
|
||||
// credentials.
|
||||
|
|
|
|||
|
|
@ -61,14 +61,14 @@ const char kUnixAbstractUriPrefix[] = "unix-abstract:";
|
|||
|
||||
class Chttp2ServerListener : public Server::ListenerInterface {
|
||||
public:
|
||||
static grpc_error* Create(Server* server, grpc_resolved_address* addr,
|
||||
grpc_channel_args* args,
|
||||
Chttp2ServerArgsModifier args_modifier,
|
||||
int* port_num);
|
||||
static grpc_error_handle Create(Server* server, grpc_resolved_address* addr,
|
||||
grpc_channel_args* args,
|
||||
Chttp2ServerArgsModifier args_modifier,
|
||||
int* port_num);
|
||||
|
||||
static grpc_error* CreateWithAcceptor(Server* server, const char* name,
|
||||
grpc_channel_args* args,
|
||||
Chttp2ServerArgsModifier args_modifier);
|
||||
static grpc_error_handle CreateWithAcceptor(
|
||||
Server* server, const char* name, grpc_channel_args* args,
|
||||
Chttp2ServerArgsModifier args_modifier);
|
||||
|
||||
// Do not instantiate directly. Use one of the factory methods above.
|
||||
Chttp2ServerListener(Server* server, grpc_channel_args* args,
|
||||
|
|
@ -122,9 +122,9 @@ class Chttp2ServerListener : public Server::ListenerInterface {
|
|||
using InternallyRefCounted<HandshakingState>::Ref;
|
||||
|
||||
private:
|
||||
static void OnTimeout(void* arg, grpc_error* error);
|
||||
static void OnReceiveSettings(void* arg, grpc_error* /* error */);
|
||||
static void OnHandshakeDone(void* arg, grpc_error* error);
|
||||
static void OnTimeout(void* arg, grpc_error_handle error);
|
||||
static void OnReceiveSettings(void* arg, grpc_error_handle /* error */);
|
||||
static void OnHandshakeDone(void* arg, grpc_error_handle error);
|
||||
RefCountedPtr<ActiveConnection> const connection_;
|
||||
grpc_pollset* const accepting_pollset_;
|
||||
grpc_tcp_server_acceptor* const acceptor_;
|
||||
|
|
@ -155,7 +155,7 @@ class Chttp2ServerListener : public Server::ListenerInterface {
|
|||
using InternallyRefCounted<ActiveConnection>::Ref;
|
||||
|
||||
private:
|
||||
static void OnClose(void* arg, grpc_error* error);
|
||||
static void OnClose(void* arg, grpc_error_handle error);
|
||||
|
||||
RefCountedPtr<Chttp2ServerListener> listener_;
|
||||
Mutex mu_ ABSL_ACQUIRED_AFTER(&listener_->mu_);
|
||||
|
|
@ -179,7 +179,7 @@ class Chttp2ServerListener : public Server::ListenerInterface {
|
|||
grpc_pollset* accepting_pollset,
|
||||
grpc_tcp_server_acceptor* acceptor);
|
||||
|
||||
static void TcpServerShutdownComplete(void* arg, grpc_error* error);
|
||||
static void TcpServerShutdownComplete(void* arg, grpc_error_handle error);
|
||||
|
||||
static void DestroyListener(Server* /*server*/, void* arg,
|
||||
grpc_closure* destroy_done);
|
||||
|
|
@ -259,7 +259,7 @@ void Chttp2ServerListener::ConfigFetcherWatcher::UpdateConnectionManager(
|
|||
if (listener_->started_) return;
|
||||
}
|
||||
int port_temp;
|
||||
grpc_error* error = grpc_tcp_server_add_port(
|
||||
grpc_error_handle error = grpc_tcp_server_add_port(
|
||||
listener_->tcp_server_, &listener_->resolved_address_, &port_temp);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
GRPC_ERROR_UNREF(error);
|
||||
|
|
@ -347,7 +347,7 @@ void Chttp2ServerListener::ActiveConnection::HandshakingState::Start(
|
|||
}
|
||||
|
||||
void Chttp2ServerListener::ActiveConnection::HandshakingState::OnTimeout(
|
||||
void* arg, grpc_error* error) {
|
||||
void* arg, grpc_error_handle error) {
|
||||
HandshakingState* self = static_cast<HandshakingState*>(arg);
|
||||
// Note that we may be called with GRPC_ERROR_NONE when the timer fires
|
||||
// or with an error indicating that the timer system is being shut down.
|
||||
|
|
@ -366,14 +366,14 @@ void Chttp2ServerListener::ActiveConnection::HandshakingState::OnTimeout(
|
|||
}
|
||||
|
||||
void Chttp2ServerListener::ActiveConnection::HandshakingState::
|
||||
OnReceiveSettings(void* arg, grpc_error* /* error */) {
|
||||
OnReceiveSettings(void* arg, grpc_error_handle /* error */) {
|
||||
HandshakingState* self = static_cast<HandshakingState*>(arg);
|
||||
grpc_timer_cancel(&self->timer_);
|
||||
self->Unref();
|
||||
}
|
||||
|
||||
void Chttp2ServerListener::ActiveConnection::HandshakingState::OnHandshakeDone(
|
||||
void* arg, grpc_error* error) {
|
||||
void* arg, grpc_error_handle error) {
|
||||
auto* args = static_cast<HandshakerArgs*>(arg);
|
||||
HandshakingState* self = static_cast<HandshakingState*>(args->user_data);
|
||||
OrphanablePtr<HandshakingState> handshaking_state_ref;
|
||||
|
|
@ -409,7 +409,7 @@ void Chttp2ServerListener::ActiveConnection::HandshakingState::OnHandshakeDone(
|
|||
if (args->endpoint != nullptr) {
|
||||
grpc_transport* transport = grpc_create_chttp2_transport(
|
||||
args->args, args->endpoint, false, resource_user);
|
||||
grpc_error* channel_init_err =
|
||||
grpc_error_handle channel_init_err =
|
||||
self->connection_->listener_->server_->SetupTransport(
|
||||
transport, self->accepting_pollset_, args->args,
|
||||
grpc_chttp2_transport_get_socket_node(transport),
|
||||
|
|
@ -553,8 +553,8 @@ void Chttp2ServerListener::ActiveConnection::Start(
|
|||
handshaking_state_ref->Start(endpoint, args);
|
||||
}
|
||||
|
||||
void Chttp2ServerListener::ActiveConnection::OnClose(void* arg,
|
||||
grpc_error* /* error */) {
|
||||
void Chttp2ServerListener::ActiveConnection::OnClose(
|
||||
void* arg, grpc_error_handle /* error */) {
|
||||
ActiveConnection* self = static_cast<ActiveConnection*>(arg);
|
||||
OrphanablePtr<ActiveConnection> connection;
|
||||
{
|
||||
|
|
@ -577,15 +577,13 @@ void Chttp2ServerListener::ActiveConnection::OnClose(void* arg,
|
|||
// Chttp2ServerListener
|
||||
//
|
||||
|
||||
grpc_error* Chttp2ServerListener::Create(Server* server,
|
||||
grpc_resolved_address* addr,
|
||||
grpc_channel_args* args,
|
||||
Chttp2ServerArgsModifier args_modifier,
|
||||
int* port_num) {
|
||||
grpc_error_handle Chttp2ServerListener::Create(
|
||||
Server* server, grpc_resolved_address* addr, grpc_channel_args* args,
|
||||
Chttp2ServerArgsModifier args_modifier, int* port_num) {
|
||||
Chttp2ServerListener* listener = nullptr;
|
||||
// The bulk of this method is inside of a lambda to make cleanup
|
||||
// easier without using goto.
|
||||
grpc_error* error = [&]() {
|
||||
grpc_error_handle error = [&]() {
|
||||
// Create Chttp2ServerListener.
|
||||
listener = new Chttp2ServerListener(server, args, args_modifier);
|
||||
error = grpc_tcp_server_create(&listener->tcp_server_shutdown_complete_,
|
||||
|
|
@ -627,12 +625,12 @@ grpc_error* Chttp2ServerListener::Create(Server* server,
|
|||
return error;
|
||||
}
|
||||
|
||||
grpc_error* Chttp2ServerListener::CreateWithAcceptor(
|
||||
grpc_error_handle Chttp2ServerListener::CreateWithAcceptor(
|
||||
Server* server, const char* name, grpc_channel_args* args,
|
||||
Chttp2ServerArgsModifier args_modifier) {
|
||||
Chttp2ServerListener* listener =
|
||||
new Chttp2ServerListener(server, args, args_modifier);
|
||||
grpc_error* error = grpc_tcp_server_create(
|
||||
grpc_error_handle error = grpc_tcp_server_create(
|
||||
&listener->tcp_server_shutdown_complete_, args, &listener->tcp_server_);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
delete listener;
|
||||
|
|
@ -710,14 +708,14 @@ void Chttp2ServerListener::OnAccept(void* arg, grpc_endpoint* tcp,
|
|||
args = grpc_channel_args_copy(self->args_);
|
||||
connection_manager = self->connection_manager_;
|
||||
}
|
||||
auto endpoint_cleanup = [&](grpc_error* error) {
|
||||
auto endpoint_cleanup = [&](grpc_error_handle error) {
|
||||
grpc_endpoint_shutdown(tcp, error);
|
||||
grpc_endpoint_destroy(tcp);
|
||||
gpr_free(acceptor);
|
||||
};
|
||||
if (self->server_->config_fetcher() != nullptr) {
|
||||
if (connection_manager == nullptr) {
|
||||
grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
grpc_error_handle error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
||||
"No ConnectionManager configured. Closing connection.");
|
||||
endpoint_cleanup(error);
|
||||
grpc_channel_args_destroy(args);
|
||||
|
|
@ -734,7 +732,7 @@ void Chttp2ServerListener::OnAccept(void* arg, grpc_endpoint* tcp,
|
|||
args_result.status().ToString().c_str()));
|
||||
return;
|
||||
}
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
args = self->args_modifier_(*args_result, &error);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
gpr_log(GPR_DEBUG, "Closing connection: %s", grpc_error_string(error));
|
||||
|
|
@ -781,7 +779,7 @@ void Chttp2ServerListener::OnAccept(void* arg, grpc_endpoint* tcp,
|
|||
}
|
||||
|
||||
void Chttp2ServerListener::TcpServerShutdownComplete(void* arg,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
Chttp2ServerListener* self = static_cast<Chttp2ServerListener*>(arg);
|
||||
self->channelz_listen_socket_.reset();
|
||||
GRPC_ERROR_UNREF(error);
|
||||
|
|
@ -822,19 +820,19 @@ void Chttp2ServerListener::Orphan() {
|
|||
// Chttp2ServerAddPort()
|
||||
//
|
||||
|
||||
grpc_error* Chttp2ServerAddPort(Server* server, const char* addr,
|
||||
grpc_channel_args* args,
|
||||
Chttp2ServerArgsModifier args_modifier,
|
||||
int* port_num) {
|
||||
grpc_error_handle Chttp2ServerAddPort(Server* server, const char* addr,
|
||||
grpc_channel_args* args,
|
||||
Chttp2ServerArgsModifier args_modifier,
|
||||
int* port_num) {
|
||||
if (strncmp(addr, "external:", 9) == 0) {
|
||||
return grpc_core::Chttp2ServerListener::CreateWithAcceptor(
|
||||
server, addr, args, args_modifier);
|
||||
}
|
||||
*port_num = -1;
|
||||
grpc_resolved_addresses* resolved = nullptr;
|
||||
std::vector<grpc_error*> error_list;
|
||||
std::vector<grpc_error_handle> error_list;
|
||||
// Using lambda to avoid use of goto.
|
||||
grpc_error* error = [&]() {
|
||||
grpc_error_handle error = [&]() {
|
||||
if (absl::StartsWith(addr, kUnixUriPrefix)) {
|
||||
error = grpc_resolve_unix_domain_address(
|
||||
addr + sizeof(kUnixUriPrefix) - 1, &resolved);
|
||||
|
|
@ -885,7 +883,7 @@ grpc_error* Chttp2ServerAddPort(Server* server, const char* addr,
|
|||
}
|
||||
return GRPC_ERROR_NONE;
|
||||
}(); // lambda end
|
||||
for (grpc_error* error : error_list) {
|
||||
for (grpc_error_handle error : error_list) {
|
||||
GRPC_ERROR_UNREF(error);
|
||||
}
|
||||
grpc_channel_args_destroy(args);
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ namespace grpc_core {
|
|||
// added to the server. Takes ownership of the args. Caller takes ownership of
|
||||
// returned args. On failure, the error parameter will be set.
|
||||
using Chttp2ServerArgsModifier =
|
||||
std::function<grpc_channel_args*(grpc_channel_args*, grpc_error**)>;
|
||||
std::function<grpc_channel_args*(grpc_channel_args*, grpc_error_handle*)>;
|
||||
|
||||
/// Adds a port to \a server. Sets \a port_num to the port number.
|
||||
/// Takes ownership of \a args.
|
||||
grpc_error* Chttp2ServerAddPort(
|
||||
grpc_error_handle Chttp2ServerAddPort(
|
||||
Server* server, const char* addr, grpc_channel_args* args,
|
||||
Chttp2ServerArgsModifier connection_args_modifier, int* port_num);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
namespace {
|
||||
|
||||
grpc_channel_args* ModifyArgsForConnection(grpc_channel_args* args,
|
||||
grpc_error** /*error*/) {
|
||||
grpc_error_handle* /*error*/) {
|
||||
return args;
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ int grpc_server_add_insecure_http2_port(grpc_server* server, const char* addr) {
|
|||
int port_num = 0;
|
||||
GRPC_API_TRACE("grpc_server_add_insecure_http2_port(server=%p, addr=%s)", 2,
|
||||
(server, addr));
|
||||
grpc_error* err = grpc_core::Chttp2ServerAddPort(
|
||||
grpc_error_handle err = grpc_core::Chttp2ServerAddPort(
|
||||
server->core_server.get(), addr,
|
||||
grpc_channel_args_copy(server->core_server->channel_args()),
|
||||
ModifyArgsForConnection, &port_num);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server* server,
|
|||
grpc_transport* transport = grpc_create_chttp2_transport(
|
||||
server_args, server_endpoint, false /* is_client */);
|
||||
|
||||
grpc_error* error =
|
||||
grpc_error_handle error =
|
||||
core_server->SetupTransport(transport, nullptr, server_args, nullptr);
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
for (grpc_pollset* pollset : core_server->pollsets()) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
namespace {
|
||||
|
||||
grpc_channel_args* ModifyArgsForConnection(grpc_channel_args* args,
|
||||
grpc_error** error) {
|
||||
grpc_error_handle* error) {
|
||||
grpc_server_credentials* server_credentials =
|
||||
grpc_find_server_credentials_in_args(args);
|
||||
if (server_credentials == nullptr) {
|
||||
|
|
@ -69,7 +69,7 @@ grpc_channel_args* ModifyArgsForConnection(grpc_channel_args* args,
|
|||
int grpc_server_add_secure_http2_port(grpc_server* server, const char* addr,
|
||||
grpc_server_credentials* creds) {
|
||||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_error* err = GRPC_ERROR_NONE;
|
||||
grpc_error_handle err = GRPC_ERROR_NONE;
|
||||
grpc_core::RefCountedPtr<grpc_server_security_connector> sc;
|
||||
int port_num = 0;
|
||||
grpc_channel_args* args = nullptr;
|
||||
|
|
|
|||
|
|
@ -100,23 +100,23 @@ grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount(false,
|
|||
"chttp2_refcount");
|
||||
|
||||
// forward declarations of various callbacks that we'll build closures around
|
||||
static void write_action_begin_locked(void* t, grpc_error* error);
|
||||
static void write_action(void* t, grpc_error* error);
|
||||
static void write_action_end(void* t, grpc_error* error);
|
||||
static void write_action_end_locked(void* t, grpc_error* error);
|
||||
static void write_action_begin_locked(void* t, grpc_error_handle error);
|
||||
static void write_action(void* t, grpc_error_handle error);
|
||||
static void write_action_end(void* t, grpc_error_handle error);
|
||||
static void write_action_end_locked(void* t, grpc_error_handle error);
|
||||
|
||||
static void read_action(void* t, grpc_error* error);
|
||||
static void read_action_locked(void* t, grpc_error* error);
|
||||
static void read_action(void* t, grpc_error_handle error);
|
||||
static void read_action_locked(void* t, grpc_error_handle error);
|
||||
static void continue_read_action_locked(grpc_chttp2_transport* t);
|
||||
|
||||
static void complete_fetch(void* gs, grpc_error* error);
|
||||
static void complete_fetch_locked(void* gs, grpc_error* error);
|
||||
static void complete_fetch(void* gs, grpc_error_handle error);
|
||||
static void complete_fetch_locked(void* gs, grpc_error_handle error);
|
||||
// Set a transport level setting, and push it to our peer
|
||||
static void queue_setting_update(grpc_chttp2_transport* t,
|
||||
grpc_chttp2_setting_id id, uint32_t value);
|
||||
|
||||
static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
||||
grpc_error* error);
|
||||
grpc_error_handle error);
|
||||
|
||||
// Start new streams that have been created if we can
|
||||
static void maybe_start_some_streams(grpc_chttp2_transport* t);
|
||||
|
|
@ -126,40 +126,43 @@ static void connectivity_state_set(grpc_chttp2_transport* t,
|
|||
const absl::Status& status,
|
||||
const char* reason);
|
||||
|
||||
static void benign_reclaimer(void* arg, grpc_error* error);
|
||||
static void destructive_reclaimer(void* arg, grpc_error* error);
|
||||
static void benign_reclaimer_locked(void* arg, grpc_error* error);
|
||||
static void destructive_reclaimer_locked(void* arg, grpc_error* error);
|
||||
static void benign_reclaimer(void* arg, grpc_error_handle error);
|
||||
static void destructive_reclaimer(void* arg, grpc_error_handle error);
|
||||
static void benign_reclaimer_locked(void* arg, grpc_error_handle error);
|
||||
static void destructive_reclaimer_locked(void* arg, grpc_error_handle error);
|
||||
|
||||
static void post_benign_reclaimer(grpc_chttp2_transport* t);
|
||||
static void post_destructive_reclaimer(grpc_chttp2_transport* t);
|
||||
|
||||
static void close_transport_locked(grpc_chttp2_transport* t, grpc_error* error);
|
||||
static void end_all_the_calls(grpc_chttp2_transport* t, grpc_error* error);
|
||||
static void close_transport_locked(grpc_chttp2_transport* t,
|
||||
grpc_error_handle error);
|
||||
static void end_all_the_calls(grpc_chttp2_transport* t,
|
||||
grpc_error_handle error);
|
||||
|
||||
static void start_bdp_ping(void* tp, grpc_error* error);
|
||||
static void finish_bdp_ping(void* tp, grpc_error* error);
|
||||
static void start_bdp_ping_locked(void* tp, grpc_error* error);
|
||||
static void finish_bdp_ping_locked(void* tp, grpc_error* error);
|
||||
static void next_bdp_ping_timer_expired(void* tp, grpc_error* error);
|
||||
static void next_bdp_ping_timer_expired_locked(void* tp, grpc_error* error);
|
||||
static void start_bdp_ping(void* tp, grpc_error_handle error);
|
||||
static void finish_bdp_ping(void* tp, grpc_error_handle error);
|
||||
static void start_bdp_ping_locked(void* tp, grpc_error_handle error);
|
||||
static void finish_bdp_ping_locked(void* tp, grpc_error_handle error);
|
||||
static void next_bdp_ping_timer_expired(void* tp, grpc_error_handle error);
|
||||
static void next_bdp_ping_timer_expired_locked(void* tp,
|
||||
grpc_error_handle error);
|
||||
|
||||
static void cancel_pings(grpc_chttp2_transport* t, grpc_error* error);
|
||||
static void cancel_pings(grpc_chttp2_transport* t, grpc_error_handle error);
|
||||
static void send_ping_locked(grpc_chttp2_transport* t,
|
||||
grpc_closure* on_initiate, grpc_closure* on_ack);
|
||||
static void retry_initiate_ping_locked(void* tp, grpc_error* error);
|
||||
static void retry_initiate_ping_locked(void* tp, grpc_error_handle error);
|
||||
|
||||
// keepalive-relevant functions
|
||||
static void init_keepalive_ping(void* arg, grpc_error* error);
|
||||
static void init_keepalive_ping_locked(void* arg, grpc_error* error);
|
||||
static void start_keepalive_ping(void* arg, grpc_error* error);
|
||||
static void finish_keepalive_ping(void* arg, grpc_error* error);
|
||||
static void start_keepalive_ping_locked(void* arg, grpc_error* error);
|
||||
static void finish_keepalive_ping_locked(void* arg, grpc_error* error);
|
||||
static void keepalive_watchdog_fired(void* arg, grpc_error* error);
|
||||
static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error);
|
||||
static void init_keepalive_ping(void* arg, grpc_error_handle error);
|
||||
static void init_keepalive_ping_locked(void* arg, grpc_error_handle error);
|
||||
static void start_keepalive_ping(void* arg, grpc_error_handle error);
|
||||
static void finish_keepalive_ping(void* arg, grpc_error_handle error);
|
||||
static void start_keepalive_ping_locked(void* arg, grpc_error_handle error);
|
||||
static void finish_keepalive_ping_locked(void* arg, grpc_error_handle error);
|
||||
static void keepalive_watchdog_fired(void* arg, grpc_error_handle error);
|
||||
static void keepalive_watchdog_fired_locked(void* arg, grpc_error_handle error);
|
||||
|
||||
static void reset_byte_stream(void* arg, grpc_error* error);
|
||||
static void reset_byte_stream(void* arg, grpc_error_handle error);
|
||||
|
||||
// Flow control default enabled. Can be disabled by setting
|
||||
// GRPC_EXPERIMENTAL_DISABLE_FLOW_CONTROL
|
||||
|
|
@ -203,7 +206,7 @@ grpc_chttp2_transport::~grpc_chttp2_transport() {
|
|||
grpc_slice_buffer_destroy_internal(&outbuf);
|
||||
grpc_chttp2_hpack_compressor_destroy(&hpack_compressor);
|
||||
|
||||
grpc_error* error =
|
||||
grpc_error_handle error =
|
||||
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport destroyed");
|
||||
// ContextList::Execute follows semantics of a callback function and does not
|
||||
// take a ref on error
|
||||
|
|
@ -534,7 +537,7 @@ grpc_chttp2_transport::grpc_chttp2_transport(
|
|||
}
|
||||
}
|
||||
|
||||
static void destroy_transport_locked(void* tp, grpc_error* /*error*/) {
|
||||
static void destroy_transport_locked(void* tp, grpc_error_handle /*error*/) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
||||
t->destroying = 1;
|
||||
close_transport_locked(
|
||||
|
|
@ -552,7 +555,7 @@ static void destroy_transport(grpc_transport* gt) {
|
|||
}
|
||||
|
||||
static void close_transport_locked(grpc_chttp2_transport* t,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
end_all_the_calls(t, GRPC_ERROR_REF(error));
|
||||
cancel_pings(t, GRPC_ERROR_REF(error));
|
||||
if (t->closed_with_error == GRPC_ERROR_NONE) {
|
||||
|
|
@ -731,7 +734,7 @@ static int init_stream(grpc_transport* gt, grpc_stream* gs,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void destroy_stream_locked(void* sp, grpc_error* /*error*/) {
|
||||
static void destroy_stream_locked(void* sp, grpc_error_handle /*error*/) {
|
||||
GPR_TIMER_SCOPE("destroy_stream", 0);
|
||||
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(sp);
|
||||
s->~grpc_chttp2_stream();
|
||||
|
|
@ -819,7 +822,7 @@ static void set_write_state(grpc_chttp2_transport* t,
|
|||
if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) {
|
||||
grpc_core::ExecCtx::RunList(DEBUG_LOCATION, &t->run_after_write);
|
||||
if (t->close_transport_on_writes_finished != nullptr) {
|
||||
grpc_error* err = t->close_transport_on_writes_finished;
|
||||
grpc_error_handle err = t->close_transport_on_writes_finished;
|
||||
t->close_transport_on_writes_finished = nullptr;
|
||||
close_transport_locked(t, err);
|
||||
}
|
||||
|
|
@ -951,7 +954,8 @@ static const char* begin_writing_desc(bool partial) {
|
|||
}
|
||||
}
|
||||
|
||||
static void write_action_begin_locked(void* gt, grpc_error* /*error_ignored*/) {
|
||||
static void write_action_begin_locked(void* gt,
|
||||
grpc_error_handle /*error_ignored*/) {
|
||||
GPR_TIMER_SCOPE("write_action_begin_locked", 0);
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(gt);
|
||||
GPR_ASSERT(t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE);
|
||||
|
|
@ -990,7 +994,7 @@ static void write_action_begin_locked(void* gt, grpc_error* /*error_ignored*/) {
|
|||
}
|
||||
}
|
||||
|
||||
static void write_action(void* gt, grpc_error* /*error*/) {
|
||||
static void write_action(void* gt, grpc_error_handle /*error*/) {
|
||||
GPR_TIMER_SCOPE("write_action", 0);
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(gt);
|
||||
void* cl = t->cl;
|
||||
|
|
@ -1002,7 +1006,7 @@ static void write_action(void* gt, grpc_error* /*error*/) {
|
|||
cl);
|
||||
}
|
||||
|
||||
static void write_action_end(void* tp, grpc_error* error) {
|
||||
static void write_action_end(void* tp, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
||||
t->combiner->Run(GRPC_CLOSURE_INIT(&t->write_action_end_locked,
|
||||
write_action_end_locked, t, nullptr),
|
||||
|
|
@ -1011,7 +1015,7 @@ static void write_action_end(void* tp, grpc_error* error) {
|
|||
|
||||
// Callback from the grpc_endpoint after bytes have been written by calling
|
||||
// sendmsg
|
||||
static void write_action_end_locked(void* tp, grpc_error* error) {
|
||||
static void write_action_end_locked(void* tp, grpc_error_handle error) {
|
||||
GPR_TIMER_SCOPE("terminate_writing_with_lock", 0);
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
||||
|
||||
|
|
@ -1206,7 +1210,8 @@ static void null_then_sched_closure(grpc_closure** closure) {
|
|||
void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* /*s*/,
|
||||
grpc_closure** pclosure,
|
||||
grpc_error* error, const char* desc) {
|
||||
grpc_error_handle error,
|
||||
const char* desc) {
|
||||
grpc_closure* closure = *pclosure;
|
||||
*pclosure = nullptr;
|
||||
if (closure == nullptr) {
|
||||
|
|
@ -1314,7 +1319,8 @@ static void continue_fetching_send_locked(grpc_chttp2_transport* t,
|
|||
UINT32_MAX, GRPC_CLOSURE_INIT(&s->complete_fetch_locked,
|
||||
::complete_fetch, s,
|
||||
grpc_schedule_on_exec_ctx))) {
|
||||
grpc_error* error = s->fetching_send_message->Pull(&s->fetching_slice);
|
||||
grpc_error_handle error =
|
||||
s->fetching_send_message->Pull(&s->fetching_slice);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
s->fetching_send_message.reset();
|
||||
grpc_chttp2_cancel_stream(t, s, error);
|
||||
|
|
@ -1325,14 +1331,14 @@ static void continue_fetching_send_locked(grpc_chttp2_transport* t,
|
|||
}
|
||||
}
|
||||
|
||||
static void complete_fetch(void* gs, grpc_error* error) {
|
||||
static void complete_fetch(void* gs, grpc_error_handle error) {
|
||||
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(gs);
|
||||
s->t->combiner->Run(GRPC_CLOSURE_INIT(&s->complete_fetch_locked,
|
||||
::complete_fetch_locked, s, nullptr),
|
||||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void complete_fetch_locked(void* gs, grpc_error* error) {
|
||||
static void complete_fetch_locked(void* gs, grpc_error_handle error) {
|
||||
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(gs);
|
||||
grpc_chttp2_transport* t = s->t;
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
|
|
@ -1362,7 +1368,7 @@ static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
|
|||
}
|
||||
|
||||
static void perform_stream_op_locked(void* stream_op,
|
||||
grpc_error* /*error_ignored*/) {
|
||||
grpc_error_handle /*error_ignored*/) {
|
||||
GPR_TIMER_SCOPE("perform_stream_op_locked", 0);
|
||||
|
||||
grpc_transport_stream_op_batch* op =
|
||||
|
|
@ -1646,7 +1652,7 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
|
|||
GRPC_ERROR_NONE);
|
||||
}
|
||||
|
||||
static void cancel_pings(grpc_chttp2_transport* t, grpc_error* error) {
|
||||
static void cancel_pings(grpc_chttp2_transport* t, grpc_error_handle error) {
|
||||
// callback remaining pings: they're not allowed to call into the transport,
|
||||
// and maybe they hold resources that need to be freed
|
||||
grpc_chttp2_ping_queue* pq = &t->ping_queue;
|
||||
|
|
@ -1713,14 +1719,14 @@ static void send_keepalive_ping_locked(grpc_chttp2_transport* t) {
|
|||
GRPC_ERROR_NONE);
|
||||
}
|
||||
|
||||
void grpc_chttp2_retry_initiate_ping(void* tp, grpc_error* error) {
|
||||
void grpc_chttp2_retry_initiate_ping(void* tp, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
||||
t->combiner->Run(GRPC_CLOSURE_INIT(&t->retry_initiate_ping_locked,
|
||||
retry_initiate_ping_locked, t, nullptr),
|
||||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void retry_initiate_ping_locked(void* tp, grpc_error* error) {
|
||||
static void retry_initiate_ping_locked(void* tp, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
||||
t->ping_state.is_delayed_ping_timer_set = false;
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
|
|
@ -1743,7 +1749,7 @@ void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id) {
|
|||
}
|
||||
}
|
||||
|
||||
static void send_goaway(grpc_chttp2_transport* t, grpc_error* error) {
|
||||
static void send_goaway(grpc_chttp2_transport* t, grpc_error_handle error) {
|
||||
// We want to log this irrespective of whether http tracing is enabled
|
||||
gpr_log(GPR_INFO, "%s: Sending goaway err=%s", t->peer_string.c_str(),
|
||||
grpc_error_string(error));
|
||||
|
|
@ -1784,7 +1790,7 @@ void grpc_chttp2_reset_ping_clock(grpc_chttp2_transport* t) {
|
|||
}
|
||||
|
||||
static void perform_transport_op_locked(void* stream_op,
|
||||
grpc_error* /*error_ignored*/) {
|
||||
grpc_error_handle /*error_ignored*/) {
|
||||
grpc_transport_op* op = static_cast<grpc_transport_op*>(stream_op);
|
||||
grpc_chttp2_transport* t =
|
||||
static_cast<grpc_chttp2_transport*>(op->handler_private.extra_arg);
|
||||
|
|
@ -1864,7 +1870,7 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(
|
|||
|
||||
void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* /*t*/,
|
||||
grpc_chttp2_stream* s) {
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
if (s->recv_message_ready != nullptr) {
|
||||
*s->recv_message = nullptr;
|
||||
if (s->final_metadata_requested && s->seen_error) {
|
||||
|
|
@ -2014,7 +2020,7 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
|
|||
}
|
||||
|
||||
static void remove_stream(grpc_chttp2_transport* t, uint32_t id,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(
|
||||
grpc_chttp2_stream_map_delete(&t->stream_map, id));
|
||||
GPR_DEBUG_ASSERT(s);
|
||||
|
|
@ -2057,7 +2063,7 @@ static void remove_stream(grpc_chttp2_transport* t, uint32_t id,
|
|||
}
|
||||
|
||||
void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
||||
grpc_error* due_to_error) {
|
||||
grpc_error_handle due_to_error) {
|
||||
if (!t->is_client && !s->sent_trailing_metadata &&
|
||||
grpc_error_has_clear_grpc_status(due_to_error)) {
|
||||
close_from_api(t, s, due_to_error);
|
||||
|
|
@ -2081,7 +2087,7 @@ void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
|||
}
|
||||
|
||||
void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
grpc_status_code status;
|
||||
grpc_slice slice;
|
||||
grpc_error_get_status(error, s->deadline, &status, &slice, nullptr, nullptr);
|
||||
|
|
@ -2118,7 +2124,8 @@ void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
|||
GRPC_ERROR_UNREF(error);
|
||||
}
|
||||
|
||||
static void add_error(grpc_error* error, grpc_error** refs, size_t* nrefs) {
|
||||
static void add_error(grpc_error_handle error, grpc_error_handle* refs,
|
||||
size_t* nrefs) {
|
||||
if (error == GRPC_ERROR_NONE) return;
|
||||
for (size_t i = 0; i < *nrefs; i++) {
|
||||
if (error == refs[i]) {
|
||||
|
|
@ -2129,14 +2136,15 @@ static void add_error(grpc_error* error, grpc_error** refs, size_t* nrefs) {
|
|||
++*nrefs;
|
||||
}
|
||||
|
||||
static grpc_error* removal_error(grpc_error* extra_error, grpc_chttp2_stream* s,
|
||||
const char* main_error_msg) {
|
||||
grpc_error* refs[3];
|
||||
static grpc_error_handle removal_error(grpc_error_handle extra_error,
|
||||
grpc_chttp2_stream* s,
|
||||
const char* main_error_msg) {
|
||||
grpc_error_handle refs[3];
|
||||
size_t nrefs = 0;
|
||||
add_error(s->read_closed_error, refs, &nrefs);
|
||||
add_error(s->write_closed_error, refs, &nrefs);
|
||||
add_error(extra_error, refs, &nrefs);
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
if (nrefs > 0) {
|
||||
error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(main_error_msg,
|
||||
refs, nrefs);
|
||||
|
|
@ -2146,7 +2154,8 @@ static grpc_error* removal_error(grpc_error* extra_error, grpc_chttp2_stream* s,
|
|||
}
|
||||
|
||||
static void flush_write_list(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
||||
grpc_chttp2_write_cb** list, grpc_error* error) {
|
||||
grpc_chttp2_write_cb** list,
|
||||
grpc_error_handle error) {
|
||||
while (*list) {
|
||||
grpc_chttp2_write_cb* cb = *list;
|
||||
*list = cb->next;
|
||||
|
|
@ -2159,7 +2168,8 @@ static void flush_write_list(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
|||
}
|
||||
|
||||
void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s, grpc_error* error) {
|
||||
grpc_chttp2_stream* s,
|
||||
grpc_error_handle error) {
|
||||
error =
|
||||
removal_error(error, s, "Pending writes failed due to stream closure");
|
||||
s->send_initial_metadata = nullptr;
|
||||
|
|
@ -2183,10 +2193,10 @@ void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport* t,
|
|||
|
||||
void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s, int close_reads,
|
||||
int close_writes, grpc_error* error) {
|
||||
int close_writes, grpc_error_handle error) {
|
||||
if (s->read_closed && s->write_closed) {
|
||||
// already closed, but we should still fake the status if needed.
|
||||
grpc_error* overall_error = removal_error(error, s, "Stream removed");
|
||||
grpc_error_handle overall_error = removal_error(error, s, "Stream removed");
|
||||
if (overall_error != GRPC_ERROR_NONE) {
|
||||
grpc_chttp2_fake_status(t, s, overall_error);
|
||||
}
|
||||
|
|
@ -2207,7 +2217,7 @@ void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
|
|||
}
|
||||
if (s->read_closed && s->write_closed) {
|
||||
became_closed = true;
|
||||
grpc_error* overall_error =
|
||||
grpc_error_handle overall_error =
|
||||
removal_error(GRPC_ERROR_REF(error), s, "Stream removed");
|
||||
if (s->id != 0) {
|
||||
remove_stream(t, s->id, GRPC_ERROR_REF(overall_error));
|
||||
|
|
@ -2236,7 +2246,7 @@ void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
|
|||
}
|
||||
|
||||
static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
grpc_slice hdr;
|
||||
grpc_slice status_hdr;
|
||||
grpc_slice http_status_hdr;
|
||||
|
|
@ -2394,7 +2404,7 @@ static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
|||
}
|
||||
|
||||
struct cancel_stream_cb_args {
|
||||
grpc_error* error;
|
||||
grpc_error_handle error;
|
||||
grpc_chttp2_transport* t;
|
||||
};
|
||||
|
||||
|
|
@ -2404,7 +2414,8 @@ static void cancel_stream_cb(void* user_data, uint32_t /*key*/, void* stream) {
|
|||
grpc_chttp2_cancel_stream(args->t, s, GRPC_ERROR_REF(args->error));
|
||||
}
|
||||
|
||||
static void end_all_the_calls(grpc_chttp2_transport* t, grpc_error* error) {
|
||||
static void end_all_the_calls(grpc_chttp2_transport* t,
|
||||
grpc_error_handle error) {
|
||||
intptr_t http2_error;
|
||||
// If there is no explicit grpc or HTTP/2 error, set to UNAVAILABLE on server.
|
||||
if (!t->is_client && !grpc_error_has_clear_grpc_status(error) &&
|
||||
|
|
@ -2458,15 +2469,15 @@ void grpc_chttp2_act_on_flowctl_action(
|
|||
});
|
||||
}
|
||||
|
||||
static grpc_error* try_http_parsing(grpc_chttp2_transport* t) {
|
||||
static grpc_error_handle try_http_parsing(grpc_chttp2_transport* t) {
|
||||
grpc_http_parser parser;
|
||||
size_t i = 0;
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
grpc_http_response response;
|
||||
|
||||
grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response);
|
||||
|
||||
grpc_error* parse_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle parse_error = GRPC_ERROR_NONE;
|
||||
for (; i < t->read_buffer.count && parse_error == GRPC_ERROR_NONE; i++) {
|
||||
parse_error =
|
||||
grpc_http_parser_parse(&parser, t->read_buffer.slices[i], nullptr);
|
||||
|
|
@ -2487,34 +2498,34 @@ static grpc_error* try_http_parsing(grpc_chttp2_transport* t) {
|
|||
return error;
|
||||
}
|
||||
|
||||
static void read_action(void* tp, grpc_error* error) {
|
||||
static void read_action(void* tp, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
||||
t->combiner->Run(
|
||||
GRPC_CLOSURE_INIT(&t->read_action_locked, read_action_locked, t, nullptr),
|
||||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void read_action_locked(void* tp, grpc_error* error) {
|
||||
static void read_action_locked(void* tp, grpc_error_handle error) {
|
||||
GPR_TIMER_SCOPE("reading_action_locked", 0);
|
||||
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
||||
|
||||
GRPC_ERROR_REF(error);
|
||||
|
||||
grpc_error* err = error;
|
||||
grpc_error_handle err = error;
|
||||
if (err != GRPC_ERROR_NONE) {
|
||||
err = grpc_error_set_int(GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
||||
"Endpoint read failed", &err, 1),
|
||||
GRPC_ERROR_INT_OCCURRED_DURING_WRITE,
|
||||
t->write_state);
|
||||
}
|
||||
GPR_SWAP(grpc_error*, err, error);
|
||||
GPR_SWAP(grpc_error_handle, err, error);
|
||||
GRPC_ERROR_UNREF(err);
|
||||
if (t->closed_with_error == GRPC_ERROR_NONE) {
|
||||
GPR_TIMER_SCOPE("reading_action.parse", 0);
|
||||
size_t i = 0;
|
||||
grpc_error* errors[3] = {GRPC_ERROR_REF(error), GRPC_ERROR_NONE,
|
||||
GRPC_ERROR_NONE};
|
||||
grpc_error_handle errors[3] = {GRPC_ERROR_REF(error), GRPC_ERROR_NONE,
|
||||
GRPC_ERROR_NONE};
|
||||
for (; i < t->read_buffer.count && errors[1] == GRPC_ERROR_NONE; i++) {
|
||||
errors[1] = grpc_chttp2_perform_read(t, t->read_buffer.slices[i]);
|
||||
}
|
||||
|
|
@ -2605,14 +2616,14 @@ void schedule_bdp_ping_locked(grpc_chttp2_transport* t) {
|
|||
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_BDP_PING);
|
||||
}
|
||||
|
||||
static void start_bdp_ping(void* tp, grpc_error* error) {
|
||||
static void start_bdp_ping(void* tp, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
||||
t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_bdp_ping_locked,
|
||||
start_bdp_ping_locked, t, nullptr),
|
||||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void start_bdp_ping_locked(void* tp, grpc_error* error) {
|
||||
static void start_bdp_ping_locked(void* tp, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
||||
gpr_log(GPR_INFO, "%s: Start BDP ping err=%s", t->peer_string.c_str(),
|
||||
|
|
@ -2629,14 +2640,14 @@ static void start_bdp_ping_locked(void* tp, grpc_error* error) {
|
|||
t->bdp_ping_started = true;
|
||||
}
|
||||
|
||||
static void finish_bdp_ping(void* tp, grpc_error* error) {
|
||||
static void finish_bdp_ping(void* tp, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
||||
t->combiner->Run(GRPC_CLOSURE_INIT(&t->finish_bdp_ping_locked,
|
||||
finish_bdp_ping_locked, t, nullptr),
|
||||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void finish_bdp_ping_locked(void* tp, grpc_error* error) {
|
||||
static void finish_bdp_ping_locked(void* tp, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
||||
gpr_log(GPR_INFO, "%s: Complete BDP ping err=%s", t->peer_string.c_str(),
|
||||
|
|
@ -2666,7 +2677,7 @@ static void finish_bdp_ping_locked(void* tp, grpc_error* error) {
|
|||
&t->next_bdp_ping_timer_expired_locked);
|
||||
}
|
||||
|
||||
static void next_bdp_ping_timer_expired(void* tp, grpc_error* error) {
|
||||
static void next_bdp_ping_timer_expired(void* tp, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
||||
t->combiner->Run(
|
||||
GRPC_CLOSURE_INIT(&t->next_bdp_ping_timer_expired_locked,
|
||||
|
|
@ -2674,7 +2685,8 @@ static void next_bdp_ping_timer_expired(void* tp, grpc_error* error) {
|
|||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void next_bdp_ping_timer_expired_locked(void* tp, grpc_error* error) {
|
||||
static void next_bdp_ping_timer_expired_locked(void* tp,
|
||||
grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
|
||||
GPR_ASSERT(t->have_next_bdp_ping_timer);
|
||||
t->have_next_bdp_ping_timer = false;
|
||||
|
|
@ -2750,14 +2762,14 @@ void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args,
|
|||
}
|
||||
}
|
||||
|
||||
static void init_keepalive_ping(void* arg, grpc_error* error) {
|
||||
static void init_keepalive_ping(void* arg, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
||||
t->combiner->Run(GRPC_CLOSURE_INIT(&t->init_keepalive_ping_locked,
|
||||
init_keepalive_ping_locked, t, nullptr),
|
||||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void init_keepalive_ping_locked(void* arg, grpc_error* error) {
|
||||
static void init_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
||||
GPR_ASSERT(t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING);
|
||||
if (t->destroying || t->closed_with_error != GRPC_ERROR_NONE) {
|
||||
|
|
@ -2790,14 +2802,14 @@ static void init_keepalive_ping_locked(void* arg, grpc_error* error) {
|
|||
GRPC_CHTTP2_UNREF_TRANSPORT(t, "init keepalive ping");
|
||||
}
|
||||
|
||||
static void start_keepalive_ping(void* arg, grpc_error* error) {
|
||||
static void start_keepalive_ping(void* arg, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
||||
t->combiner->Run(GRPC_CLOSURE_INIT(&t->start_keepalive_ping_locked,
|
||||
start_keepalive_ping_locked, t, nullptr),
|
||||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void start_keepalive_ping_locked(void* arg, grpc_error* error) {
|
||||
static void start_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
return;
|
||||
|
|
@ -2818,14 +2830,14 @@ static void start_keepalive_ping_locked(void* arg, grpc_error* error) {
|
|||
t->keepalive_ping_started = true;
|
||||
}
|
||||
|
||||
static void finish_keepalive_ping(void* arg, grpc_error* error) {
|
||||
static void finish_keepalive_ping(void* arg, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
||||
t->combiner->Run(GRPC_CLOSURE_INIT(&t->finish_keepalive_ping_locked,
|
||||
finish_keepalive_ping_locked, t, nullptr),
|
||||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void finish_keepalive_ping_locked(void* arg, grpc_error* error) {
|
||||
static void finish_keepalive_ping_locked(void* arg, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
||||
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
|
|
@ -2856,7 +2868,7 @@ static void finish_keepalive_ping_locked(void* arg, grpc_error* error) {
|
|||
GRPC_CHTTP2_UNREF_TRANSPORT(t, "keepalive ping end");
|
||||
}
|
||||
|
||||
static void keepalive_watchdog_fired(void* arg, grpc_error* error) {
|
||||
static void keepalive_watchdog_fired(void* arg, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
||||
t->combiner->Run(
|
||||
GRPC_CLOSURE_INIT(&t->keepalive_watchdog_fired_locked,
|
||||
|
|
@ -2864,7 +2876,8 @@ static void keepalive_watchdog_fired(void* arg, grpc_error* error) {
|
|||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error) {
|
||||
static void keepalive_watchdog_fired_locked(void* arg,
|
||||
grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
||||
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
|
|
@ -2921,7 +2934,7 @@ static void set_pollset_set(grpc_transport* gt, grpc_stream* /*gs*/,
|
|||
// BYTE STREAM
|
||||
//
|
||||
|
||||
static void reset_byte_stream(void* arg, grpc_error* error) {
|
||||
static void reset_byte_stream(void* arg, grpc_error_handle error) {
|
||||
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(arg);
|
||||
s->pending_byte_stream = false;
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
|
|
@ -2952,8 +2965,8 @@ Chttp2IncomingByteStream::Chttp2IncomingByteStream(
|
|||
stream->byte_stream_error = GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
void Chttp2IncomingByteStream::OrphanLocked(void* arg,
|
||||
grpc_error* /*error_ignored*/) {
|
||||
void Chttp2IncomingByteStream::OrphanLocked(
|
||||
void* arg, grpc_error_handle /*error_ignored*/) {
|
||||
Chttp2IncomingByteStream* bs = static_cast<Chttp2IncomingByteStream*>(arg);
|
||||
grpc_chttp2_stream* s = bs->stream_;
|
||||
grpc_chttp2_transport* t = s->t;
|
||||
|
|
@ -2972,7 +2985,7 @@ void Chttp2IncomingByteStream::Orphan() {
|
|||
}
|
||||
|
||||
void Chttp2IncomingByteStream::NextLocked(void* arg,
|
||||
grpc_error* /*error_ignored*/) {
|
||||
grpc_error_handle /*error_ignored*/) {
|
||||
Chttp2IncomingByteStream* bs = static_cast<Chttp2IncomingByteStream*>(arg);
|
||||
grpc_chttp2_transport* t = bs->transport_;
|
||||
grpc_chttp2_stream* s = bs->stream_;
|
||||
|
|
@ -3042,9 +3055,9 @@ void Chttp2IncomingByteStream::MaybeCreateStreamDecompressionCtx() {
|
|||
}
|
||||
}
|
||||
|
||||
grpc_error* Chttp2IncomingByteStream::Pull(grpc_slice* slice) {
|
||||
grpc_error_handle Chttp2IncomingByteStream::Pull(grpc_slice* slice) {
|
||||
GPR_TIMER_SCOPE("incoming_byte_stream_pull", 0);
|
||||
grpc_error* error;
|
||||
grpc_error_handle error;
|
||||
if (stream_->unprocessed_incoming_frames_buffer.length > 0) {
|
||||
if (!stream_->unprocessed_incoming_frames_decompressed &&
|
||||
stream_->stream_decompression_method !=
|
||||
|
|
@ -3087,7 +3100,7 @@ grpc_error* Chttp2IncomingByteStream::Pull(grpc_slice* slice) {
|
|||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
void Chttp2IncomingByteStream::PublishError(grpc_error* error) {
|
||||
void Chttp2IncomingByteStream::PublishError(grpc_error_handle error) {
|
||||
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
||||
grpc_core::ExecCtx::Run(DEBUG_LOCATION, stream_->on_next,
|
||||
GRPC_ERROR_REF(error));
|
||||
|
|
@ -3097,10 +3110,10 @@ void Chttp2IncomingByteStream::PublishError(grpc_error* error) {
|
|||
grpc_chttp2_cancel_stream(transport_, stream_, GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
grpc_error* Chttp2IncomingByteStream::Push(const grpc_slice& slice,
|
||||
grpc_slice* slice_out) {
|
||||
grpc_error_handle Chttp2IncomingByteStream::Push(const grpc_slice& slice,
|
||||
grpc_slice* slice_out) {
|
||||
if (remaining_bytes_ < GRPC_SLICE_LENGTH(slice)) {
|
||||
grpc_error* error =
|
||||
grpc_error_handle error =
|
||||
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream");
|
||||
transport_->combiner->Run(&stream_->reset_byte_stream,
|
||||
GRPC_ERROR_REF(error));
|
||||
|
|
@ -3115,8 +3128,8 @@ grpc_error* Chttp2IncomingByteStream::Push(const grpc_slice& slice,
|
|||
}
|
||||
}
|
||||
|
||||
grpc_error* Chttp2IncomingByteStream::Finished(grpc_error* error,
|
||||
bool reset_on_error) {
|
||||
grpc_error_handle Chttp2IncomingByteStream::Finished(grpc_error_handle error,
|
||||
bool reset_on_error) {
|
||||
if (error == GRPC_ERROR_NONE) {
|
||||
if (remaining_bytes_ != 0) {
|
||||
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
|
||||
|
|
@ -3130,7 +3143,7 @@ grpc_error* Chttp2IncomingByteStream::Finished(grpc_error* error,
|
|||
return error;
|
||||
}
|
||||
|
||||
void Chttp2IncomingByteStream::Shutdown(grpc_error* error) {
|
||||
void Chttp2IncomingByteStream::Shutdown(grpc_error_handle error) {
|
||||
GRPC_ERROR_UNREF(Finished(error, true /* reset_on_error */));
|
||||
}
|
||||
|
||||
|
|
@ -3162,14 +3175,14 @@ static void post_destructive_reclaimer(grpc_chttp2_transport* t) {
|
|||
}
|
||||
}
|
||||
|
||||
static void benign_reclaimer(void* arg, grpc_error* error) {
|
||||
static void benign_reclaimer(void* arg, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
||||
t->combiner->Run(GRPC_CLOSURE_INIT(&t->benign_reclaimer_locked,
|
||||
benign_reclaimer_locked, t, nullptr),
|
||||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void benign_reclaimer_locked(void* arg, grpc_error* error) {
|
||||
static void benign_reclaimer_locked(void* arg, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
||||
if (error == GRPC_ERROR_NONE &&
|
||||
grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
||||
|
|
@ -3199,14 +3212,14 @@ static void benign_reclaimer_locked(void* arg, grpc_error* error) {
|
|||
GRPC_CHTTP2_UNREF_TRANSPORT(t, "benign_reclaimer");
|
||||
}
|
||||
|
||||
static void destructive_reclaimer(void* arg, grpc_error* error) {
|
||||
static void destructive_reclaimer(void* arg, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
||||
t->combiner->Run(GRPC_CLOSURE_INIT(&t->destructive_reclaimer_locked,
|
||||
destructive_reclaimer_locked, t, nullptr),
|
||||
GRPC_ERROR_REF(error));
|
||||
}
|
||||
|
||||
static void destructive_reclaimer_locked(void* arg, grpc_error* error) {
|
||||
static void destructive_reclaimer_locked(void* arg, grpc_error_handle error) {
|
||||
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
|
||||
size_t n = grpc_chttp2_stream_map_size(&t->stream_map);
|
||||
t->destructive_reclaimer_registered = false;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
namespace {
|
||||
void (*write_timestamps_callback_g)(void*, grpc_core::Timestamps*,
|
||||
grpc_error* error) = nullptr;
|
||||
grpc_error_handle error) = nullptr;
|
||||
void* (*get_copied_context_fn_g)(void*) = nullptr;
|
||||
} // namespace
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ void ContextList::Append(ContextList** head, grpc_chttp2_stream* s) {
|
|||
}
|
||||
|
||||
void ContextList::Execute(void* arg, grpc_core::Timestamps* ts,
|
||||
grpc_error* error) {
|
||||
grpc_error_handle error) {
|
||||
ContextList* head = static_cast<ContextList*>(arg);
|
||||
ContextList* to_be_freed;
|
||||
while (head != nullptr) {
|
||||
|
|
@ -57,9 +57,8 @@ void ContextList::Execute(void* arg, grpc_core::Timestamps* ts,
|
|||
}
|
||||
}
|
||||
|
||||
void grpc_http2_set_write_timestamps_callback(void (*fn)(void*,
|
||||
grpc_core::Timestamps*,
|
||||
grpc_error* error)) {
|
||||
void grpc_http2_set_write_timestamps_callback(
|
||||
void (*fn)(void*, grpc_core::Timestamps*, grpc_error_handle error)) {
|
||||
write_timestamps_callback_g = fn;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ class ContextList {
|
|||
/* Executes a function \a fn with each context in the list and \a ts. It also
|
||||
* frees up the entire list after this operation. It is intended as a callback
|
||||
* and hence does not take a ref on \a error */
|
||||
static void Execute(void* arg, grpc_core::Timestamps* ts, grpc_error* error);
|
||||
static void Execute(void* arg, grpc_core::Timestamps* ts,
|
||||
grpc_error_handle error);
|
||||
|
||||
private:
|
||||
void* trace_context_ = nullptr;
|
||||
|
|
@ -44,9 +45,8 @@ class ContextList {
|
|||
size_t byte_offset_ = 0;
|
||||
};
|
||||
|
||||
void grpc_http2_set_write_timestamps_callback(void (*fn)(void*,
|
||||
grpc_core::Timestamps*,
|
||||
grpc_error* error));
|
||||
void grpc_http2_set_write_timestamps_callback(
|
||||
void (*fn)(void*, grpc_core::Timestamps*, grpc_error_handle error));
|
||||
void grpc_http2_set_fn_get_copied_context(void* (*fn)(void*));
|
||||
} /* namespace grpc_core */
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ uint32_t TransportFlowControl::MaybeSendUpdate(bool writing_anyway) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
grpc_error* TransportFlowControl::ValidateRecvData(
|
||||
grpc_error_handle TransportFlowControl::ValidateRecvData(
|
||||
int64_t incoming_frame_size) {
|
||||
if (incoming_frame_size > announced_window_) {
|
||||
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
|
|
@ -219,10 +219,10 @@ StreamFlowControl::StreamFlowControl(TransportFlowControl* tfc,
|
|||
const grpc_chttp2_stream* s)
|
||||
: tfc_(tfc), s_(s) {}
|
||||
|
||||
grpc_error* StreamFlowControl::RecvData(int64_t incoming_frame_size) {
|
||||
grpc_error_handle StreamFlowControl::RecvData(int64_t incoming_frame_size) {
|
||||
FlowControlTrace trace(" data recv", tfc_, this);
|
||||
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
error = tfc_->ValidateRecvData(incoming_frame_size);
|
||||
if (error != GRPC_ERROR_NONE) return error;
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ class TransportFlowControlBase {
|
|||
|
||||
// Called to do bookkeeping when a stream owned by this transport receives
|
||||
// data from the wire. Also does error checking for frame size.
|
||||
virtual grpc_error* RecvData(int64_t /* incoming_frame_size */) = 0;
|
||||
virtual grpc_error_handle RecvData(int64_t /* incoming_frame_size */) = 0;
|
||||
|
||||
// Called to do bookkeeping when we receive a WINDOW_UPDATE frame.
|
||||
virtual void RecvUpdate(uint32_t /* size */) = 0;
|
||||
|
|
@ -210,7 +210,7 @@ class TransportFlowControlDisabled final : public TransportFlowControlBase {
|
|||
FlowControlAction MakeAction() override { return FlowControlAction(); }
|
||||
FlowControlAction PeriodicUpdate() override { return FlowControlAction(); }
|
||||
void StreamSentData(int64_t /* size */) override {}
|
||||
grpc_error* RecvData(int64_t /* incoming_frame_size */) override {
|
||||
grpc_error_handle RecvData(int64_t /* incoming_frame_size */) override {
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
void RecvUpdate(uint32_t /* size */) override {}
|
||||
|
|
@ -246,14 +246,14 @@ class TransportFlowControl final : public TransportFlowControlBase {
|
|||
|
||||
void StreamSentData(int64_t size) override { remote_window_ -= size; }
|
||||
|
||||
grpc_error* ValidateRecvData(int64_t incoming_frame_size);
|
||||
grpc_error_handle ValidateRecvData(int64_t incoming_frame_size);
|
||||
void CommitRecvData(int64_t incoming_frame_size) {
|
||||
announced_window_ -= incoming_frame_size;
|
||||
}
|
||||
|
||||
grpc_error* RecvData(int64_t incoming_frame_size) override {
|
||||
grpc_error_handle RecvData(int64_t incoming_frame_size) override {
|
||||
FlowControlTrace trace(" data recv", this, nullptr);
|
||||
grpc_error* error = ValidateRecvData(incoming_frame_size);
|
||||
grpc_error_handle error = ValidateRecvData(incoming_frame_size);
|
||||
if (error != GRPC_ERROR_NONE) return error;
|
||||
CommitRecvData(incoming_frame_size);
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -352,7 +352,7 @@ class StreamFlowControlBase {
|
|||
virtual void SentData(int64_t /* outgoing_frame_size */) = 0;
|
||||
|
||||
// Bookkeeping and error checking for when data is received by this stream.
|
||||
virtual grpc_error* RecvData(int64_t /* incoming_frame_size */) = 0;
|
||||
virtual grpc_error_handle RecvData(int64_t /* incoming_frame_size */) = 0;
|
||||
|
||||
// Called to check if this stream needs to send a WINDOW_UPDATE frame.
|
||||
virtual uint32_t MaybeSendUpdate() = 0;
|
||||
|
|
@ -395,7 +395,7 @@ class StreamFlowControlDisabled : public StreamFlowControlBase {
|
|||
}
|
||||
FlowControlAction MakeAction() override { return FlowControlAction(); }
|
||||
void SentData(int64_t /* outgoing_frame_size */) override {}
|
||||
grpc_error* RecvData(int64_t /* incoming_frame_size */) override {
|
||||
grpc_error_handle RecvData(int64_t /* incoming_frame_size */) override {
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
uint32_t MaybeSendUpdate() override { return 0; }
|
||||
|
|
@ -427,7 +427,7 @@ class StreamFlowControl final : public StreamFlowControlBase {
|
|||
}
|
||||
|
||||
// we have received data from the wire
|
||||
grpc_error* RecvData(int64_t incoming_frame_size) override;
|
||||
grpc_error_handle RecvData(int64_t incoming_frame_size) override;
|
||||
|
||||
// returns an announce if we should send a stream update to our peer, else
|
||||
// returns zero
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ grpc_chttp2_data_parser::~grpc_chttp2_data_parser() {
|
|||
GRPC_ERROR_UNREF(error);
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_data_parser_begin_frame(
|
||||
grpc_error_handle grpc_chttp2_data_parser_begin_frame(
|
||||
grpc_chttp2_data_parser* /*parser*/, uint8_t flags, uint32_t stream_id,
|
||||
grpc_chttp2_stream* s) {
|
||||
if (flags & ~GRPC_CHTTP2_DATA_FLAG_END_STREAM) {
|
||||
|
|
@ -89,11 +89,11 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer* inbuf,
|
|||
stats->data_bytes += write_bytes;
|
||||
}
|
||||
|
||||
grpc_error* grpc_deframe_unprocessed_incoming_frames(
|
||||
grpc_error_handle grpc_deframe_unprocessed_incoming_frames(
|
||||
grpc_chttp2_data_parser* p, grpc_chttp2_stream* s,
|
||||
grpc_slice_buffer* slices, grpc_slice* slice_out,
|
||||
grpc_core::OrphanablePtr<grpc_core::ByteStream>* stream_out) {
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
grpc_chttp2_transport* t = s->t;
|
||||
|
||||
while (slices->count > 0) {
|
||||
|
|
@ -275,11 +275,11 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
|
|||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_data_parser_parse(void* /*parser*/,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last) {
|
||||
grpc_error_handle grpc_chttp2_data_parser_parse(void* /*parser*/,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last) {
|
||||
if (!s->pending_byte_stream) {
|
||||
grpc_slice_ref_internal(slice);
|
||||
grpc_slice_buffer_add(&s->frame_storage, slice);
|
||||
|
|
|
|||
|
|
@ -50,31 +50,31 @@ struct grpc_chttp2_data_parser {
|
|||
grpc_chttp2_stream_state state = GRPC_CHTTP2_DATA_FH_0;
|
||||
uint8_t frame_type = 0;
|
||||
uint32_t frame_size = 0;
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
|
||||
bool is_frame_compressed = false;
|
||||
grpc_core::Chttp2IncomingByteStream* parsing_frame = nullptr;
|
||||
};
|
||||
|
||||
/* start processing a new data frame */
|
||||
grpc_error* grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser* parser,
|
||||
uint8_t flags,
|
||||
uint32_t stream_id,
|
||||
grpc_chttp2_stream* s);
|
||||
grpc_error_handle grpc_chttp2_data_parser_begin_frame(
|
||||
grpc_chttp2_data_parser* parser, uint8_t flags, uint32_t stream_id,
|
||||
grpc_chttp2_stream* s);
|
||||
|
||||
/* handle a slice of a data frame - is_last indicates the last slice of a
|
||||
frame */
|
||||
grpc_error* grpc_chttp2_data_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice, int is_last);
|
||||
grpc_error_handle grpc_chttp2_data_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last);
|
||||
|
||||
void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer* inbuf,
|
||||
uint32_t write_bytes, int is_eof,
|
||||
grpc_transport_one_way_stats* stats,
|
||||
grpc_slice_buffer* outbuf);
|
||||
|
||||
grpc_error* grpc_deframe_unprocessed_incoming_frames(
|
||||
grpc_error_handle grpc_deframe_unprocessed_incoming_frames(
|
||||
grpc_chttp2_data_parser* p, grpc_chttp2_stream* s,
|
||||
grpc_slice_buffer* slices, grpc_slice* slice_out,
|
||||
grpc_core::OrphanablePtr<grpc_core::ByteStream>* stream_out);
|
||||
|
|
|
|||
|
|
@ -36,9 +36,8 @@ void grpc_chttp2_goaway_parser_destroy(grpc_chttp2_goaway_parser* p) {
|
|||
gpr_free(p->debug_data);
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_goaway_parser_begin_frame(grpc_chttp2_goaway_parser* p,
|
||||
uint32_t length,
|
||||
uint8_t /*flags*/) {
|
||||
grpc_error_handle grpc_chttp2_goaway_parser_begin_frame(
|
||||
grpc_chttp2_goaway_parser* p, uint32_t length, uint8_t /*flags*/) {
|
||||
if (length < 8) {
|
||||
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrFormat("goaway frame too short (%d bytes)", length).c_str());
|
||||
|
|
@ -52,11 +51,11 @@ grpc_error* grpc_chttp2_goaway_parser_begin_frame(grpc_chttp2_goaway_parser* p,
|
|||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_goaway_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* /*s*/,
|
||||
const grpc_slice& slice,
|
||||
int is_last) {
|
||||
grpc_error_handle grpc_chttp2_goaway_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* /*s*/,
|
||||
const grpc_slice& slice,
|
||||
int is_last) {
|
||||
const uint8_t* const beg = GRPC_SLICE_START_PTR(slice);
|
||||
const uint8_t* const end = GRPC_SLICE_END_PTR(slice);
|
||||
const uint8_t* cur = beg;
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@ struct grpc_chttp2_goaway_parser {
|
|||
};
|
||||
void grpc_chttp2_goaway_parser_init(grpc_chttp2_goaway_parser* p);
|
||||
void grpc_chttp2_goaway_parser_destroy(grpc_chttp2_goaway_parser* p);
|
||||
grpc_error* grpc_chttp2_goaway_parser_begin_frame(
|
||||
grpc_error_handle grpc_chttp2_goaway_parser_begin_frame(
|
||||
grpc_chttp2_goaway_parser* parser, uint32_t length, uint8_t flags);
|
||||
grpc_error* grpc_chttp2_goaway_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last);
|
||||
grpc_error_handle grpc_chttp2_goaway_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last);
|
||||
|
||||
void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code,
|
||||
const grpc_slice& debug_data,
|
||||
|
|
|
|||
|
|
@ -55,9 +55,8 @@ grpc_slice grpc_chttp2_ping_create(uint8_t ack, uint64_t opaque_8bytes) {
|
|||
return slice;
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser* parser,
|
||||
uint32_t length,
|
||||
uint8_t flags) {
|
||||
grpc_error_handle grpc_chttp2_ping_parser_begin_frame(
|
||||
grpc_chttp2_ping_parser* parser, uint32_t length, uint8_t flags) {
|
||||
if (flags & 0xfe || length != 8) {
|
||||
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrFormat("invalid ping: length=%d, flags=%02x", length, flags)
|
||||
|
|
@ -69,11 +68,11 @@ grpc_error* grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser* parser,
|
|||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_ping_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* /*s*/,
|
||||
const grpc_slice& slice,
|
||||
int is_last) {
|
||||
grpc_error_handle grpc_chttp2_ping_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* /*s*/,
|
||||
const grpc_slice& slice,
|
||||
int is_last) {
|
||||
const uint8_t* const beg = GRPC_SLICE_START_PTR(slice);
|
||||
const uint8_t* const end = GRPC_SLICE_END_PTR(slice);
|
||||
const uint8_t* cur = beg;
|
||||
|
|
|
|||
|
|
@ -31,12 +31,13 @@ struct grpc_chttp2_ping_parser {
|
|||
};
|
||||
grpc_slice grpc_chttp2_ping_create(uint8_t ack, uint64_t opaque_8bytes);
|
||||
|
||||
grpc_error* grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser* parser,
|
||||
uint32_t length, uint8_t flags);
|
||||
grpc_error* grpc_chttp2_ping_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice, int is_last);
|
||||
grpc_error_handle grpc_chttp2_ping_parser_begin_frame(
|
||||
grpc_chttp2_ping_parser* parser, uint32_t length, uint8_t flags);
|
||||
grpc_error_handle grpc_chttp2_ping_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last);
|
||||
|
||||
/* Test-only function for disabling ping ack */
|
||||
void grpc_set_disable_ping_ack(bool disable_ping_ack);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ void grpc_chttp2_add_rst_stream_to_next_write(
|
|||
grpc_chttp2_rst_stream_create(id, code, stats));
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_rst_stream_parser_begin_frame(
|
||||
grpc_error_handle grpc_chttp2_rst_stream_parser_begin_frame(
|
||||
grpc_chttp2_rst_stream_parser* parser, uint32_t length, uint8_t flags) {
|
||||
if (length != 4) {
|
||||
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
|
|
@ -80,11 +80,11 @@ grpc_error* grpc_chttp2_rst_stream_parser_begin_frame(
|
|||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_rst_stream_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last) {
|
||||
grpc_error_handle grpc_chttp2_rst_stream_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last) {
|
||||
const uint8_t* const beg = GRPC_SLICE_START_PTR(slice);
|
||||
const uint8_t* const end = GRPC_SLICE_END_PTR(slice);
|
||||
const uint8_t* cur = beg;
|
||||
|
|
@ -104,7 +104,7 @@ grpc_error* grpc_chttp2_rst_stream_parser_parse(void* parser,
|
|||
((static_cast<uint32_t>(p->reason_bytes[1])) << 16) |
|
||||
((static_cast<uint32_t>(p->reason_bytes[2])) << 8) |
|
||||
((static_cast<uint32_t>(p->reason_bytes[3])));
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
if (reason != GRPC_HTTP2_NO_ERROR || s->metadata_buffer[1].size == 0) {
|
||||
error = grpc_error_set_int(
|
||||
grpc_error_set_str(
|
||||
|
|
|
|||
|
|
@ -39,12 +39,12 @@ void grpc_chttp2_add_rst_stream_to_next_write(
|
|||
grpc_chttp2_transport* t, uint32_t id, uint32_t code,
|
||||
grpc_transport_one_way_stats* stats);
|
||||
|
||||
grpc_error* grpc_chttp2_rst_stream_parser_begin_frame(
|
||||
grpc_error_handle grpc_chttp2_rst_stream_parser_begin_frame(
|
||||
grpc_chttp2_rst_stream_parser* parser, uint32_t length, uint8_t flags);
|
||||
grpc_error* grpc_chttp2_rst_stream_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last);
|
||||
grpc_error_handle grpc_chttp2_rst_stream_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last);
|
||||
|
||||
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H */
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ grpc_slice grpc_chttp2_settings_ack_create(void) {
|
|||
return output;
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_settings_parser_begin_frame(
|
||||
grpc_error_handle grpc_chttp2_settings_parser_begin_frame(
|
||||
grpc_chttp2_settings_parser* parser, uint32_t length, uint8_t flags,
|
||||
uint32_t* settings) {
|
||||
parser->target_settings = settings;
|
||||
|
|
@ -110,10 +110,11 @@ grpc_error* grpc_chttp2_settings_parser_begin_frame(
|
|||
}
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_settings_parser_parse(void* p, grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* /*s*/,
|
||||
const grpc_slice& slice,
|
||||
int is_last) {
|
||||
grpc_error_handle grpc_chttp2_settings_parser_parse(void* p,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* /*s*/,
|
||||
const grpc_slice& slice,
|
||||
int is_last) {
|
||||
grpc_chttp2_settings_parser* parser =
|
||||
static_cast<grpc_chttp2_settings_parser*>(p);
|
||||
const uint8_t* cur = GRPC_SLICE_START_PTR(slice);
|
||||
|
|
|
|||
|
|
@ -49,13 +49,13 @@ grpc_slice grpc_chttp2_settings_create(uint32_t* old_settings,
|
|||
/* Create an ack settings frame */
|
||||
grpc_slice grpc_chttp2_settings_ack_create(void);
|
||||
|
||||
grpc_error* grpc_chttp2_settings_parser_begin_frame(
|
||||
grpc_error_handle grpc_chttp2_settings_parser_begin_frame(
|
||||
grpc_chttp2_settings_parser* parser, uint32_t length, uint8_t flags,
|
||||
uint32_t* settings);
|
||||
grpc_error* grpc_chttp2_settings_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last);
|
||||
grpc_error_handle grpc_chttp2_settings_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last);
|
||||
|
||||
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H */
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ grpc_slice grpc_chttp2_window_update_create(
|
|||
return slice;
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_window_update_parser_begin_frame(
|
||||
grpc_error_handle grpc_chttp2_window_update_parser_begin_frame(
|
||||
grpc_chttp2_window_update_parser* parser, uint32_t length, uint8_t flags) {
|
||||
if (flags || length != 4) {
|
||||
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
|
|
@ -66,11 +66,9 @@ grpc_error* grpc_chttp2_window_update_parser_begin_frame(
|
|||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_window_update_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last) {
|
||||
grpc_error_handle grpc_chttp2_window_update_parser_parse(
|
||||
void* parser, grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice, int is_last) {
|
||||
const uint8_t* const beg = GRPC_SLICE_START_PTR(slice);
|
||||
const uint8_t* const end = GRPC_SLICE_END_PTR(slice);
|
||||
const uint8_t* cur = beg;
|
||||
|
|
|
|||
|
|
@ -33,12 +33,10 @@ struct grpc_chttp2_window_update_parser {
|
|||
grpc_slice grpc_chttp2_window_update_create(
|
||||
uint32_t id, uint32_t window_delta, grpc_transport_one_way_stats* stats);
|
||||
|
||||
grpc_error* grpc_chttp2_window_update_parser_begin_frame(
|
||||
grpc_error_handle grpc_chttp2_window_update_parser_begin_frame(
|
||||
grpc_chttp2_window_update_parser* parser, uint32_t length, uint8_t flags);
|
||||
grpc_error* grpc_chttp2_window_update_parser_parse(void* parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last);
|
||||
grpc_error_handle grpc_chttp2_window_update_parser_parse(
|
||||
void* parser, grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice, int is_last);
|
||||
|
||||
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H */
|
||||
|
|
|
|||
|
|
@ -67,71 +67,82 @@ typedef enum {
|
|||
a set of indirect jumps, and so not waste stack space. */
|
||||
|
||||
/* forward declarations for parsing states */
|
||||
static grpc_error* parse_begin(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error* parse_error(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end, grpc_error* error);
|
||||
static grpc_error* still_parse_error(grpc_chttp2_hpack_parser* p,
|
||||
static grpc_error_handle parse_begin(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error* parse_illegal_op(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error_handle parse_error(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end,
|
||||
grpc_error_handle error);
|
||||
static grpc_error_handle still_parse_error(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_illegal_op(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
|
||||
static grpc_error* parse_string_prefix(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error* parse_key_string(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error* parse_value_string_with_indexed_key(
|
||||
static grpc_error_handle parse_string_prefix(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_key_string(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_value_string_with_indexed_key(
|
||||
grpc_chttp2_hpack_parser* p, const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error* parse_value_string_with_literal_key(
|
||||
static grpc_error_handle parse_value_string_with_literal_key(
|
||||
grpc_chttp2_hpack_parser* p, const uint8_t* cur, const uint8_t* end);
|
||||
|
||||
static grpc_error* parse_value0(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error* parse_value1(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error* parse_value2(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error* parse_value3(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error* parse_value4(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error* parse_value5up(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
|
||||
static grpc_error* parse_indexed_field(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error* parse_indexed_field_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error* parse_lithdr_incidx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error* parse_lithdr_incidx_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error* parse_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error* parse_lithdr_notidx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error* parse_lithdr_notidx_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error* parse_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error* parse_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error* parse_lithdr_nvridx_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error* parse_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error* parse_max_tbl_size(grpc_chttp2_hpack_parser* p,
|
||||
static grpc_error_handle parse_value0(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error* parse_max_tbl_size_x(grpc_chttp2_hpack_parser* p,
|
||||
static grpc_error_handle parse_value1(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error_handle parse_value2(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error_handle parse_value3(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error_handle parse_value4(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
static grpc_error_handle parse_value5up(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end);
|
||||
|
||||
static grpc_error_handle parse_indexed_field(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_indexed_field_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_lithdr_incidx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_lithdr_incidx_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_lithdr_notidx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_lithdr_notidx_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_lithdr_nvridx_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_max_tbl_size(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
static grpc_error_handle parse_max_tbl_size_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end);
|
||||
|
||||
/* we translate the first byte of a hpack field into one of these decoding
|
||||
cases, then use a lookup table to jump directly to the appropriate parser.
|
||||
|
||||
|
|
@ -647,14 +658,14 @@ static void GPR_ATTRIBUTE_NOINLINE on_hdr_log(grpc_mdelem md) {
|
|||
|
||||
/* emission helpers */
|
||||
template <bool do_add>
|
||||
static grpc_error* on_hdr(grpc_chttp2_hpack_parser* p, grpc_mdelem md) {
|
||||
static grpc_error_handle on_hdr(grpc_chttp2_hpack_parser* p, grpc_mdelem md) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_chttp2_hpack_parser)) {
|
||||
on_hdr_log(md);
|
||||
}
|
||||
if (do_add) {
|
||||
GPR_DEBUG_ASSERT(GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_INTERNED ||
|
||||
GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_STATIC);
|
||||
grpc_error* err = grpc_chttp2_hptbl_add(&p->table, md);
|
||||
grpc_error_handle err = grpc_chttp2_hptbl_add(&p->table, md);
|
||||
if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) return err;
|
||||
}
|
||||
return p->on_header(p->on_header_user_data, md);
|
||||
|
|
@ -693,16 +704,16 @@ static grpc_core::ManagedMemorySlice take_string_intern(
|
|||
}
|
||||
|
||||
/* jump to the next state */
|
||||
static grpc_error* parse_next(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_next(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
p->state = *p->next_state++;
|
||||
return p->state(p, cur, end);
|
||||
}
|
||||
|
||||
/* begin parsing a header: all functionality is encoded into lookup tables
|
||||
above */
|
||||
static grpc_error* parse_begin(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_begin(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
if (cur == end) {
|
||||
p->state = parse_begin;
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -712,8 +723,9 @@ static grpc_error* parse_begin(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
|||
}
|
||||
|
||||
/* stream dependency and prioritization data: we just skip it */
|
||||
static grpc_error* parse_stream_weight(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_stream_weight(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
if (cur == end) {
|
||||
p->state = parse_stream_weight;
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -722,8 +734,9 @@ static grpc_error* parse_stream_weight(grpc_chttp2_hpack_parser* p,
|
|||
return p->after_prioritization(p, cur + 1, end);
|
||||
}
|
||||
|
||||
static grpc_error* parse_stream_dep3(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_stream_dep3(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
if (cur == end) {
|
||||
p->state = parse_stream_dep3;
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -732,8 +745,9 @@ static grpc_error* parse_stream_dep3(grpc_chttp2_hpack_parser* p,
|
|||
return parse_stream_weight(p, cur + 1, end);
|
||||
}
|
||||
|
||||
static grpc_error* parse_stream_dep2(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_stream_dep2(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
if (cur == end) {
|
||||
p->state = parse_stream_dep2;
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -742,8 +756,9 @@ static grpc_error* parse_stream_dep2(grpc_chttp2_hpack_parser* p,
|
|||
return parse_stream_dep3(p, cur + 1, end);
|
||||
}
|
||||
|
||||
static grpc_error* parse_stream_dep1(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_stream_dep1(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
if (cur == end) {
|
||||
p->state = parse_stream_dep1;
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -752,8 +767,9 @@ static grpc_error* parse_stream_dep1(grpc_chttp2_hpack_parser* p,
|
|||
return parse_stream_dep2(p, cur + 1, end);
|
||||
}
|
||||
|
||||
static grpc_error* parse_stream_dep0(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_stream_dep0(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
if (cur == end) {
|
||||
p->state = parse_stream_dep0;
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -762,7 +778,7 @@ static grpc_error* parse_stream_dep0(grpc_chttp2_hpack_parser* p,
|
|||
return parse_stream_dep1(p, cur + 1, end);
|
||||
}
|
||||
|
||||
static grpc_error* GPR_ATTRIBUTE_NOINLINE
|
||||
static grpc_error_handle GPR_ATTRIBUTE_NOINLINE
|
||||
on_invalid_hpack_idx(grpc_chttp2_hpack_parser* p) {
|
||||
return grpc_error_set_int(
|
||||
grpc_error_set_int(
|
||||
|
|
@ -772,22 +788,23 @@ on_invalid_hpack_idx(grpc_chttp2_hpack_parser* p) {
|
|||
}
|
||||
|
||||
/* emit an indexed field; jumps to begin the next field on completion */
|
||||
static grpc_error* finish_indexed_field(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle finish_indexed_field(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
grpc_mdelem md = grpc_chttp2_hptbl_lookup<true>(&p->table, p->index);
|
||||
if (GPR_UNLIKELY(GRPC_MDISNULL(md))) {
|
||||
return on_invalid_hpack_idx(p);
|
||||
}
|
||||
GRPC_STATS_INC_HPACK_RECV_INDEXED();
|
||||
grpc_error* err = on_hdr<false>(p, md);
|
||||
grpc_error_handle err = on_hdr<false>(p, md);
|
||||
if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) return err;
|
||||
return parse_begin(p, cur, end);
|
||||
}
|
||||
|
||||
/* parse an indexed field with index < 127 */
|
||||
static grpc_error* parse_indexed_field(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_indexed_field(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
p->dynamic_table_update_allowed = 0;
|
||||
p->index = (*cur) & 0x7f;
|
||||
p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
|
||||
|
|
@ -795,9 +812,9 @@ static grpc_error* parse_indexed_field(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse an indexed field with index >= 127 */
|
||||
static grpc_error* parse_indexed_field_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_indexed_field_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
||||
finish_indexed_field};
|
||||
p->dynamic_table_update_allowed = 0;
|
||||
|
|
@ -830,12 +847,12 @@ static const grpc_core::ManagedMemorySlice& get_indexed_key(grpc_mdelem md) {
|
|||
}
|
||||
|
||||
/* finish a literal header with incremental indexing */
|
||||
static grpc_error* finish_lithdr_incidx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle finish_lithdr_incidx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX();
|
||||
grpc_mdelem md = get_precomputed_md_for_idx(p);
|
||||
grpc_error* err = on_hdr<true>(
|
||||
grpc_error_handle err = on_hdr<true>(
|
||||
p, grpc_mdelem_from_slices(get_indexed_key(md),
|
||||
take_string_intern(p, &p->value)));
|
||||
if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
|
||||
|
|
@ -843,11 +860,11 @@ static grpc_error* finish_lithdr_incidx(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* finish a literal header with incremental indexing with no index */
|
||||
static grpc_error* finish_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle finish_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX_V();
|
||||
grpc_error* err = on_hdr<true>(
|
||||
grpc_error_handle err = on_hdr<true>(
|
||||
p, grpc_mdelem_from_slices(take_string_intern(p, &p->key),
|
||||
take_string_intern(p, &p->value)));
|
||||
if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
|
||||
|
|
@ -855,8 +872,9 @@ static grpc_error* finish_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse a literal header with incremental indexing; index < 63 */
|
||||
static grpc_error* parse_lithdr_incidx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_lithdr_incidx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
||||
parse_value_string_with_indexed_key, finish_lithdr_incidx};
|
||||
p->dynamic_table_update_allowed = 0;
|
||||
|
|
@ -867,9 +885,9 @@ static grpc_error* parse_lithdr_incidx(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse a literal header with incremental indexing; index >= 63 */
|
||||
static grpc_error* parse_lithdr_incidx_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_lithdr_incidx_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
||||
parse_string_prefix, parse_value_string_with_indexed_key,
|
||||
finish_lithdr_incidx};
|
||||
|
|
@ -882,9 +900,9 @@ static grpc_error* parse_lithdr_incidx_x(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse a literal header with incremental indexing; index = 0 */
|
||||
static grpc_error* parse_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
||||
parse_key_string, parse_string_prefix,
|
||||
parse_value_string_with_literal_key, finish_lithdr_incidx_v};
|
||||
|
|
@ -894,12 +912,12 @@ static grpc_error* parse_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* finish a literal header without incremental indexing */
|
||||
static grpc_error* finish_lithdr_notidx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle finish_lithdr_notidx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX();
|
||||
grpc_mdelem md = get_precomputed_md_for_idx(p);
|
||||
grpc_error* err = on_hdr<false>(
|
||||
grpc_error_handle err = on_hdr<false>(
|
||||
p, grpc_mdelem_from_slices(get_indexed_key(md),
|
||||
take_string_extern(p, &p->value)));
|
||||
if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
|
||||
|
|
@ -907,11 +925,11 @@ static grpc_error* finish_lithdr_notidx(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* finish a literal header without incremental indexing with index = 0 */
|
||||
static grpc_error* finish_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle finish_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX_V();
|
||||
grpc_error* err = on_hdr<false>(
|
||||
grpc_error_handle err = on_hdr<false>(
|
||||
p, grpc_mdelem_from_slices(take_string_intern(p, &p->key),
|
||||
take_string_extern(p, &p->value)));
|
||||
if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
|
||||
|
|
@ -919,8 +937,9 @@ static grpc_error* finish_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse a literal header without incremental indexing; index < 15 */
|
||||
static grpc_error* parse_lithdr_notidx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_lithdr_notidx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
||||
parse_value_string_with_indexed_key, finish_lithdr_notidx};
|
||||
p->dynamic_table_update_allowed = 0;
|
||||
|
|
@ -931,9 +950,9 @@ static grpc_error* parse_lithdr_notidx(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse a literal header without incremental indexing; index >= 15 */
|
||||
static grpc_error* parse_lithdr_notidx_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_lithdr_notidx_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
||||
parse_string_prefix, parse_value_string_with_indexed_key,
|
||||
finish_lithdr_notidx};
|
||||
|
|
@ -946,9 +965,9 @@ static grpc_error* parse_lithdr_notidx_x(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse a literal header without incremental indexing; index == 0 */
|
||||
static grpc_error* parse_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
||||
parse_key_string, parse_string_prefix,
|
||||
parse_value_string_with_literal_key, finish_lithdr_notidx_v};
|
||||
|
|
@ -958,12 +977,12 @@ static grpc_error* parse_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* finish a literal header that is never indexed */
|
||||
static grpc_error* finish_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle finish_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX();
|
||||
grpc_mdelem md = get_precomputed_md_for_idx(p);
|
||||
grpc_error* err = on_hdr<false>(
|
||||
grpc_error_handle err = on_hdr<false>(
|
||||
p, grpc_mdelem_from_slices(get_indexed_key(md),
|
||||
take_string_extern(p, &p->value)));
|
||||
if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
|
||||
|
|
@ -971,11 +990,11 @@ static grpc_error* finish_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* finish a literal header that is never indexed with an extra value */
|
||||
static grpc_error* finish_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle finish_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX_V();
|
||||
grpc_error* err = on_hdr<false>(
|
||||
grpc_error_handle err = on_hdr<false>(
|
||||
p, grpc_mdelem_from_slices(take_string_intern(p, &p->key),
|
||||
take_string_extern(p, &p->value)));
|
||||
if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
|
||||
|
|
@ -983,8 +1002,9 @@ static grpc_error* finish_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse a literal header that is never indexed; index < 15 */
|
||||
static grpc_error* parse_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
||||
parse_value_string_with_indexed_key, finish_lithdr_nvridx};
|
||||
p->dynamic_table_update_allowed = 0;
|
||||
|
|
@ -995,9 +1015,9 @@ static grpc_error* parse_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse a literal header that is never indexed; index >= 15 */
|
||||
static grpc_error* parse_lithdr_nvridx_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_lithdr_nvridx_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
||||
parse_string_prefix, parse_value_string_with_indexed_key,
|
||||
finish_lithdr_nvridx};
|
||||
|
|
@ -1010,9 +1030,9 @@ static grpc_error* parse_lithdr_nvridx_x(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse a literal header that is never indexed; index == 0 */
|
||||
static grpc_error* parse_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
||||
parse_key_string, parse_string_prefix,
|
||||
parse_value_string_with_literal_key, finish_lithdr_nvridx_v};
|
||||
|
|
@ -1022,20 +1042,22 @@ static grpc_error* parse_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* finish parsing a max table size change */
|
||||
static grpc_error* finish_max_tbl_size(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle finish_max_tbl_size(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_chttp2_hpack_parser)) {
|
||||
gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index);
|
||||
}
|
||||
grpc_error* err =
|
||||
grpc_error_handle err =
|
||||
grpc_chttp2_hptbl_set_current_table_size(&p->table, p->index);
|
||||
if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
|
||||
return parse_begin(p, cur, end);
|
||||
}
|
||||
|
||||
/* parse a max table size change, max size < 15 */
|
||||
static grpc_error* parse_max_tbl_size(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_max_tbl_size(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
if (p->dynamic_table_update_allowed == 0) {
|
||||
return parse_error(
|
||||
p, cur, end,
|
||||
|
|
@ -1049,9 +1071,9 @@ static grpc_error* parse_max_tbl_size(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse a max table size change, max size >= 15 */
|
||||
static grpc_error* parse_max_tbl_size_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_max_tbl_size_x(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
||||
finish_max_tbl_size};
|
||||
if (p->dynamic_table_update_allowed == 0) {
|
||||
|
|
@ -1069,9 +1091,10 @@ static grpc_error* parse_max_tbl_size_x(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* a parse error: jam the parse state into parse_error, and return error */
|
||||
static grpc_error* parse_error(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* /*cur*/, const uint8_t* /*end*/,
|
||||
grpc_error* err) {
|
||||
static grpc_error_handle parse_error(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* /*cur*/,
|
||||
const uint8_t* /*end*/,
|
||||
grpc_error_handle err) {
|
||||
GPR_ASSERT(err != GRPC_ERROR_NONE);
|
||||
if (p->last_error == GRPC_ERROR_NONE) {
|
||||
p->last_error = GRPC_ERROR_REF(err);
|
||||
|
|
@ -1080,24 +1103,25 @@ static grpc_error* parse_error(grpc_chttp2_hpack_parser* p,
|
|||
return err;
|
||||
}
|
||||
|
||||
static grpc_error* still_parse_error(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* /*cur*/,
|
||||
const uint8_t* /*end*/) {
|
||||
static grpc_error_handle still_parse_error(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* /*cur*/,
|
||||
const uint8_t* /*end*/) {
|
||||
return GRPC_ERROR_REF(p->last_error);
|
||||
}
|
||||
|
||||
static grpc_error* parse_illegal_op(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_illegal_op(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
GPR_ASSERT(cur != end);
|
||||
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
grpc_error_handle err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrCat("Illegal hpack op code ", *cur).c_str());
|
||||
return parse_error(p, cur, end, err);
|
||||
}
|
||||
|
||||
/* parse the 1st byte of a varint into p->parsing.value
|
||||
no overflow is possible */
|
||||
static grpc_error* parse_value0(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_value0(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
if (cur == end) {
|
||||
p->state = parse_value0;
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -1114,8 +1138,8 @@ static grpc_error* parse_value0(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
|||
|
||||
/* parse the 2nd byte of a varint into p->parsing.value
|
||||
no overflow is possible */
|
||||
static grpc_error* parse_value1(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_value1(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
if (cur == end) {
|
||||
p->state = parse_value1;
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -1132,8 +1156,8 @@ static grpc_error* parse_value1(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
|||
|
||||
/* parse the 3rd byte of a varint into p->parsing.value
|
||||
no overflow is possible */
|
||||
static grpc_error* parse_value2(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_value2(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
if (cur == end) {
|
||||
p->state = parse_value2;
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -1150,8 +1174,8 @@ static grpc_error* parse_value2(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
|||
|
||||
/* parse the 4th byte of a varint into p->parsing.value
|
||||
no overflow is possible */
|
||||
static grpc_error* parse_value3(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_value3(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
if (cur == end) {
|
||||
p->state = parse_value3;
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -1168,8 +1192,8 @@ static grpc_error* parse_value3(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
|||
|
||||
/* parse the 5th byte of a varint into p->parsing.value
|
||||
depending on the byte, we may overflow, and care must be taken */
|
||||
static grpc_error* parse_value4(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_value4(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
uint8_t c;
|
||||
uint32_t cur_value;
|
||||
uint32_t add_value;
|
||||
|
|
@ -1199,7 +1223,7 @@ static grpc_error* parse_value4(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
|||
}
|
||||
|
||||
error:
|
||||
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
grpc_error_handle err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrFormat(
|
||||
"integer overflow in hpack integer decoding: have 0x%08x, "
|
||||
"got byte 0x%02x on byte 5",
|
||||
|
|
@ -1211,8 +1235,9 @@ error:
|
|||
/* parse any trailing bytes in a varint: it's possible to append an arbitrary
|
||||
number of 0x80's and not affect the value - a zero will terminate - and
|
||||
anything else will overflow */
|
||||
static grpc_error* parse_value5up(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_value5up(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
while (cur != end && *cur == 0x80) {
|
||||
++cur;
|
||||
}
|
||||
|
|
@ -1226,7 +1251,7 @@ static grpc_error* parse_value5up(grpc_chttp2_hpack_parser* p,
|
|||
return parse_next(p, cur + 1, end);
|
||||
}
|
||||
|
||||
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
grpc_error_handle err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrFormat(
|
||||
"integer overflow in hpack integer decoding: have 0x%08x, "
|
||||
"got byte 0x%02x sometime after byte 5",
|
||||
|
|
@ -1236,8 +1261,9 @@ static grpc_error* parse_value5up(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse a string prefix */
|
||||
static grpc_error* parse_string_prefix(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_string_prefix(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
if (cur == end) {
|
||||
p->state = parse_string_prefix;
|
||||
return GRPC_ERROR_NONE;
|
||||
|
|
@ -1269,8 +1295,8 @@ static void append_bytes(grpc_chttp2_hpack_parser_string* str,
|
|||
str->data.copied.length += static_cast<uint32_t>(length);
|
||||
}
|
||||
|
||||
static grpc_error* append_string(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle append_string(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
grpc_chttp2_hpack_parser_string* str = p->parsing.str;
|
||||
uint32_t bits;
|
||||
uint8_t decoded[3];
|
||||
|
|
@ -1372,8 +1398,8 @@ static grpc_error* append_string(grpc_chttp2_hpack_parser* p,
|
|||
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Should never reach here")));
|
||||
}
|
||||
|
||||
static grpc_error* finish_str(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle finish_str(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
uint8_t decoded[2];
|
||||
uint32_t bits;
|
||||
grpc_chttp2_hpack_parser_string* str = p->parsing.str;
|
||||
|
|
@ -1391,7 +1417,7 @@ static grpc_error* finish_str(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
|||
case B64_BYTE2:
|
||||
bits = p->base64_buffer;
|
||||
if (bits & 0xffff) {
|
||||
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
grpc_error_handle err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrFormat("trailing bits in base64 encoding: 0x%04x",
|
||||
bits & 0xffff)
|
||||
.c_str());
|
||||
|
|
@ -1403,7 +1429,7 @@ static grpc_error* finish_str(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
|||
case B64_BYTE3:
|
||||
bits = p->base64_buffer;
|
||||
if (bits & 0xff) {
|
||||
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
grpc_error_handle err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
||||
absl::StrFormat("trailing bits in base64 encoding: 0x%02x",
|
||||
bits & 0xff)
|
||||
.c_str());
|
||||
|
|
@ -1418,13 +1444,14 @@ static grpc_error* finish_str(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
|||
}
|
||||
|
||||
/* decode a nibble from a huffman encoded stream */
|
||||
static grpc_error* huff_nibble(grpc_chttp2_hpack_parser* p, uint8_t nibble) {
|
||||
static grpc_error_handle huff_nibble(grpc_chttp2_hpack_parser* p,
|
||||
uint8_t nibble) {
|
||||
int16_t emit = emit_sub_tbl[16 * emit_tbl[p->huff_state] + nibble];
|
||||
int16_t next = next_sub_tbl[16 * next_tbl[p->huff_state] + nibble];
|
||||
if (emit != -1) {
|
||||
if (emit >= 0 && emit < 256) {
|
||||
uint8_t c = static_cast<uint8_t>(emit);
|
||||
grpc_error* err = append_string(p, &c, (&c) + 1);
|
||||
grpc_error_handle err = append_string(p, &c, (&c) + 1);
|
||||
if (err != GRPC_ERROR_NONE) return err;
|
||||
} else {
|
||||
assert(emit == 256);
|
||||
|
|
@ -1435,10 +1462,11 @@ static grpc_error* huff_nibble(grpc_chttp2_hpack_parser* p, uint8_t nibble) {
|
|||
}
|
||||
|
||||
/* decode full bytes from a huffman encoded stream */
|
||||
static grpc_error* add_huff_bytes(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle add_huff_bytes(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
for (; cur != end; ++cur) {
|
||||
grpc_error* err = huff_nibble(p, *cur >> 4);
|
||||
grpc_error_handle err = huff_nibble(p, *cur >> 4);
|
||||
if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
|
||||
err = huff_nibble(p, *cur & 0xf);
|
||||
if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
|
||||
|
|
@ -1448,8 +1476,8 @@ static grpc_error* add_huff_bytes(grpc_chttp2_hpack_parser* p,
|
|||
|
||||
/* decode some string bytes based on the current decoding mode
|
||||
(huffman or not) */
|
||||
static grpc_error* add_str_bytes(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle add_str_bytes(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
if (p->huff) {
|
||||
return add_huff_bytes(p, cur, end);
|
||||
} else {
|
||||
|
|
@ -1458,18 +1486,18 @@ static grpc_error* add_str_bytes(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse a string - tries to do large chunks at a time */
|
||||
static grpc_error* parse_string(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
static grpc_error_handle parse_string(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
size_t remaining = p->strlen - p->strgot;
|
||||
size_t given = static_cast<size_t>(end - cur);
|
||||
if (remaining <= given) {
|
||||
grpc_error* err = add_str_bytes(p, cur, cur + remaining);
|
||||
grpc_error_handle err = add_str_bytes(p, cur, cur + remaining);
|
||||
if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
|
||||
err = finish_str(p, cur + remaining, end);
|
||||
if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
|
||||
return parse_next(p, cur + remaining, end);
|
||||
} else {
|
||||
grpc_error* err = add_str_bytes(p, cur, cur + given);
|
||||
grpc_error_handle err = add_str_bytes(p, cur, cur + given);
|
||||
if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
|
||||
GPR_ASSERT(given <= UINT32_MAX - p->strgot);
|
||||
p->strgot += static_cast<uint32_t>(given);
|
||||
|
|
@ -1479,10 +1507,9 @@ static grpc_error* parse_string(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
|||
}
|
||||
|
||||
/* begin parsing a string - performs setup, calls parse_string */
|
||||
static grpc_error* begin_parse_string(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end,
|
||||
uint8_t binary,
|
||||
grpc_chttp2_hpack_parser_string* str) {
|
||||
static grpc_error_handle begin_parse_string(
|
||||
grpc_chttp2_hpack_parser* p, const uint8_t* cur, const uint8_t* end,
|
||||
uint8_t binary, grpc_chttp2_hpack_parser_string* str) {
|
||||
if (!p->huff && binary == NOT_BINARY &&
|
||||
static_cast<uint32_t>(end - cur) >= p->strlen &&
|
||||
p->current_slice_refcount != nullptr) {
|
||||
|
|
@ -1518,8 +1545,9 @@ static grpc_error* begin_parse_string(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse the key string */
|
||||
static grpc_error* parse_key_string(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end) {
|
||||
static grpc_error_handle parse_key_string(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end) {
|
||||
return begin_parse_string(p, cur, end, NOT_BINARY, &p->key);
|
||||
}
|
||||
|
||||
|
|
@ -1554,8 +1582,8 @@ static void set_precomputed_md_idx(grpc_chttp2_hpack_parser* p,
|
|||
is a binary indexed header during string parsing. We'll need to revisit this
|
||||
metadata when we're done parsing, so we cache the metadata for this index
|
||||
here using set_precomputed_md_idx(). */
|
||||
static grpc_error* is_binary_indexed_header(grpc_chttp2_hpack_parser* p,
|
||||
bool* is) {
|
||||
static grpc_error_handle is_binary_indexed_header(grpc_chttp2_hpack_parser* p,
|
||||
bool* is) {
|
||||
grpc_mdelem elem = grpc_chttp2_hptbl_lookup(&p->table, p->index);
|
||||
if (GPR_UNLIKELY(GRPC_MDISNULL(elem))) {
|
||||
return on_invalid_hpack_idx(p);
|
||||
|
|
@ -1574,29 +1602,30 @@ static grpc_error* is_binary_indexed_header(grpc_chttp2_hpack_parser* p,
|
|||
}
|
||||
|
||||
/* parse the value string */
|
||||
static grpc_error* parse_value_string(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur, const uint8_t* end,
|
||||
bool is_binary) {
|
||||
static grpc_error_handle parse_value_string(grpc_chttp2_hpack_parser* p,
|
||||
const uint8_t* cur,
|
||||
const uint8_t* end,
|
||||
bool is_binary) {
|
||||
return begin_parse_string(p, cur, end, is_binary ? BINARY_BEGIN : NOT_BINARY,
|
||||
&p->value);
|
||||
}
|
||||
|
||||
static grpc_error* parse_value_string_with_indexed_key(
|
||||
static grpc_error_handle parse_value_string_with_indexed_key(
|
||||
grpc_chttp2_hpack_parser* p, const uint8_t* cur, const uint8_t* end) {
|
||||
bool is_binary = false;
|
||||
grpc_error* err = is_binary_indexed_header(p, &is_binary);
|
||||
grpc_error_handle err = is_binary_indexed_header(p, &is_binary);
|
||||
if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
|
||||
return parse_value_string(p, cur, end, is_binary);
|
||||
}
|
||||
|
||||
static grpc_error* parse_value_string_with_literal_key(
|
||||
static grpc_error_handle parse_value_string_with_literal_key(
|
||||
grpc_chttp2_hpack_parser* p, const uint8_t* cur, const uint8_t* end) {
|
||||
return parse_value_string(p, cur, end, is_binary_literal_header(p));
|
||||
}
|
||||
|
||||
/* "Uninitialized" header parser to save us a branch in on_hdr(). */
|
||||
static grpc_error* on_header_uninitialized(void* /*user_data*/,
|
||||
grpc_mdelem md) {
|
||||
static grpc_error_handle on_header_uninitialized(void* /*user_data*/,
|
||||
grpc_mdelem md) {
|
||||
GRPC_MDELEM_UNREF(md);
|
||||
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("on_header callback not set");
|
||||
}
|
||||
|
|
@ -1645,15 +1674,15 @@ void grpc_chttp2_hpack_parser_destroy(grpc_chttp2_hpack_parser* p) {
|
|||
gpr_free(p->value.data.copied.str);
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_hpack_parser_parse(grpc_chttp2_hpack_parser* p,
|
||||
const grpc_slice& slice) {
|
||||
grpc_error_handle grpc_chttp2_hpack_parser_parse(grpc_chttp2_hpack_parser* p,
|
||||
const grpc_slice& slice) {
|
||||
/* max number of bytes to parse at a time... limits call stack depth on
|
||||
* compilers without TCO */
|
||||
#define MAX_PARSE_LENGTH 1024
|
||||
p->current_slice_refcount = slice.refcount;
|
||||
const uint8_t* start = GRPC_SLICE_START_PTR(slice);
|
||||
const uint8_t* end = GRPC_SLICE_END_PTR(slice);
|
||||
grpc_error* error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle error = GRPC_ERROR_NONE;
|
||||
while (start != end && error == GRPC_ERROR_NONE) {
|
||||
const uint8_t* target = start + GPR_MIN(MAX_PARSE_LENGTH, end - start);
|
||||
error = p->state(p, start, target);
|
||||
|
|
@ -1669,7 +1698,7 @@ static const maybe_complete_func_type maybe_complete_funcs[] = {
|
|||
grpc_chttp2_maybe_complete_recv_initial_metadata,
|
||||
grpc_chttp2_maybe_complete_recv_trailing_metadata};
|
||||
|
||||
static void force_client_rst_stream(void* sp, grpc_error* /*error*/) {
|
||||
static void force_client_rst_stream(void* sp, grpc_error_handle /*error*/) {
|
||||
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(sp);
|
||||
grpc_chttp2_transport* t = s->t;
|
||||
if (!s->write_closed) {
|
||||
|
|
@ -1699,18 +1728,18 @@ static void parse_stream_compression_md(grpc_chttp2_transport* /*t*/,
|
|||
}
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_header_parser_parse(void* hpack_parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last) {
|
||||
grpc_error_handle grpc_chttp2_header_parser_parse(void* hpack_parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last) {
|
||||
GPR_TIMER_SCOPE("grpc_chttp2_header_parser_parse", 0);
|
||||
grpc_chttp2_hpack_parser* parser =
|
||||
static_cast<grpc_chttp2_hpack_parser*>(hpack_parser);
|
||||
if (s != nullptr) {
|
||||
s->stats.incoming.header_bytes += GRPC_SLICE_LENGTH(slice);
|
||||
}
|
||||
grpc_error* error = grpc_chttp2_hpack_parser_parse(parser, slice);
|
||||
grpc_error_handle error = grpc_chttp2_hpack_parser_parse(parser, slice);
|
||||
if (error != GRPC_ERROR_NONE) {
|
||||
return error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
typedef struct grpc_chttp2_hpack_parser grpc_chttp2_hpack_parser;
|
||||
|
||||
typedef grpc_error* (*grpc_chttp2_hpack_parser_state)(
|
||||
typedef grpc_error_handle (*grpc_chttp2_hpack_parser_state)(
|
||||
grpc_chttp2_hpack_parser* p, const uint8_t* beg, const uint8_t* end);
|
||||
|
||||
struct grpc_chttp2_hpack_parser_string {
|
||||
|
|
@ -45,10 +45,10 @@ struct grpc_chttp2_hpack_parser_string {
|
|||
};
|
||||
struct grpc_chttp2_hpack_parser {
|
||||
/* user specified callback for each header output */
|
||||
grpc_error* (*on_header)(void* user_data, grpc_mdelem md);
|
||||
grpc_error_handle (*on_header)(void* user_data, grpc_mdelem md);
|
||||
void* on_header_user_data;
|
||||
|
||||
grpc_error* last_error;
|
||||
grpc_error_handle last_error;
|
||||
|
||||
/* current parse state - or a function that implements it */
|
||||
grpc_chttp2_hpack_parser_state state;
|
||||
|
|
@ -103,15 +103,15 @@ void grpc_chttp2_hpack_parser_destroy(grpc_chttp2_hpack_parser* p);
|
|||
|
||||
void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser* p);
|
||||
|
||||
grpc_error* grpc_chttp2_hpack_parser_parse(grpc_chttp2_hpack_parser* p,
|
||||
const grpc_slice& slice);
|
||||
grpc_error_handle grpc_chttp2_hpack_parser_parse(grpc_chttp2_hpack_parser* p,
|
||||
const grpc_slice& slice);
|
||||
|
||||
/* wraps grpc_chttp2_hpack_parser_parse to provide a frame level parser for
|
||||
the transport */
|
||||
grpc_error* grpc_chttp2_header_parser_parse(void* hpack_parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last);
|
||||
grpc_error_handle grpc_chttp2_header_parser_parse(void* hpack_parser,
|
||||
grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
const grpc_slice& slice,
|
||||
int is_last);
|
||||
|
||||
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H */
|
||||
|
|
|
|||
|
|
@ -114,8 +114,8 @@ void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl* tbl,
|
|||
tbl->max_bytes = max_bytes;
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl* tbl,
|
||||
uint32_t bytes) {
|
||||
grpc_error_handle grpc_chttp2_hptbl_set_current_table_size(
|
||||
grpc_chttp2_hptbl* tbl, uint32_t bytes) {
|
||||
if (tbl->current_table_bytes == bytes) {
|
||||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
|
@ -145,7 +145,8 @@ grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl* tbl,
|
|||
return GRPC_ERROR_NONE;
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_hptbl_add(grpc_chttp2_hptbl* tbl, grpc_mdelem md) {
|
||||
grpc_error_handle grpc_chttp2_hptbl_add(grpc_chttp2_hptbl* tbl,
|
||||
grpc_mdelem md) {
|
||||
/* determine how many bytes of buffer this entry represents */
|
||||
size_t elem_bytes = GRPC_SLICE_LENGTH(GRPC_MDKEY(md)) +
|
||||
GRPC_SLICE_LENGTH(GRPC_MDVALUE(md)) +
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ struct grpc_chttp2_hptbl {
|
|||
void grpc_chttp2_hptbl_destroy(grpc_chttp2_hptbl* tbl);
|
||||
void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl* tbl,
|
||||
uint32_t max_bytes);
|
||||
grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl* tbl,
|
||||
uint32_t bytes);
|
||||
grpc_error_handle grpc_chttp2_hptbl_set_current_table_size(
|
||||
grpc_chttp2_hptbl* tbl, uint32_t bytes);
|
||||
|
||||
/* lookup a table entry based on its hpack index */
|
||||
grpc_mdelem grpc_chttp2_hptbl_lookup_dynamic_index(const grpc_chttp2_hptbl* tbl,
|
||||
|
|
@ -117,8 +117,8 @@ inline grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl,
|
|||
}
|
||||
}
|
||||
/* add a table entry to the index */
|
||||
grpc_error* grpc_chttp2_hptbl_add(grpc_chttp2_hptbl* tbl,
|
||||
grpc_mdelem md) GRPC_MUST_USE_RESULT;
|
||||
grpc_error_handle grpc_chttp2_hptbl_add(grpc_chttp2_hptbl* tbl,
|
||||
grpc_mdelem md) GRPC_MUST_USE_RESULT;
|
||||
|
||||
size_t grpc_chttp2_get_size_in_hpack_table(grpc_mdelem elem,
|
||||
bool use_true_binary_metadata);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include <grpc/support/alloc.h>
|
||||
#include <grpc/support/log.h>
|
||||
|
||||
grpc_error* grpc_chttp2_incoming_metadata_buffer_add(
|
||||
grpc_error_handle grpc_chttp2_incoming_metadata_buffer_add(
|
||||
grpc_chttp2_incoming_metadata_buffer* buffer, grpc_mdelem elem) {
|
||||
buffer->size += GRPC_MDELEM_LENGTH(elem);
|
||||
grpc_linked_mdelem* storage;
|
||||
|
|
@ -42,7 +42,7 @@ grpc_error* grpc_chttp2_incoming_metadata_buffer_add(
|
|||
return grpc_metadata_batch_link_tail(&buffer->batch, storage);
|
||||
}
|
||||
|
||||
grpc_error* grpc_chttp2_incoming_metadata_buffer_replace_or_add(
|
||||
grpc_error_handle grpc_chttp2_incoming_metadata_buffer_replace_or_add(
|
||||
grpc_chttp2_incoming_metadata_buffer* buffer, grpc_mdelem elem) {
|
||||
for (grpc_linked_mdelem* l = buffer->batch.list.head; l != nullptr;
|
||||
l = l->next) {
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ struct grpc_chttp2_incoming_metadata_buffer {
|
|||
void grpc_chttp2_incoming_metadata_buffer_publish(
|
||||
grpc_chttp2_incoming_metadata_buffer* buffer, grpc_metadata_batch* batch);
|
||||
|
||||
grpc_error* grpc_chttp2_incoming_metadata_buffer_add(
|
||||
grpc_error_handle grpc_chttp2_incoming_metadata_buffer_add(
|
||||
grpc_chttp2_incoming_metadata_buffer* buffer,
|
||||
grpc_mdelem elem) GRPC_MUST_USE_RESULT;
|
||||
grpc_error* grpc_chttp2_incoming_metadata_buffer_replace_or_add(
|
||||
grpc_error_handle grpc_chttp2_incoming_metadata_buffer_replace_or_add(
|
||||
grpc_chttp2_incoming_metadata_buffer* buffer,
|
||||
grpc_mdelem elem) GRPC_MUST_USE_RESULT;
|
||||
void grpc_chttp2_incoming_metadata_buffer_set_deadline(
|
||||
|
|
|
|||
|
|
@ -217,8 +217,8 @@ class Chttp2IncomingByteStream : public ByteStream {
|
|||
void Orphan() override;
|
||||
|
||||
bool Next(size_t max_size_hint, grpc_closure* on_complete) override;
|
||||
grpc_error* Pull(grpc_slice* slice) override;
|
||||
void Shutdown(grpc_error* error) override;
|
||||
grpc_error_handle Pull(grpc_slice* slice) override;
|
||||
void Shutdown(grpc_error_handle error) override;
|
||||
|
||||
// TODO(roth): When I converted this class to C++, I wanted to make it
|
||||
// inherit from RefCounted or InternallyRefCounted instead of continuing
|
||||
|
|
@ -241,17 +241,17 @@ class Chttp2IncomingByteStream : public ByteStream {
|
|||
}
|
||||
}
|
||||
|
||||
void PublishError(grpc_error* error);
|
||||
void PublishError(grpc_error_handle error);
|
||||
|
||||
grpc_error* Push(const grpc_slice& slice, grpc_slice* slice_out);
|
||||
grpc_error_handle Push(const grpc_slice& slice, grpc_slice* slice_out);
|
||||
|
||||
grpc_error* Finished(grpc_error* error, bool reset_on_error);
|
||||
grpc_error_handle Finished(grpc_error_handle error, bool reset_on_error);
|
||||
|
||||
uint32_t remaining_bytes() const { return remaining_bytes_; }
|
||||
|
||||
private:
|
||||
static void NextLocked(void* arg, grpc_error* error_ignored);
|
||||
static void OrphanLocked(void* arg, grpc_error* error_ignored);
|
||||
static void NextLocked(void* arg, grpc_error_handle error_ignored);
|
||||
static void OrphanLocked(void* arg, grpc_error_handle error_ignored);
|
||||
|
||||
void MaybeCreateStreamDecompressionCtx();
|
||||
|
||||
|
|
@ -309,7 +309,7 @@ struct grpc_chttp2_transport {
|
|||
/** is the transport destroying itself? */
|
||||
uint8_t destroying = false;
|
||||
/** has the upper layer closed the transport? */
|
||||
grpc_error* closed_with_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle closed_with_error = GRPC_ERROR_NONE;
|
||||
|
||||
/** is there a read request to the endpoint outstanding? */
|
||||
uint8_t endpoint_reading = 1;
|
||||
|
|
@ -358,7 +358,7 @@ struct grpc_chttp2_transport {
|
|||
|
||||
/** Set to a grpc_error object if a goaway frame is received. By default, set
|
||||
* to GRPC_ERROR_NONE */
|
||||
grpc_error* goaway_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle goaway_error = GRPC_ERROR_NONE;
|
||||
|
||||
grpc_chttp2_sent_goaway_state sent_goaway_state = GRPC_CHTTP2_NO_GOAWAY_SEND;
|
||||
|
||||
|
|
@ -428,9 +428,9 @@ struct grpc_chttp2_transport {
|
|||
/* active parser */
|
||||
void* parser_data = nullptr;
|
||||
grpc_chttp2_stream* incoming_stream = nullptr;
|
||||
grpc_error* (*parser)(void* parser_user_data, grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s, const grpc_slice& slice,
|
||||
int is_last);
|
||||
grpc_error_handle (*parser)(void* parser_user_data, grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s, const grpc_slice& slice,
|
||||
int is_last);
|
||||
|
||||
grpc_chttp2_write_cb* write_cb_pool = nullptr;
|
||||
|
||||
|
|
@ -443,7 +443,7 @@ struct grpc_chttp2_transport {
|
|||
|
||||
/* if non-NULL, close the transport with this error when writes are finished
|
||||
*/
|
||||
grpc_error* close_transport_on_writes_finished = GRPC_ERROR_NONE;
|
||||
grpc_error_handle close_transport_on_writes_finished = GRPC_ERROR_NONE;
|
||||
|
||||
/* a list of closures to run after writes are finished */
|
||||
grpc_closure_list run_after_write = GRPC_CLOSURE_LIST_INIT;
|
||||
|
|
@ -581,9 +581,9 @@ struct grpc_chttp2_stream {
|
|||
bool eos_sent = false;
|
||||
|
||||
/** the error that resulted in this stream being read-closed */
|
||||
grpc_error* read_closed_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle read_closed_error = GRPC_ERROR_NONE;
|
||||
/** the error that resulted in this stream being write-closed */
|
||||
grpc_error* write_closed_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle write_closed_error = GRPC_ERROR_NONE;
|
||||
|
||||
grpc_published_metadata_method published_metadata[2] = {};
|
||||
bool final_metadata_requested = false;
|
||||
|
|
@ -604,13 +604,14 @@ struct grpc_chttp2_stream {
|
|||
* true */
|
||||
grpc_slice_buffer unprocessed_incoming_frames_buffer;
|
||||
grpc_closure reset_byte_stream;
|
||||
grpc_error* byte_stream_error = GRPC_ERROR_NONE; /* protected by t combiner */
|
||||
bool received_last_frame = false; /* protected by t combiner */
|
||||
grpc_error_handle byte_stream_error =
|
||||
GRPC_ERROR_NONE; /* protected by t combiner */
|
||||
bool received_last_frame = false; /* protected by t combiner */
|
||||
|
||||
grpc_millis deadline = GRPC_MILLIS_INF_FUTURE;
|
||||
|
||||
/** saw some stream level error */
|
||||
grpc_error* forced_close_error = GRPC_ERROR_NONE;
|
||||
grpc_error_handle forced_close_error = GRPC_ERROR_NONE;
|
||||
/** how many header frames have we received? */
|
||||
uint8_t header_frames_received = 0;
|
||||
/** parsing state for data frames */
|
||||
|
|
@ -696,12 +697,12 @@ struct grpc_chttp2_begin_write_result {
|
|||
};
|
||||
grpc_chttp2_begin_write_result grpc_chttp2_begin_write(
|
||||
grpc_chttp2_transport* t);
|
||||
void grpc_chttp2_end_write(grpc_chttp2_transport* t, grpc_error* error);
|
||||
void grpc_chttp2_end_write(grpc_chttp2_transport* t, grpc_error_handle error);
|
||||
|
||||
/** Process one slice of incoming data; return 1 if the connection is still
|
||||
viable after reading, or 0 if the connection should be torn down */
|
||||
grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
|
||||
const grpc_slice& slice);
|
||||
grpc_error_handle grpc_chttp2_perform_read(grpc_chttp2_transport* t,
|
||||
const grpc_slice& slice);
|
||||
|
||||
bool grpc_chttp2_list_add_writable_stream(grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s);
|
||||
|
|
@ -771,7 +772,8 @@ void grpc_chttp2_parsing_become_skip_parser(grpc_chttp2_transport* t);
|
|||
void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s,
|
||||
grpc_closure** pclosure,
|
||||
grpc_error* error, const char* desc);
|
||||
grpc_error_handle error,
|
||||
const char* desc);
|
||||
|
||||
#define GRPC_HEADER_SIZE_IN_BYTES 5
|
||||
#define MAX_SIZE_T (~(size_t)0)
|
||||
|
|
@ -791,10 +793,11 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
|
|||
} while (0)
|
||||
|
||||
void grpc_chttp2_fake_status(grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* stream, grpc_error* error);
|
||||
grpc_chttp2_stream* stream,
|
||||
grpc_error_handle error);
|
||||
void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s, int close_reads,
|
||||
int close_writes, grpc_error* error);
|
||||
int close_writes, grpc_error_handle error);
|
||||
void grpc_chttp2_start_writing(grpc_chttp2_transport* t);
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
|
@ -862,7 +865,7 @@ void grpc_chttp2_mark_stream_writable(grpc_chttp2_transport* t,
|
|||
grpc_chttp2_stream* s);
|
||||
|
||||
void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
|
||||
grpc_error* due_to_error);
|
||||
grpc_error_handle due_to_error);
|
||||
|
||||
void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s);
|
||||
|
|
@ -872,14 +875,15 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
|
|||
grpc_chttp2_stream* s);
|
||||
|
||||
void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport* t,
|
||||
grpc_chttp2_stream* s, grpc_error* error);
|
||||
grpc_chttp2_stream* s,
|
||||
grpc_error_handle error);
|
||||
|
||||
/** Set the default keepalive configurations, must only be called at
|
||||
initialization */
|
||||
void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args,
|
||||
bool is_client);
|
||||
|
||||
void grpc_chttp2_retry_initiate_ping(void* tp, grpc_error* error);
|
||||
void grpc_chttp2_retry_initiate_ping(void* tp, grpc_error_handle error);
|
||||
|
||||
void schedule_bdp_ping_locked(grpc_chttp2_transport* t);
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue