From 4b58985370cd6aa13f10b390b7694e891abff974 Mon Sep 17 00:00:00 2001 From: John Barboza Date: Sat, 9 Jul 2016 14:45:32 -0400 Subject: [PATCH] test: close server before initiating new connection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/libuv/libuv/pull/944 Reviewed-By: Imran Iqbal Reviewed-By: Saúl Ibarra Corretgé --- test/test-tcp-close-accept.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test-tcp-close-accept.c b/test/test-tcp-close-accept.c index 0729d46d..e4878398 100644 --- a/test/test-tcp-close-accept.c +++ b/test/test-tcp-close-accept.c @@ -102,6 +102,9 @@ static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { uv_close((uv_handle_t*) &tcp_incoming[i], close_cb); } + /* Close server, so no one will connect to it */ + uv_close((uv_handle_t*) &tcp_server, close_cb); + /* Create new fd that should be one of the closed incomings */ ASSERT(0 == uv_tcp_init(loop, &tcp_check)); ASSERT(0 == uv_tcp_connect(&tcp_check_req, @@ -109,9 +112,6 @@ static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { (const struct sockaddr*) &addr, connect_cb)); ASSERT(0 == uv_read_start((uv_stream_t*) &tcp_check, alloc_cb, read_cb)); - - /* Close server, so no one will connect to it */ - uv_close((uv_handle_t*) &tcp_server, close_cb); } static void connection_cb(uv_stream_t* server, int status) {