Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1 | /* |
| 2 | * |
Craig Tiller | 6169d5f | 2016-03-31 07:46:18 -0700 | [diff] [blame] | 3 | * Copyright 2015, Google Inc. |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 4 | * All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions are |
| 8 | * met: |
| 9 | * |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above |
| 13 | * copyright notice, this list of conditions and the following disclaimer |
| 14 | * in the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * * Neither the name of Google Inc. nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived from |
| 18 | * this software without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | * |
| 32 | */ |
| 33 | |
Craig Tiller | 9533d04 | 2016-03-25 17:11:06 -0700 | [diff] [blame] | 34 | #include "src/core/lib/http/httpcli.h" |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 35 | |
| 36 | #include <string.h> |
| 37 | |
Craig Tiller | f39f2d6 | 2015-06-06 14:43:06 -0700 | [diff] [blame] | 38 | #include <grpc/grpc.h> |
Craig Tiller | b5075e3 | 2015-06-05 13:00:46 -0700 | [diff] [blame] | 39 | #include <grpc/support/alloc.h> |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 40 | #include <grpc/support/log.h> |
Craig Tiller | b5075e3 | 2015-06-05 13:00:46 -0700 | [diff] [blame] | 41 | #include <grpc/support/string_util.h> |
| 42 | #include <grpc/support/subprocess.h> |
ctiller | 18b49ab | 2014-12-09 14:39:16 -0800 | [diff] [blame] | 43 | #include <grpc/support/sync.h> |
Craig Tiller | 9533d04 | 2016-03-25 17:11:06 -0700 | [diff] [blame] | 44 | #include "src/core/lib/iomgr/iomgr.h" |
Craig Tiller | b5075e3 | 2015-06-05 13:00:46 -0700 | [diff] [blame] | 45 | #include "test/core/util/port.h" |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 46 | #include "test/core/util/test_config.h" |
| 47 | |
Craig Tiller | b1fa1d5 | 2015-05-11 10:27:53 -0700 | [diff] [blame] | 48 | static int g_done = 0; |
Craig Tiller | 49ff23f | 2015-06-01 11:32:04 -0700 | [diff] [blame] | 49 | static grpc_httpcli_context g_context; |
Craig Tiller | 69b093b | 2016-02-25 19:04:07 -0800 | [diff] [blame] | 50 | static gpr_mu *g_mu; |
David Garcia Quintas | 2a50dfe | 2016-05-31 15:09:12 -0700 | [diff] [blame] | 51 | static grpc_polling_entity g_pops; |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 52 | |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 53 | static gpr_timespec n_seconds_time(int seconds) { |
Robbie Shade | ca7effc | 2017-01-17 09:14:29 -0500 | [diff] [blame] | 54 | return grpc_timeout_seconds_to_deadline(seconds); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 55 | } |
| 56 | |
Craig Tiller | f707d62 | 2016-05-06 14:26:12 -0700 | [diff] [blame] | 57 | static void on_finish(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 58 | const char *expect = |
| 59 | "<html><head><title>Hello world!</title></head>" |
| 60 | "<body><p>This is a test</p></body></html>"; |
Craig Tiller | f707d62 | 2016-05-06 14:26:12 -0700 | [diff] [blame] | 61 | grpc_http_response *response = arg; |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 62 | GPR_ASSERT(response); |
| 63 | GPR_ASSERT(response->status == 200); |
| 64 | GPR_ASSERT(response->body_length == strlen(expect)); |
| 65 | GPR_ASSERT(0 == memcmp(expect, response->body, response->body_length)); |
Craig Tiller | 69b093b | 2016-02-25 19:04:07 -0800 | [diff] [blame] | 66 | gpr_mu_lock(g_mu); |
Craig Tiller | b1fa1d5 | 2015-05-11 10:27:53 -0700 | [diff] [blame] | 67 | g_done = 1; |
Craig Tiller | c97065d | 2016-06-07 13:00:14 -0700 | [diff] [blame] | 68 | GPR_ASSERT(GRPC_LOG_IF_ERROR( |
| 69 | "pollset_kick", |
| 70 | grpc_pollset_kick(grpc_polling_entity_pollset(&g_pops), NULL))); |
Craig Tiller | 69b093b | 2016-02-25 19:04:07 -0800 | [diff] [blame] | 71 | gpr_mu_unlock(g_mu); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 72 | } |
| 73 | |
Craig Tiller | ed2164d | 2015-12-08 22:03:36 -0800 | [diff] [blame] | 74 | static void test_get(int port) { |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 75 | grpc_httpcli_request req; |
Craig Tiller | 9a57633 | 2015-06-17 10:21:49 -0700 | [diff] [blame] | 76 | char *host; |
Craig Tiller | f5768a6 | 2015-09-22 10:54:34 -0700 | [diff] [blame] | 77 | grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 78 | |
Craig Tiller | b1fa1d5 | 2015-05-11 10:27:53 -0700 | [diff] [blame] | 79 | g_done = 0; |
Craig Tiller | ed2164d | 2015-12-08 22:03:36 -0800 | [diff] [blame] | 80 | gpr_log(GPR_INFO, "test_get"); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 81 | |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 82 | gpr_asprintf(&host, "localhost:%d", port); |
| 83 | gpr_log(GPR_INFO, "requesting from %s", host); |
Craig Tiller | b5075e3 | 2015-06-05 13:00:46 -0700 | [diff] [blame] | 84 | |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 85 | memset(&req, 0, sizeof(req)); |
Craig Tiller | b5075e3 | 2015-06-05 13:00:46 -0700 | [diff] [blame] | 86 | req.host = host; |
Matthew Iselin | 1824f05 | 2016-02-10 12:16:06 +1100 | [diff] [blame] | 87 | req.http.path = "/get"; |
Craig Tiller | ed2164d | 2015-12-08 22:03:36 -0800 | [diff] [blame] | 88 | req.handshaker = &grpc_httpcli_plaintext; |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 89 | |
Craig Tiller | f707d62 | 2016-05-06 14:26:12 -0700 | [diff] [blame] | 90 | grpc_http_response response; |
| 91 | memset(&response, 0, sizeof(response)); |
Craig Tiller | 20afa3d | 2016-10-17 14:52:14 -0700 | [diff] [blame] | 92 | grpc_resource_quota *resource_quota = grpc_resource_quota_create("test_get"); |
Craig Tiller | 91031da | 2016-12-28 15:44:25 -0800 | [diff] [blame] | 93 | grpc_httpcli_get( |
| 94 | &exec_ctx, &g_context, &g_pops, resource_quota, &req, n_seconds_time(15), |
| 95 | grpc_closure_create(on_finish, &response, grpc_schedule_on_exec_ctx), |
| 96 | &response); |
Craig Tiller | a59c16c | 2016-10-31 07:25:01 -0700 | [diff] [blame] | 97 | grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); |
Craig Tiller | 69b093b | 2016-02-25 19:04:07 -0800 | [diff] [blame] | 98 | gpr_mu_lock(g_mu); |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 99 | while (!g_done) { |
Craig Tiller | d0a8ae1 | 2016-02-18 08:01:19 -0800 | [diff] [blame] | 100 | grpc_pollset_worker *worker = NULL; |
Craig Tiller | 1aee536 | 2016-05-07 11:26:50 -0700 | [diff] [blame] | 101 | GPR_ASSERT(GRPC_LOG_IF_ERROR( |
| 102 | "pollset_work", |
Craig Tiller | c97065d | 2016-06-07 13:00:14 -0700 | [diff] [blame] | 103 | grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops), |
| 104 | &worker, gpr_now(GPR_CLOCK_MONOTONIC), |
| 105 | n_seconds_time(20)))); |
Craig Tiller | 69b093b | 2016-02-25 19:04:07 -0800 | [diff] [blame] | 106 | gpr_mu_unlock(g_mu); |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 107 | grpc_exec_ctx_finish(&exec_ctx); |
Craig Tiller | 69b093b | 2016-02-25 19:04:07 -0800 | [diff] [blame] | 108 | gpr_mu_lock(g_mu); |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 109 | } |
Craig Tiller | 69b093b | 2016-02-25 19:04:07 -0800 | [diff] [blame] | 110 | gpr_mu_unlock(g_mu); |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 111 | gpr_free(host); |
Craig Tiller | 6a64bfd | 2016-05-09 13:05:03 -0700 | [diff] [blame] | 112 | grpc_http_response_destroy(&response); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 113 | } |
| 114 | |
Craig Tiller | ed2164d | 2015-12-08 22:03:36 -0800 | [diff] [blame] | 115 | static void test_post(int port) { |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 116 | grpc_httpcli_request req; |
Craig Tiller | 9a57633 | 2015-06-17 10:21:49 -0700 | [diff] [blame] | 117 | char *host; |
Craig Tiller | f5768a6 | 2015-09-22 10:54:34 -0700 | [diff] [blame] | 118 | grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 119 | |
Craig Tiller | f39f2d6 | 2015-06-06 14:43:06 -0700 | [diff] [blame] | 120 | g_done = 0; |
Craig Tiller | ed2164d | 2015-12-08 22:03:36 -0800 | [diff] [blame] | 121 | gpr_log(GPR_INFO, "test_post"); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 122 | |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 123 | gpr_asprintf(&host, "localhost:%d", port); |
| 124 | gpr_log(GPR_INFO, "posting to %s", host); |
Craig Tiller | b5075e3 | 2015-06-05 13:00:46 -0700 | [diff] [blame] | 125 | |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 126 | memset(&req, 0, sizeof(req)); |
Craig Tiller | b5075e3 | 2015-06-05 13:00:46 -0700 | [diff] [blame] | 127 | req.host = host; |
Matthew Iselin | 1824f05 | 2016-02-10 12:16:06 +1100 | [diff] [blame] | 128 | req.http.path = "/post"; |
Craig Tiller | ed2164d | 2015-12-08 22:03:36 -0800 | [diff] [blame] | 129 | req.handshaker = &grpc_httpcli_plaintext; |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 130 | |
Craig Tiller | f707d62 | 2016-05-06 14:26:12 -0700 | [diff] [blame] | 131 | grpc_http_response response; |
| 132 | memset(&response, 0, sizeof(response)); |
Craig Tiller | 20afa3d | 2016-10-17 14:52:14 -0700 | [diff] [blame] | 133 | grpc_resource_quota *resource_quota = grpc_resource_quota_create("test_post"); |
Craig Tiller | 91031da | 2016-12-28 15:44:25 -0800 | [diff] [blame] | 134 | grpc_httpcli_post( |
| 135 | &exec_ctx, &g_context, &g_pops, resource_quota, &req, "hello", 5, |
| 136 | n_seconds_time(15), |
| 137 | grpc_closure_create(on_finish, &response, grpc_schedule_on_exec_ctx), |
| 138 | &response); |
Craig Tiller | a59c16c | 2016-10-31 07:25:01 -0700 | [diff] [blame] | 139 | grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); |
Craig Tiller | 69b093b | 2016-02-25 19:04:07 -0800 | [diff] [blame] | 140 | gpr_mu_lock(g_mu); |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 141 | while (!g_done) { |
Craig Tiller | d0a8ae1 | 2016-02-18 08:01:19 -0800 | [diff] [blame] | 142 | grpc_pollset_worker *worker = NULL; |
Craig Tiller | 1aee536 | 2016-05-07 11:26:50 -0700 | [diff] [blame] | 143 | GPR_ASSERT(GRPC_LOG_IF_ERROR( |
| 144 | "pollset_work", |
Craig Tiller | c97065d | 2016-06-07 13:00:14 -0700 | [diff] [blame] | 145 | grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops), |
| 146 | &worker, gpr_now(GPR_CLOCK_MONOTONIC), |
| 147 | n_seconds_time(20)))); |
Craig Tiller | 69b093b | 2016-02-25 19:04:07 -0800 | [diff] [blame] | 148 | gpr_mu_unlock(g_mu); |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 149 | grpc_exec_ctx_finish(&exec_ctx); |
Craig Tiller | 69b093b | 2016-02-25 19:04:07 -0800 | [diff] [blame] | 150 | gpr_mu_lock(g_mu); |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 151 | } |
Craig Tiller | 69b093b | 2016-02-25 19:04:07 -0800 | [diff] [blame] | 152 | gpr_mu_unlock(g_mu); |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 153 | gpr_free(host); |
Craig Tiller | 6a64bfd | 2016-05-09 13:05:03 -0700 | [diff] [blame] | 154 | grpc_http_response_destroy(&response); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 155 | } |
Craig Tiller | f39f2d6 | 2015-06-06 14:43:06 -0700 | [diff] [blame] | 156 | |
Craig Tiller | c97065d | 2016-06-07 13:00:14 -0700 | [diff] [blame] | 157 | static void destroy_pops(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { |
David Garcia Quintas | c4d5112 | 2016-06-06 14:56:02 -0700 | [diff] [blame] | 158 | grpc_pollset_destroy(grpc_polling_entity_pollset(p)); |
Craig Tiller | dfff1b8 | 2015-09-21 14:39:57 -0700 | [diff] [blame] | 159 | } |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 160 | |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 161 | int main(int argc, char **argv) { |
Craig Tiller | dfff1b8 | 2015-09-21 14:39:57 -0700 | [diff] [blame] | 162 | grpc_closure destroyed; |
Craig Tiller | f5768a6 | 2015-09-22 10:54:34 -0700 | [diff] [blame] | 163 | grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
Craig Tiller | 9a57633 | 2015-06-17 10:21:49 -0700 | [diff] [blame] | 164 | gpr_subprocess *server; |
Craig Tiller | b5075e3 | 2015-06-05 13:00:46 -0700 | [diff] [blame] | 165 | char *me = argv[0]; |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 166 | char *lslash = strrchr(me, '/'); |
Craig Tiller | 9a57633 | 2015-06-17 10:21:49 -0700 | [diff] [blame] | 167 | char *args[4]; |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 168 | int port = grpc_pick_unused_port_or_die(); |
Nicolas "Pixel" Noble | 2d86263 | 2016-03-03 23:25:22 +0100 | [diff] [blame] | 169 | int arg_shift = 0; |
| 170 | /* figure out where we are */ |
| 171 | char *root; |
| 172 | if (lslash) { |
| 173 | root = gpr_malloc((size_t)(lslash - me + 1)); |
| 174 | memcpy(root, me, (size_t)(lslash - me)); |
| 175 | root[lslash - me] = 0; |
| 176 | } else { |
| 177 | root = gpr_strdup("."); |
| 178 | } |
Craig Tiller | b5075e3 | 2015-06-05 13:00:46 -0700 | [diff] [blame] | 179 | |
Nicolas "Pixel" Noble | c27a99b | 2015-12-15 02:46:16 +0100 | [diff] [blame] | 180 | GPR_ASSERT(argc <= 2); |
| 181 | if (argc == 2) { |
| 182 | args[0] = gpr_strdup(argv[1]); |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 183 | } else { |
Nicolas "Pixel" Noble | 2d86263 | 2016-03-03 23:25:22 +0100 | [diff] [blame] | 184 | arg_shift = 1; |
| 185 | gpr_asprintf(&args[0], "%s/../../tools/distrib/python_wrapper.sh", root); |
Matthew Iselin | 1824f05 | 2016-02-10 12:16:06 +1100 | [diff] [blame] | 186 | gpr_asprintf(&args[1], "%s/../../test/core/http/test_server.py", root); |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 187 | } |
Craig Tiller | b5075e3 | 2015-06-05 13:00:46 -0700 | [diff] [blame] | 188 | |
| 189 | /* start the server */ |
Nicolas "Pixel" Noble | 2d86263 | 2016-03-03 23:25:22 +0100 | [diff] [blame] | 190 | args[1 + arg_shift] = "--port"; |
| 191 | gpr_asprintf(&args[2 + arg_shift], "%d", port); |
| 192 | server = gpr_subprocess_create(3 + arg_shift, (const char **)args); |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 193 | GPR_ASSERT(server); |
| 194 | gpr_free(args[0]); |
Nicolas "Pixel" Noble | 2d86263 | 2016-03-03 23:25:22 +0100 | [diff] [blame] | 195 | if (arg_shift) gpr_free(args[1]); |
| 196 | gpr_free(args[2 + arg_shift]); |
| 197 | gpr_free(root); |
Craig Tiller | b5075e3 | 2015-06-05 13:00:46 -0700 | [diff] [blame] | 198 | |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 199 | gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), |
| 200 | gpr_time_from_seconds(5, GPR_TIMESPAN))); |
Craig Tiller | b5075e3 | 2015-06-05 13:00:46 -0700 | [diff] [blame] | 201 | |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 202 | grpc_test_init(argc, argv); |
| 203 | grpc_init(); |
| 204 | grpc_httpcli_context_init(&g_context); |
David Garcia Quintas | f72eb97 | 2016-05-03 18:28:09 -0700 | [diff] [blame] | 205 | grpc_pollset *pollset = gpr_malloc(grpc_pollset_size()); |
| 206 | grpc_pollset_init(pollset, &g_mu); |
David Garcia Quintas | c4d5112 | 2016-06-06 14:56:02 -0700 | [diff] [blame] | 207 | g_pops = grpc_polling_entity_create_from_pollset(pollset); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 208 | |
Craig Tiller | ed2164d | 2015-12-08 22:03:36 -0800 | [diff] [blame] | 209 | test_get(port); |
| 210 | test_post(port); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 211 | |
Craig Tiller | 9e5ac1b | 2017-02-14 22:25:50 -0800 | [diff] [blame] | 212 | grpc_httpcli_context_destroy(&exec_ctx, &g_context); |
Craig Tiller | 91031da | 2016-12-28 15:44:25 -0800 | [diff] [blame] | 213 | grpc_closure_init(&destroyed, destroy_pops, &g_pops, |
| 214 | grpc_schedule_on_exec_ctx); |
David Garcia Quintas | 69ff63d | 2016-06-06 16:39:47 -0700 | [diff] [blame] | 215 | grpc_pollset_shutdown(&exec_ctx, grpc_polling_entity_pollset(&g_pops), |
| 216 | &destroyed); |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 217 | grpc_exec_ctx_finish(&exec_ctx); |
| 218 | grpc_shutdown(); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 219 | |
David Garcia Quintas | c4d5112 | 2016-06-06 14:56:02 -0700 | [diff] [blame] | 220 | gpr_free(grpc_polling_entity_pollset(&g_pops)); |
Craig Tiller | 69b093b | 2016-02-25 19:04:07 -0800 | [diff] [blame] | 221 | |
Craig Tiller | a82950e | 2015-09-22 12:33:20 -0700 | [diff] [blame] | 222 | gpr_subprocess_destroy(server); |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 223 | |
| 224 | return 0; |
Craig Tiller | 190d360 | 2015-02-18 09:23:38 -0800 | [diff] [blame] | 225 | } |