clang-format

reviewable/pr11119/r1
Craig Tiller 8 years ago
parent 6cb61569d2
commit 26e69f6534
  1. 23
      src/core/ext/filters/client_channel/client_channel.c
  2. 12
      test/core/client_channel/resolvers/fake_resolver_test.c
  3. 6
      test/core/iomgr/endpoint_tests.c

@ -822,11 +822,12 @@ static bool set_call_or_error(call_data *p, call_or_error coe) {
} }
GPR_ASSERT(existing.subchannel_call == NULL); GPR_ASSERT(existing.subchannel_call == NULL);
if (coe.error != GRPC_ERROR_NONE) { if (coe.error != GRPC_ERROR_NONE) {
GPR_ASSERT(coe.subchannel_call == NULL); GPR_ASSERT(coe.subchannel_call == NULL);
gpr_atm_rel_store(&p->subchannel_call_or_error, 1|(gpr_atm)coe.error); gpr_atm_rel_store(&p->subchannel_call_or_error, 1 | (gpr_atm)coe.error);
} else { } else {
GPR_ASSERT(coe.subchannel_call != NULL); GPR_ASSERT(coe.subchannel_call != NULL);
gpr_atm_rel_store(&p->subchannel_call_or_error, (gpr_atm)coe.subchannel_call); gpr_atm_rel_store(&p->subchannel_call_or_error,
(gpr_atm)coe.subchannel_call);
} }
return true; return true;
} }
@ -973,7 +974,8 @@ static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, void *arg,
.context = calld->subchannel_call_context}; .context = calld->subchannel_call_context};
grpc_error *new_error = grpc_connected_subchannel_create_call( grpc_error *new_error = grpc_connected_subchannel_create_call(
exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call); exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call);
GPR_ASSERT(set_call_or_error(calld, (call_or_error){.subchannel_call = subchannel_call})); GPR_ASSERT(set_call_or_error(
calld, (call_or_error){.subchannel_call = subchannel_call}));
if (new_error != GRPC_ERROR_NONE) { if (new_error != GRPC_ERROR_NONE) {
new_error = grpc_error_add_child(new_error, error); new_error = grpc_error_add_child(new_error, error);
fail_locked(exec_ctx, calld, new_error); fail_locked(exec_ctx, calld, new_error);
@ -1176,7 +1178,7 @@ static void start_transport_stream_op_batch_locked_inner(
fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error)); fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error));
} }
grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op,
GRPC_ERROR_REF(error)); GRPC_ERROR_REF(error));
/* early out */ /* early out */
return; return;
} }
@ -1201,9 +1203,11 @@ static void start_transport_stream_op_batch_locked_inner(
if (calld->connected_subchannel == NULL) { if (calld->connected_subchannel == NULL) {
grpc_error *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING( grpc_error *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Call dropped by load balancing policy"); "Call dropped by load balancing policy");
set_call_or_error(calld, (call_or_error){.error = GRPC_ERROR_REF(error)}); set_call_or_error(calld,
(call_or_error){.error = GRPC_ERROR_REF(error)});
fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error)); fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error));
grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, GRPC_ERROR_REF(error)); grpc_transport_stream_op_batch_finish_with_failure(
exec_ctx, op, GRPC_ERROR_REF(error));
return; // Early out. return; // Early out.
} }
} else { } else {
@ -1223,7 +1227,8 @@ static void start_transport_stream_op_batch_locked_inner(
.context = calld->subchannel_call_context}; .context = calld->subchannel_call_context};
grpc_error *error = grpc_connected_subchannel_create_call( grpc_error *error = grpc_connected_subchannel_create_call(
exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call); exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call);
GPR_ASSERT(set_call_or_error(calld, (call_or_error){.subchannel_call = subchannel_call})); GPR_ASSERT(set_call_or_error(
calld, (call_or_error){.subchannel_call = subchannel_call}));
if (error != GRPC_ERROR_NONE) { if (error != GRPC_ERROR_NONE) {
fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error)); fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error));
grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error); grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error);

@ -83,7 +83,7 @@ void on_resolution_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
grpc_lb_addresses_cmp(actual_lb_addresses, expected_lb_addresses) == 0); grpc_lb_addresses_cmp(actual_lb_addresses, expected_lb_addresses) == 0);
grpc_channel_args_destroy(exec_ctx, res->resolver_result); grpc_channel_args_destroy(exec_ctx, res->resolver_result);
grpc_channel_args_destroy(exec_ctx, res->expected_resolver_result); grpc_channel_args_destroy(exec_ctx, res->expected_resolver_result);
gpr_event_set(&res->ev, (void*)1); gpr_event_set(&res->ev, (void *)1);
} }
static void test_fake_resolver() { static void test_fake_resolver() {
@ -126,7 +126,8 @@ static void test_fake_resolver() {
grpc_resolver_next_locked(&exec_ctx, resolver, &on_res_arg.resolver_result, grpc_resolver_next_locked(&exec_ctx, resolver, &on_res_arg.resolver_result,
on_resolution); on_resolution);
grpc_exec_ctx_flush(&exec_ctx); grpc_exec_ctx_flush(&exec_ctx);
GPR_ASSERT(gpr_event_wait(&on_res_arg.ev, grpc_timeout_seconds_to_deadline(5)) != NULL); GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
grpc_timeout_seconds_to_deadline(5)) != NULL);
// Setup update. // Setup update.
grpc_uri *uris_update[] = { grpc_uri *uris_update[] = {
@ -161,7 +162,8 @@ static void test_fake_resolver() {
grpc_resolver_next_locked(&exec_ctx, resolver, grpc_resolver_next_locked(&exec_ctx, resolver,
&on_res_arg_update.resolver_result, on_resolution); &on_res_arg_update.resolver_result, on_resolution);
grpc_exec_ctx_flush(&exec_ctx); grpc_exec_ctx_flush(&exec_ctx);
GPR_ASSERT(gpr_event_wait(&on_res_arg_update.ev, grpc_timeout_seconds_to_deadline(5)) != NULL); GPR_ASSERT(gpr_event_wait(&on_res_arg_update.ev,
grpc_timeout_seconds_to_deadline(5)) != NULL);
// Requesting a new resolution without re-senting the response shouldn't // Requesting a new resolution without re-senting the response shouldn't
// trigger the resolution callback. // trigger the resolution callback.
@ -169,7 +171,9 @@ static void test_fake_resolver() {
grpc_resolver_next_locked(&exec_ctx, resolver, &on_res_arg.resolver_result, grpc_resolver_next_locked(&exec_ctx, resolver, &on_res_arg.resolver_result,
on_resolution); on_resolution);
grpc_exec_ctx_flush(&exec_ctx); grpc_exec_ctx_flush(&exec_ctx);
GPR_ASSERT(gpr_event_wait(&on_res_arg.ev, grpc_timeout_milliseconds_to_deadline(100)) == NULL); GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
grpc_timeout_milliseconds_to_deadline(100)) ==
NULL);
GRPC_COMBINER_UNREF(&exec_ctx, combiner, "test_fake_resolver"); GRPC_COMBINER_UNREF(&exec_ctx, combiner, "test_fake_resolver");
GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_fake_resolver"); GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_fake_resolver");

@ -276,11 +276,13 @@ static void wait_for_fail_count(grpc_exec_ctx *exec_ctx, int *fail_count,
grpc_exec_ctx_flush(exec_ctx); grpc_exec_ctx_flush(exec_ctx);
gpr_mu_lock(g_mu); gpr_mu_lock(g_mu);
gpr_timespec deadline = grpc_timeout_seconds_to_deadline(10); gpr_timespec deadline = grpc_timeout_seconds_to_deadline(10);
while (gpr_time_cmp(gpr_now(deadline.clock_type), deadline) < 0 && *fail_count < want_fail_count) { while (gpr_time_cmp(gpr_now(deadline.clock_type), deadline) < 0 &&
*fail_count < want_fail_count) {
grpc_pollset_worker *worker = NULL; grpc_pollset_worker *worker = NULL;
GPR_ASSERT(GRPC_LOG_IF_ERROR( GPR_ASSERT(GRPC_LOG_IF_ERROR(
"pollset_work", "pollset_work",
grpc_pollset_work(exec_ctx, g_pollset, &worker, gpr_now(deadline.clock_type), deadline))); grpc_pollset_work(exec_ctx, g_pollset, &worker,
gpr_now(deadline.clock_type), deadline)));
gpr_mu_unlock(g_mu); gpr_mu_unlock(g_mu);
grpc_exec_ctx_flush(exec_ctx); grpc_exec_ctx_flush(exec_ctx);
gpr_mu_lock(g_mu); gpr_mu_lock(g_mu);

Loading…
Cancel
Save