aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-07-28 09:13:38 -0700
committerGravatar Mark D. Roth <roth@google.com>2016-07-28 09:13:38 -0700
commit9530e8af0570760017d9212f959ca93e23c6f7a3 (patch)
tree88a853440f67bce29c796680d200db283f97e8a9
parentdaf626c3bba0266a090661530f264d5b6870b2a3 (diff)
parent9fd00425c50800906f4deb2c5aafa9b64217b54c (diff)
Merge branch 'filter_call_init_failure' into filter_api
-rw-r--r--src/core/ext/client_config/subchannel_call_holder.c2
-rw-r--r--src/core/lib/channel/channel_stack.c9
-rw-r--r--src/core/lib/channel/connected_channel.c2
-rw-r--r--src/core/lib/surface/call.c2
-rw-r--r--test/core/end2end/tests/filter_call_init_fails.c6
5 files changed, 14 insertions, 7 deletions
diff --git a/src/core/ext/client_config/subchannel_call_holder.c b/src/core/ext/client_config/subchannel_call_holder.c
index ac286825f6..be6d054af4 100644
--- a/src/core/ext/client_config/subchannel_call_holder.c
+++ b/src/core/ext/client_config/subchannel_call_holder.c
@@ -170,7 +170,7 @@ retry:
&subchannel_call);
if (error != GRPC_ERROR_NONE) {
subchannel_call = CANCELLED_CALL;
- fail_locked(exec_ctx, holder, error);
+ fail_locked(exec_ctx, holder, GRPC_ERROR_REF(error));
grpc_transport_stream_op_finish_with_failure(exec_ctx, op, error);
}
gpr_atm_rel_store(&holder->subchannel_call,
diff --git a/src/core/lib/channel/channel_stack.c b/src/core/lib/channel/channel_stack.c
index 70062e0c3b..7fcc0ef97f 100644
--- a/src/core/lib/channel/channel_stack.c
+++ b/src/core/lib/channel/channel_stack.c
@@ -189,8 +189,13 @@ grpc_error *grpc_call_stack_init(grpc_exec_ctx *exec_ctx,
call_elems[i].call_data = user_data;
grpc_error *error =
call_elems[i].filter->init_call_elem(exec_ctx, &call_elems[i], &args);
- if (error != GRPC_ERROR_NONE && first_error == GRPC_ERROR_NONE)
- first_error = error;
+ if (error != GRPC_ERROR_NONE) {
+ if (first_error == GRPC_ERROR_NONE) {
+ first_error = error;
+ } else {
+ GRPC_ERROR_UNREF(error);
+ }
+ }
user_data +=
ROUND_UP_TO_ALIGNMENT_SIZE(call_elems[i].filter->sizeof_call_data);
}
diff --git a/src/core/lib/channel/connected_channel.c b/src/core/lib/channel/connected_channel.c
index ecafcc99c7..bad1c50a71 100644
--- a/src/core/lib/channel/connected_channel.c
+++ b/src/core/lib/channel/connected_channel.c
@@ -90,7 +90,7 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
exec_ctx, chand->transport, TRANSPORT_STREAM_FROM_CALL_DATA(calld),
&args->call_stack->refcount, args->server_transport_data);
return r == 0 ? GRPC_ERROR_NONE
- : GRPC_ERROR_CREATE("transport initialization failed");
+ : GRPC_ERROR_CREATE("transport stream initialization failed");
}
static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c
index 345698092a..b3bf1427a3 100644
--- a/src/core/lib/surface/call.c
+++ b/src/core/lib/surface/call.c
@@ -274,7 +274,7 @@ grpc_call *grpc_call_create(
grpc_error_get_str(error, GRPC_ERROR_STR_DESCRIPTION);
close_with_status(&exec_ctx, call, (grpc_status_code)status,
error_str == NULL ? "unknown error" : error_str);
- grpc_error_unref(error);
+ GRPC_ERROR_UNREF(error);
}
if (cq != NULL) {
GPR_ASSERT(
diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c
index 4980b37278..08c377a281 100644
--- a/test/core/end2end/tests/filter_call_init_fails.c
+++ b/test/core/end2end/tests/filter_call_init_fails.c
@@ -246,8 +246,10 @@ static bool maybe_add_filter(grpc_channel_stack_builder *builder, void *arg) {
grpc_channel_stack_builder_iterator *it =
grpc_channel_stack_builder_create_iterator_at_last(builder);
GPR_ASSERT(grpc_channel_stack_builder_move_prev(it));
- return grpc_channel_stack_builder_add_filter_before(it, &test_filter, NULL,
- NULL);
+ const bool retval = grpc_channel_stack_builder_add_filter_before(
+ it, &test_filter, NULL, NULL);
+ grpc_channel_stack_builder_iterator_destroy(it);
+ return retval;
} else {
return true;
}