aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/surface/concurrent_connectivity_test.cc
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-11-16 19:31:28 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2017-11-16 19:31:28 -0800
commit177039b2f89e73ad0d048da021f939f3a153c4e2 (patch)
treec7f10f04cd9a0872863e2b181162bc9928160cd8 /test/core/surface/concurrent_connectivity_test.cc
parent995aa91bbbc68deb6dfd7c667cfee3af2bedec08 (diff)
parent82c8f945302f128495e261b853ac49f1dfbe69a1 (diff)
Merge master
Diffstat (limited to 'test/core/surface/concurrent_connectivity_test.cc')
-rw-r--r--test/core/surface/concurrent_connectivity_test.cc34
1 files changed, 19 insertions, 15 deletions
diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc
index 18d7f2f985..5771e2f240 100644
--- a/test/core/surface/concurrent_connectivity_test.cc
+++ b/test/core/surface/concurrent_connectivity_test.cc
@@ -59,18 +59,20 @@ static int detag(void* p) { return (int)(uintptr_t)p; }
void create_loop_destroy(void* addr) {
for (int i = 0; i < NUM_OUTER_LOOPS; ++i) {
- grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL);
- grpc_channel* chan = grpc_insecure_channel_create((char*)addr, NULL, NULL);
+ grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr);
+ grpc_channel* chan =
+ grpc_insecure_channel_create((char*)addr, nullptr, nullptr);
for (int j = 0; j < NUM_INNER_LOOPS; ++j) {
gpr_timespec later_time =
grpc_timeout_milliseconds_to_deadline(DELAY_MILLIS);
grpc_connectivity_state state =
grpc_channel_check_connectivity_state(chan, 1);
- grpc_channel_watch_connectivity_state(chan, state, later_time, cq, NULL);
+ grpc_channel_watch_connectivity_state(chan, state, later_time, cq,
+ nullptr);
gpr_timespec poll_time =
grpc_timeout_milliseconds_to_deadline(POLL_MILLIS);
- GPR_ASSERT(grpc_completion_queue_next(cq, poll_time, NULL).type ==
+ GPR_ASSERT(grpc_completion_queue_next(cq, poll_time, nullptr).type ==
GRPC_OP_COMPLETE);
/* check that the watcher from "watch state" was free'd */
GPR_ASSERT(grpc_channel_num_external_connectivity_watchers(chan) == 0);
@@ -94,7 +96,7 @@ void server_thread(void* vargs) {
struct server_thread_args* args = (struct server_thread_args*)vargs;
grpc_event ev;
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
- ev = grpc_completion_queue_next(args->cq, deadline, NULL);
+ ev = grpc_completion_queue_next(args->cq, deadline, nullptr);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
GPR_ASSERT(detag(ev.tag) == 0xd1e);
}
@@ -108,7 +110,7 @@ static void on_connect(void* vargs, grpc_endpoint* tcp,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Connected"));
grpc_endpoint_destroy(tcp);
gpr_mu_lock(args->mu);
- GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(args->pollset, NULL));
+ GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(args->pollset, nullptr));
gpr_mu_unlock(args->mu);
}
@@ -120,7 +122,7 @@ void bad_server_thread(void* vargs) {
struct sockaddr_storage* addr = (struct sockaddr_storage*)resolved_addr.addr;
int port;
grpc_tcp_server* s;
- grpc_error* error = grpc_tcp_server_create(NULL, NULL, &s);
+ grpc_error* error = grpc_tcp_server_create(nullptr, nullptr, &s);
GPR_ASSERT(error == GRPC_ERROR_NONE);
memset(&resolved_addr, 0, sizeof(resolved_addr));
addr->ss_family = AF_INET;
@@ -136,7 +138,7 @@ void bad_server_thread(void* vargs) {
while (gpr_atm_acq_load(&args->stop) == 0) {
grpc_millis deadline = grpc_core::ExecCtx::Get()->Now() + 100;
- grpc_pollset_worker* worker = NULL;
+ grpc_pollset_worker* worker = nullptr;
if (!GRPC_LOG_IF_ERROR(
"pollset_work",
grpc_pollset_work(args->pollset, &worker, deadline))) {
@@ -185,10 +187,10 @@ int run_concurrent_connectivity_test() {
gpr_log(GPR_DEBUG, "Wave 2");
int port = grpc_pick_unused_port_or_die();
gpr_asprintf(&args.addr, "localhost:%d", port);
- args.server = grpc_server_create(NULL, NULL);
+ args.server = grpc_server_create(nullptr, nullptr);
grpc_server_add_insecure_http2_port(args.server, args.addr);
- args.cq = grpc_completion_queue_create_for_next(NULL);
- grpc_server_register_completion_queue(args.server, args.cq, NULL);
+ args.cq = grpc_completion_queue_create_for_next(nullptr);
+ grpc_server_register_completion_queue(args.server, args.cq, nullptr);
grpc_server_start(args.server);
gpr_thd_new(&server, server_thread, &args, &options);
@@ -233,8 +235,9 @@ int run_concurrent_connectivity_test() {
void watches_with_short_timeouts(void* addr) {
for (int i = 0; i < NUM_OUTER_LOOPS_SHORT_TIMEOUTS; ++i) {
- grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL);
- grpc_channel* chan = grpc_insecure_channel_create((char*)addr, NULL, NULL);
+ grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr);
+ grpc_channel* chan =
+ grpc_insecure_channel_create((char*)addr, nullptr, nullptr);
for (int j = 0; j < NUM_INNER_LOOPS_SHORT_TIMEOUTS; ++j) {
gpr_timespec later_time =
@@ -242,10 +245,11 @@ void watches_with_short_timeouts(void* addr) {
grpc_connectivity_state state =
grpc_channel_check_connectivity_state(chan, 0);
GPR_ASSERT(state == GRPC_CHANNEL_IDLE);
- grpc_channel_watch_connectivity_state(chan, state, later_time, cq, NULL);
+ grpc_channel_watch_connectivity_state(chan, state, later_time, cq,
+ nullptr);
gpr_timespec poll_time =
grpc_timeout_milliseconds_to_deadline(POLL_MILLIS_SHORT_TIMEOUTS);
- grpc_event ev = grpc_completion_queue_next(cq, poll_time, NULL);
+ grpc_event ev = grpc_completion_queue_next(cq, poll_time, nullptr);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
GPR_ASSERT(ev.success == false);
/* check that the watcher from "watch state" was free'd */