Permalink
Browse files

test: fix close of uninitialized handle

The test closes all handles after 1000 ms but the remote peer handle may not
have been initialized by then (very unlikely but not quite impossible).
  • Loading branch information...
1 parent 0a7e36d commit 625340066ebad876bb46ff3165b3b6fb23168dc0 @bnoordhuis bnoordhuis committed Nov 11, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 test/test-tcp-unexpected-read.c
@@ -77,7 +77,6 @@ static void connection_cb(uv_stream_t* handle, int status) {
buf = uv_buf_init("PING", 4);
ASSERT(0 == status);
- ASSERT(0 == uv_tcp_init(uv_default_loop(), &peer_handle));
ASSERT(0 == uv_accept(handle, (uv_stream_t*) &peer_handle));
ASSERT(0 == uv_read_start((uv_stream_t*) &peer_handle, alloc_cb, read_cb));
ASSERT(0 == uv_write(&write_req, (uv_stream_t*) &peer_handle,
@@ -98,6 +97,7 @@ TEST_IMPL(tcp_unexpected_read) {
ASSERT(0 == uv_check_start(&check_handle, check_cb));
ASSERT(0 == uv_tcp_init(loop, &server_handle));
ASSERT(0 == uv_tcp_init(loop, &client_handle));
+ ASSERT(0 == uv_tcp_init(loop, &peer_handle));
ASSERT(0 == uv_tcp_bind(&server_handle, addr));
ASSERT(0 == uv_listen((uv_stream_t*) &server_handle, 1, connection_cb));
ASSERT(0 == uv_tcp_connect(&connect_req, &client_handle, addr, connect_cb));

0 comments on commit 6253400

Please sign in to comment.