aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/client_config
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-05-10 20:49:54 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-05-10 20:49:54 -0700
commitcfc8ae16b13116f598defe7a58931d80dd781578 (patch)
tree1ae9a0962bce8e6fc7533219c80b41969ae32afa /src/core/ext/client_config
parentf5929c5dac59197e64cbb13312e0533878780ee5 (diff)
Fix connectivity bits
Diffstat (limited to 'src/core/ext/client_config')
-rw-r--r--src/core/ext/client_config/channel_connectivity.c12
-rw-r--r--src/core/ext/client_config/subchannel.c6
2 files changed, 14 insertions, 4 deletions
diff --git a/src/core/ext/client_config/channel_connectivity.c b/src/core/ext/client_config/channel_connectivity.c
index ac685e11ea..bef43d84ca 100644
--- a/src/core/ext/client_config/channel_connectivity.c
+++ b/src/core/ext/client_config/channel_connectivity.c
@@ -131,6 +131,10 @@ static void partly_done(grpc_exec_ctx *exec_ctx, state_watcher *w,
}
gpr_mu_lock(&w->mu);
+ const char *msg = grpc_error_string(error);
+ gpr_log(GPR_DEBUG, "partly_done: d2c=%d phs=%d err=%s", due_to_completion, w->phase, msg);
+ grpc_error_free_string(msg);
+
if (due_to_completion) {
GRPC_ERROR_UNREF(w->error);
w->error = GRPC_ERROR_NONE;
@@ -155,16 +159,18 @@ static void partly_done(grpc_exec_ctx *exec_ctx, state_watcher *w,
if (delete) {
delete_state_watcher(exec_ctx, w);
}
+
+ GRPC_ERROR_UNREF(error);
}
static void watch_complete(grpc_exec_ctx *exec_ctx, void *pw,
grpc_error *error) {
- partly_done(exec_ctx, pw, true, error);
+ partly_done(exec_ctx, pw, true, GRPC_ERROR_REF(error));
}
static void timeout_complete(grpc_exec_ctx *exec_ctx, void *pw,
grpc_error *error) {
- partly_done(exec_ctx, pw, false, error);
+ partly_done(exec_ctx, pw, false, GRPC_ERROR_REF(error));
}
void grpc_channel_watch_connectivity_state(
@@ -189,7 +195,7 @@ void grpc_channel_watch_connectivity_state(
grpc_closure_init(&w->on_complete, watch_complete, w);
w->phase = WAITING;
w->state = last_observed_state;
- w->error = GRPC_ERROR_CREATE("Some error");
+ w->error = GRPC_ERROR_CREATE("Timeout waiting for channel state");
w->cq = cq;
w->tag = tag;
w->channel = channel;
diff --git a/src/core/ext/client_config/subchannel.c b/src/core/ext/client_config/subchannel.c
index ead28dbd12..3bfba47ea9 100644
--- a/src/core/ext/client_config/subchannel.c
+++ b/src/core/ext/client_config/subchannel.c
@@ -605,7 +605,7 @@ static void on_alarm(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
} else {
GRPC_ERROR_REF(error);
}
- if (error != GRPC_ERROR_NONE) {
+ if (error == GRPC_ERROR_NONE) {
const char *msg = grpc_error_string(error);
gpr_log(GPR_INFO, "Failed to connect to channel, retrying: %s", msg);
grpc_error_free_string(msg);
@@ -639,6 +639,10 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
exec_ctx, &c->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_CREATE_REFERENCING("Connect Failed", &error, 1),
"connect_failed");
+ gpr_timespec time_til_next = gpr_time_sub(c->next_attempt, gpr_now(c->next_attempt.clock_type));
+ const char *errmsg = grpc_error_string(error);
+ gpr_log(GPR_INFO, "Connect failed, retry in %d.%09d seconds: %s", time_til_next.tv_sec, time_til_next.tv_nsec, errmsg);
+ grpc_error_free_string(errmsg);
grpc_timer_init(exec_ctx, &c->alarm, c->next_attempt, on_alarm, c, now);
}
gpr_mu_unlock(&c->mu);