aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/transport
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-05-06 14:26:12 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-05-06 14:26:12 -0700
commitf707d62db625e3929680d165f2fbc67f9c8d3f9c (patch)
tree0741e3319b8a90ffe177752e8743db416de4f066 /src/core/lib/transport
parentddad97899654c1eb3805ec165e842f8f465702a1 (diff)
Convert tests to new error scheme
Diffstat (limited to 'src/core/lib/transport')
-rw-r--r--src/core/lib/transport/connectivity_state.c11
-rw-r--r--src/core/lib/transport/transport.c6
2 files changed, 9 insertions, 8 deletions
diff --git a/src/core/lib/transport/connectivity_state.c b/src/core/lib/transport/connectivity_state.c
index c6b274a5da..6df32a3a30 100644
--- a/src/core/lib/transport/connectivity_state.c
+++ b/src/core/lib/transport/connectivity_state.c
@@ -61,6 +61,7 @@ void grpc_connectivity_state_init(grpc_connectivity_state_tracker *tracker,
grpc_connectivity_state init_state,
const char *name) {
tracker->current_state = init_state;
+ tracker->current_error = GRPC_ERROR_NONE;
tracker->watchers = NULL;
tracker->name = gpr_strdup(name);
}
@@ -69,7 +70,6 @@ void grpc_connectivity_state_destroy(grpc_exec_ctx *exec_ctx,
grpc_connectivity_state_tracker *tracker) {
grpc_error *error;
grpc_connectivity_state_watcher *w;
- grpc_error_unref(tracker->current_error);
while ((w = tracker->watchers)) {
tracker->watchers = w->next;
@@ -82,6 +82,7 @@ void grpc_connectivity_state_destroy(grpc_exec_ctx *exec_ctx,
grpc_exec_ctx_push(exec_ctx, w->notify, error, NULL);
gpr_free(w);
}
+ GRPC_ERROR_UNREF(tracker->current_error);
gpr_free(tracker->name);
}
@@ -92,7 +93,7 @@ grpc_connectivity_state grpc_connectivity_state_check(
grpc_connectivity_state_name(tracker->current_state));
}
if (error != NULL) {
- *error = grpc_error_ref(tracker->current_error);
+ *error = GRPC_ERROR_REF(tracker->current_error);
}
return tracker->current_state;
}
@@ -132,7 +133,7 @@ int grpc_connectivity_state_notify_on_state_change(
} else {
if (tracker->current_state != *current) {
*current = tracker->current_state;
- grpc_exec_ctx_push(exec_ctx, notify, GRPC_ERROR_NONE, NULL);
+ grpc_exec_ctx_push(exec_ctx, notify, GRPC_ERROR_REF(tracker->current_error), NULL);
} else {
grpc_connectivity_state_watcher *w = gpr_malloc(sizeof(*w));
w->current = current;
@@ -165,7 +166,7 @@ void grpc_connectivity_state_set(grpc_exec_ctx *exec_ctx,
GPR_ASSERT(error != GRPC_ERROR_NONE);
break;
}
- grpc_error_unref(tracker->current_error);
+ GRPC_ERROR_UNREF(tracker->current_error);
tracker->current_error = error;
if (tracker->current_state == state) {
return;
@@ -176,7 +177,7 @@ void grpc_connectivity_state_set(grpc_exec_ctx *exec_ctx,
*w->current = tracker->current_state;
tracker->watchers = w->next;
grpc_exec_ctx_push(exec_ctx, w->notify,
- grpc_error_ref(tracker->current_error), NULL);
+ GRPC_ERROR_REF(tracker->current_error), NULL);
gpr_free(w);
}
}
diff --git a/src/core/lib/transport/transport.c b/src/core/lib/transport/transport.c
index f7362973a9..fdf0f4b2aa 100644
--- a/src/core/lib/transport/transport.c
+++ b/src/core/lib/transport/transport.c
@@ -146,10 +146,10 @@ char *grpc_transport_get_peer(grpc_exec_ctx *exec_ctx,
void grpc_transport_stream_op_finish_with_failure(grpc_exec_ctx *exec_ctx,
grpc_transport_stream_op *op,
grpc_error *error) {
- grpc_exec_ctx_push(exec_ctx, op->recv_message_ready, grpc_error_ref(error),
+ grpc_exec_ctx_push(exec_ctx, op->recv_message_ready, GRPC_ERROR_REF(error),
NULL);
grpc_exec_ctx_push(exec_ctx, op->recv_initial_metadata_ready,
- grpc_error_ref(error), NULL);
+ GRPC_ERROR_REF(error), NULL);
grpc_exec_ctx_push(exec_ctx, op->on_complete, error, NULL);
}
@@ -178,7 +178,7 @@ static void free_message(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) {
close_message_data *cmd = p;
gpr_slice_unref(cmd->message);
if (cmd->then_call != NULL) {
- cmd->then_call->cb(exec_ctx, cmd->then_call->cb_arg, grpc_error_ref(error));
+ cmd->then_call->cb(exec_ctx, cmd->then_call->cb_arg, GRPC_ERROR_REF(error));
}
gpr_free(cmd);
}