Progress converting to new error system

pull/6897/head
Craig Tiller 9 years ago
parent 1aee5362f4
commit 1c51edc4bc
  1. 2
      include/grpc/support/avl.h
  2. 45
      src/core/ext/client_config/client_channel.c
  3. 4
      src/core/lib/iomgr/error.c
  4. 2
      src/core/lib/support/avl.c
  5. 2
      src/core/lib/surface/call.c
  6. 1
      src/core/lib/surface/lame_client.c

@ -88,5 +88,7 @@ GPRAPI gpr_avl gpr_avl_remove(gpr_avl avl, void *key);
does not mutate avl.
returns NULL if key is not found. */
GPRAPI void *gpr_avl_get(gpr_avl avl, void *key);
/** Return 1 if avl is empty, 0 otherwise */
GPRAPI int gpr_avl_is_empty(gpr_avl avl);
#endif /* GRPC_SUPPORT_AVL_H */

@ -129,7 +129,7 @@ static void set_channel_connectivity_state_locked(grpc_exec_ctx *exec_ctx,
/* check= */ 0);
}
grpc_connectivity_state_set(exec_ctx, &chand->state_tracker, state,
GRPC_ERROR_REF(error), reason);
error, reason);
}
static void on_lb_policy_state_changed_locked(grpc_exec_ctx *exec_ctx,
@ -228,7 +228,7 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
}
if (error == GRPC_ERROR_NONE && chand->resolver) {
set_channel_connectivity_state_locked(exec_ctx, chand, state, state_error,
set_channel_connectivity_state_locked(exec_ctx, chand, state, GRPC_ERROR_REF(state_error),
"new_lb+resolver");
if (lb_policy != NULL) {
watch_lb_policy(exec_ctx, chand, lb_policy, state);
@ -305,26 +305,29 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
op->send_ping = NULL;
}
if (op->disconnect_with_error != GRPC_ERROR_NONE && chand->resolver != NULL) {
set_channel_connectivity_state_locked(
exec_ctx, chand, GRPC_CHANNEL_FATAL_FAILURE,
GRPC_ERROR_REF(op->disconnect_with_error), "disconnect");
grpc_resolver_shutdown(exec_ctx, chand->resolver);
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
chand->resolver = NULL;
if (!chand->started_resolving) {
grpc_closure_list_fail_all(&chand->waiting_for_config_closures,
op->disconnect_with_error);
grpc_exec_ctx_enqueue_list(exec_ctx, &chand->waiting_for_config_closures,
NULL);
}
if (chand->lb_policy != NULL) {
grpc_pollset_set_del_pollset_set(exec_ctx,
chand->lb_policy->interested_parties,
chand->interested_parties);
GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "channel");
chand->lb_policy = NULL;
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
if (chand->resolver != NULL) {
set_channel_connectivity_state_locked(
exec_ctx, chand, GRPC_CHANNEL_FATAL_FAILURE,
GRPC_ERROR_REF(op->disconnect_with_error), "disconnect");
grpc_resolver_shutdown(exec_ctx, chand->resolver);
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
chand->resolver = NULL;
if (!chand->started_resolving) {
grpc_closure_list_fail_all(&chand->waiting_for_config_closures,
GRPC_ERROR_REF(op->disconnect_with_error));
grpc_exec_ctx_enqueue_list(exec_ctx, &chand->waiting_for_config_closures,
NULL);
}
if (chand->lb_policy != NULL) {
grpc_pollset_set_del_pollset_set(exec_ctx,
chand->lb_policy->interested_parties,
chand->interested_parties);
GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "channel");
chand->lb_policy = NULL;
}
}
GRPC_ERROR_UNREF(op->disconnect_with_error);
}
gpr_mu_unlock(&chand->mu_config);
}

@ -453,7 +453,9 @@ const char *grpc_error_string(grpc_error *err) {
collect_kvs(err->ints.root, key_int, fmt_int, &kvs);
collect_kvs(err->strs.root, key_str, fmt_str, &kvs);
collect_kvs(err->times.root, key_time, fmt_time, &kvs);
append_kv(&kvs, gpr_strdup("referenced_errors"), errs_string(err));
if (!gpr_avl_is_empty(err->errs)) {
append_kv(&kvs, gpr_strdup("referenced_errors"), errs_string(err));
}
qsort(kvs.kvs, kvs.num_kvs, sizeof(kv_pair), cmp_kvs);

@ -286,3 +286,5 @@ gpr_avl gpr_avl_ref(gpr_avl avl) {
}
void gpr_avl_unref(gpr_avl avl) { unref_node(avl.vtable, avl.root); }
int gpr_avl_is_empty(gpr_avl avl) { return avl.root == NULL; }

@ -780,7 +780,7 @@ static void call_alarm(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
grpc_call *call = arg;
gpr_mu_lock(&call->mu);
call->have_alarm = 0;
if (error != GRPC_ERROR_NONE) {
if (error != GRPC_ERROR_CANCELLED) {
cancel_with_status(exec_ctx, call, GRPC_STATUS_DEADLINE_EXCEEDED,
"Deadline Exceeded");
}

@ -104,6 +104,7 @@ static void lame_start_transport_op(grpc_exec_ctx *exec_ctx,
op->send_ping->cb(exec_ctx, op->send_ping->cb_arg,
GRPC_ERROR_CREATE("lame client channel"));
}
GRPC_ERROR_UNREF(op->disconnect_with_error);
}
static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,

Loading…
Cancel
Save