aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/end2end/tests/bad_hostname.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/end2end/tests/bad_hostname.c')
-rw-r--r--test/core/end2end/tests/bad_hostname.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.c
index f50a5805a2..35a531cf78 100644
--- a/test/core/end2end/tests/bad_hostname.c
+++ b/test/core/end2end/tests/bad_hostname.c
@@ -59,24 +59,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), grpc_timeout_seconds_to_deadline(5), NULL)
+ grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
+ GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
+ grpc_timeout_seconds_to_deadline(5),
+ NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
@@ -95,11 +98,11 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
+ grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_call *c;
- gpr_timespec deadline = five_seconds_time();
cq_verifier *cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op *op;
@@ -112,6 +115,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_slice details;
grpc_slice host = grpc_slice_from_static_string("slartibartfast.local");
+ 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"), &host,
deadline, NULL);
@@ -159,7 +163,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_metadata_array_destroy(&request_metadata_recv);
grpc_call_details_destroy(&call_details);
- grpc_call_destroy(c);
+ grpc_call_unref(c);
cq_verifier_destroy(cqv);
}