diff options
Diffstat (limited to 'test/core/end2end/goaway_server_test.c')
-rw-r--r-- | test/core/end2end/goaway_server_test.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/test/core/end2end/goaway_server_test.c b/test/core/end2end/goaway_server_test.c index 4bb258e3ed..22d93b321a 100644 --- a/test/core/end2end/goaway_server_test.c +++ b/test/core/end2end/goaway_server_test.c @@ -52,9 +52,11 @@ static void *tag(intptr_t i) { return (void *)i; } static gpr_mu g_mu; static int g_resolve_port = -1; -static grpc_error *(*iomgr_resolve_address)(const char *name, - const char *default_port, - grpc_resolved_addresses **addrs); +static void (*iomgr_resolve_address)(grpc_exec_ctx *exec_ctx, const char *addr, + const char *default_port, + grpc_pollset_set *interested_parties, + grpc_closure *on_done, + grpc_resolved_addresses **addresses); static void set_resolve_port(int port) { gpr_mu_lock(&g_mu); @@ -62,16 +64,22 @@ static void set_resolve_port(int port) { gpr_mu_unlock(&g_mu); } -static grpc_error *my_resolve_address(const char *name, const char *addr, - grpc_resolved_addresses **addrs) { - if (0 != strcmp(name, "test")) { - return iomgr_resolve_address(name, addr, addrs); +static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, + const char *default_port, + grpc_pollset_set *interested_parties, + grpc_closure *on_done, + grpc_resolved_addresses **addrs) { + if (0 != strcmp(addr, "test")) { + iomgr_resolve_address(exec_ctx, addr, default_port, interested_parties, + on_done, addrs); + return; } + grpc_error *error = GRPC_ERROR_NONE; gpr_mu_lock(&g_mu); if (g_resolve_port < 0) { gpr_mu_unlock(&g_mu); - return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure"); + error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure"); } else { *addrs = gpr_malloc(sizeof(**addrs)); (*addrs)->naddrs = 1; @@ -83,8 +91,8 @@ static grpc_error *my_resolve_address(const char *name, const char *addr, sa->sin_port = htons((uint16_t)g_resolve_port); (*addrs)->addrs[0].len = sizeof(*sa); gpr_mu_unlock(&g_mu); - return GRPC_ERROR_NONE; } + grpc_closure_sched(exec_ctx, on_done, error); } int main(int argc, char **argv) { @@ -96,9 +104,9 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); gpr_mu_init(&g_mu); - iomgr_resolve_address = grpc_blocking_resolve_address; - grpc_blocking_resolve_address = my_resolve_address; grpc_init(); + iomgr_resolve_address = grpc_resolve_address; + grpc_resolve_address = my_resolve_address; int was_cancelled1; int was_cancelled2; |