diff options
Diffstat (limited to 'test/core')
-rw-r--r-- | test/core/iomgr/fd_posix_test.c | 8 | ||||
-rw-r--r-- | test/core/iomgr/tcp_posix_test.c | 17 |
2 files changed, 12 insertions, 13 deletions
diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c index 9605babc5b..4be6957a83 100644 --- a/test/core/iomgr/fd_posix_test.c +++ b/test/core/iomgr/fd_posix_test.c @@ -121,7 +121,7 @@ static void session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */ int success) { session *se = arg; server *sv = se->sv; - grpc_fd_orphan(exec_ctx, se->em_fd, NULL, 0, "a"); + grpc_fd_orphan(exec_ctx, se->em_fd, NULL, NULL, "a"); gpr_free(se); /* Start to shutdown listen fd. */ grpc_fd_shutdown(exec_ctx, sv->em_fd); @@ -177,7 +177,7 @@ static void listen_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg /*server */, int success) { server *sv = arg; - grpc_fd_orphan(exec_ctx, sv->em_fd, NULL, 0, "b"); + grpc_fd_orphan(exec_ctx, sv->em_fd, NULL, NULL, "b"); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); sv->done = 1; @@ -294,7 +294,7 @@ static void client_init(client *cl) { static void client_session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg /*client */, int success) { client *cl = arg; - grpc_fd_orphan(exec_ctx, cl->em_fd, NULL, 0, "c"); + grpc_fd_orphan(exec_ctx, cl->em_fd, NULL, NULL, "c"); cl->done = 1; grpc_pollset_kick(&g_pollset, NULL); } @@ -503,7 +503,7 @@ static void test_grpc_fd_change(void) { GPR_ASSERT(b.cb_that_ran == second_read_callback); gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); - grpc_fd_orphan(&exec_ctx, em_fd, NULL, 0, "d"); + grpc_fd_orphan(&exec_ctx, em_fd, NULL, NULL, "d"); grpc_exec_ctx_finish(&exec_ctx); destroy_change_data(&a); destroy_change_data(&b); diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c index 76f455678c..9feac931a3 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.c @@ -205,12 +205,6 @@ static void read_test(size_t num_bytes, size_t slice_size) { grpc_exec_ctx_finish(&exec_ctx); } -void on_fd_released(grpc_exec_ctx *exec_ctx, void *arg, int success) { - int *done = arg; - *done = 1; - grpc_pollset_kick(&g_pollset, NULL); -} - /* Write to a socket until it fills up, then read from it using the grpc_tcp API. */ static void large_read_test(size_t slice_size) { @@ -389,6 +383,12 @@ static void write_test(size_t num_bytes, size_t slice_size) { grpc_exec_ctx_finish(&exec_ctx); } +void on_fd_released(grpc_exec_ctx *exec_ctx, void *arg, int success) { + int *done = arg; + *done = 1; + grpc_pollset_kick(&g_pollset, NULL); +} + /* Do a read_test, then release fd and try to read/write again. */ static void release_fd_test(size_t num_bytes, size_t slice_size) { int sv[2]; @@ -408,8 +408,6 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { create_sockets(sv); ep = grpc_tcp_create(grpc_fd_create(sv[1], "read_test"), slice_size, "test"); - fd = grpc_tcp_get_fd(ep); - GPR_ASSERT(fd == sv[1]); grpc_endpoint_add_to_pollset(&exec_ctx, ep, &g_pollset); written_bytes = fill_socket_partial(sv[0], num_bytes); @@ -436,7 +434,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); gpr_slice_buffer_destroy(&state.incoming); - grpc_tcp_destroy_and_release_fd(&exec_ctx, ep, &fd_released_cb); + grpc_tcp_destroy_and_release_fd(&exec_ctx, ep, &fd, &fd_released_cb); gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); while (!fd_released_done) { grpc_pollset_worker worker; @@ -445,6 +443,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { } gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); GPR_ASSERT(fd_released_done == 1); + GPR_ASSERT(fd == sv[1]); grpc_exec_ctx_finish(&exec_ctx); written_bytes = fill_socket_partial(sv[0], num_bytes); |