diff options
author | 2018-02-02 11:21:07 -0800 | |
---|---|---|
committer | 2018-02-02 11:21:07 -0800 | |
commit | 1acfaca3e630fbb4c64de1eb7267f969730e49da (patch) | |
tree | 08619d38599aeb5dfdff0a7b341a07014f7ea4d1 /test/core/end2end/h2_ssl_cert_test.cc | |
parent | 7ce8b94b691e08efc7206ac9365d71502872e154 (diff) | |
parent | c8e07c4964c98fb216dfcd562229ae515fc84a09 (diff) |
Merge branch 'master' into gpr_review_host_port
Diffstat (limited to 'test/core/end2end/h2_ssl_cert_test.cc')
-rw-r--r-- | test/core/end2end/h2_ssl_cert_test.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc index 96009aec4a..cd62c3f4e2 100644 --- a/test/core/end2end/h2_ssl_cert_test.cc +++ b/test/core/end2end/h2_ssl_cert_test.cc @@ -272,6 +272,20 @@ static void drain_cq(grpc_completion_queue* cq) { static void shutdown_server(grpc_end2end_test_fixture* f) { if (!f->server) return; + /* Perform a completion queue next, so that any pending operations can be + * finished, and resources can be released. This is so that, shutdown does not + * hang. For example, the server might be stuck in the handshaking code, which + * keeps a ref to a listener. Unless, it is unref'd, shutdown won't be able + * to proceed. + * + * (If shutdown times out, it is probably because 100ms wasn't enough. In that + * case, the deadline can be increased. Or, we could simply have another + * thread for the server to poll the completion queue while the shutdown + * progresses.) + */ + GPR_ASSERT(grpc_completion_queue_next( + f->cq, grpc_timeout_milliseconds_to_deadline(100), nullptr) + .type == GRPC_QUEUE_TIMEOUT); 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), @@ -288,8 +302,8 @@ static void shutdown_client(grpc_end2end_test_fixture* f) { } static void end_test(grpc_end2end_test_fixture* f) { - shutdown_server(f); shutdown_client(f); + shutdown_server(f); grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); |