forked from cory/tildefriends
libuv 1.47.0.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4615 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
38
deps/libuv/test/test-tcp-read-stop.c
vendored
38
deps/libuv/test/test-tcp-read-stop.c
vendored
@ -40,21 +40,21 @@ static void write_cb(uv_write_t* req, int status) {
|
||||
|
||||
static void timer_cb(uv_timer_t* handle) {
|
||||
uv_buf_t buf = uv_buf_init("PING", 4);
|
||||
ASSERT(0 == uv_write(&write_req,
|
||||
(uv_stream_t*) &tcp_handle,
|
||||
&buf,
|
||||
1,
|
||||
write_cb));
|
||||
ASSERT(0 == uv_read_stop((uv_stream_t*) &tcp_handle));
|
||||
ASSERT_OK(uv_write(&write_req,
|
||||
(uv_stream_t*) &tcp_handle,
|
||||
&buf,
|
||||
1,
|
||||
write_cb));
|
||||
ASSERT_OK(uv_read_stop((uv_stream_t*) &tcp_handle));
|
||||
}
|
||||
|
||||
|
||||
static void connect_cb(uv_connect_t* req, int status) {
|
||||
ASSERT(0 == status);
|
||||
ASSERT(0 == uv_timer_start(&timer_handle, timer_cb, 50, 0));
|
||||
ASSERT(0 == uv_read_start((uv_stream_t*) &tcp_handle,
|
||||
(uv_alloc_cb) fail_cb,
|
||||
(uv_read_cb) fail_cb));
|
||||
ASSERT_OK(status);
|
||||
ASSERT_OK(uv_timer_start(&timer_handle, timer_cb, 50, 0));
|
||||
ASSERT_OK(uv_read_start((uv_stream_t*) &tcp_handle,
|
||||
(uv_alloc_cb) fail_cb,
|
||||
(uv_read_cb) fail_cb));
|
||||
}
|
||||
|
||||
|
||||
@ -62,14 +62,14 @@ TEST_IMPL(tcp_read_stop) {
|
||||
uv_connect_t connect_req;
|
||||
struct sockaddr_in addr;
|
||||
|
||||
ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr));
|
||||
ASSERT(0 == uv_timer_init(uv_default_loop(), &timer_handle));
|
||||
ASSERT(0 == uv_tcp_init(uv_default_loop(), &tcp_handle));
|
||||
ASSERT(0 == uv_tcp_connect(&connect_req,
|
||||
&tcp_handle,
|
||||
(const struct sockaddr*) &addr,
|
||||
connect_cb));
|
||||
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &addr));
|
||||
ASSERT_OK(uv_timer_init(uv_default_loop(), &timer_handle));
|
||||
ASSERT_OK(uv_tcp_init(uv_default_loop(), &tcp_handle));
|
||||
ASSERT_OK(uv_tcp_connect(&connect_req,
|
||||
&tcp_handle,
|
||||
(const struct sockaddr*) &addr,
|
||||
connect_cb));
|
||||
ASSERT_OK(uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user