aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-05-07 16:18:43 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-05-07 16:18:43 -0700
commit1c51edc4bc7e44883e5acc3942104fafe35099c6 (patch)
tree2e2b9d4cfbde2475d858d0cc73f899ffa7c22814 /src/core
parent1aee5362f43ece8eb77ba219c163f1169d0d0b24 (diff)
Progress converting to new error system
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ext/client_config/client_channel.c45
-rw-r--r--src/core/lib/iomgr/error.c4
-rw-r--r--src/core/lib/support/avl.c2
-rw-r--r--src/core/lib/surface/call.c2
-rw-r--r--src/core/lib/surface/lame_client.c1
5 files changed, 31 insertions, 23 deletions
diff --git a/src/core/ext/client_config/client_channel.c b/src/core/ext/client_config/client_channel.c
index eaefa3be6d..7c6b19d558 100644
--- a/src/core/ext/client_config/client_channel.c
+++ b/src/core/ext/client_config/client_channel.c
@@ -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);
}
diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c
index bc50d6870f..cc0265737a 100644
--- a/src/core/lib/iomgr/error.c
+++ b/src/core/lib/iomgr/error.c
@@ -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);
diff --git a/src/core/lib/support/avl.c b/src/core/lib/support/avl.c
index 8d3ce23e6c..ceded9d266 100644
--- a/src/core/lib/support/avl.c
+++ b/src/core/lib/support/avl.c
@@ -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; }
diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c
index 046f2903ff..66bdb7b213 100644
--- a/src/core/lib/surface/call.c
+++ b/src/core/lib/surface/call.c
@@ -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");
}
diff --git a/src/core/lib/surface/lame_client.c b/src/core/lib/surface/lame_client.c
index d6dfa0f164..4b76c53941 100644
--- a/src/core/lib/surface/lame_client.c
+++ b/src/core/lib/surface/lame_client.c
@@ -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,