diff options
Diffstat (limited to 'test/core/end2end/tests/keepalive_timeout.c')
-rw-r--r-- | test/core/end2end/tests/keepalive_timeout.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/core/end2end/tests/keepalive_timeout.c b/test/core/end2end/tests/keepalive_timeout.c index 44b6e12abc..b2252dc802 100644 --- a/test/core/end2end/tests/keepalive_timeout.c +++ b/test/core/end2end/tests/keepalive_timeout.c @@ -61,25 +61,27 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, return f; } -static gpr_timespec n_seconds_time(int n) { +static gpr_timespec n_seconds_from_now(int n) { return grpc_timeout_seconds_to_deadline(n); } -static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } +static gpr_timespec five_seconds_from_now(void) { + return n_seconds_from_now(5); +} static void drain_cq(grpc_completion_queue *cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT( - grpc_completion_queue_pluck(f->cq, tag(1000), five_seconds_time(), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + five_seconds_from_now(), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } @@ -108,7 +110,6 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { grpc_slice_from_copied_string("hello world"); grpc_byte_buffer *response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1); - gpr_timespec deadline = five_seconds_time(); grpc_arg keepalive_args[] = {{.type = GRPC_ARG_INTEGER, .key = GRPC_ARG_CLIENT_KEEPALIVE_TIME_S, @@ -140,6 +141,7 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { /* Disable ping ack to trigger the keepalive timeout */ grpc_set_disable_ping_ack(true); + gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), |