aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/iomgr/tcp_posix_test.c
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2015-12-01 10:32:28 -0800
committerGravatar yang-g <yangg@google.com>2015-12-01 10:36:19 -0800
commit5d850377482cf0925a46f286ce8a3c71c640d7c5 (patch)
tree9d136706ad79550bb6d057c72348f9b06cf07836 /test/core/iomgr/tcp_posix_test.c
parent58f8049645d828026603af6422a59414f54799e8 (diff)
update api
Diffstat (limited to 'test/core/iomgr/tcp_posix_test.c')
-rw-r--r--test/core/iomgr/tcp_posix_test.c17
1 files changed, 8 insertions, 9 deletions
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);