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:
20
deps/libuv/test/test-tcp-rst.c
vendored
20
deps/libuv/test/test-tcp-rst.c
vendored
@@ -31,7 +31,7 @@ static int called_close_cb;
|
||||
|
||||
|
||||
static void close_cb(uv_handle_t* handle) {
|
||||
ASSERT(handle == (uv_handle_t*) &tcp);
|
||||
ASSERT_PTR_EQ(handle, (uv_handle_t*) &tcp);
|
||||
called_close_cb++;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ static void read_cb(uv_stream_t* t, ssize_t nread, const uv_buf_t* buf) {
|
||||
ASSERT_EQ(nread, UV_ECONNRESET);
|
||||
|
||||
int fd;
|
||||
ASSERT_EQ(0, uv_fileno((uv_handle_t*) t, &fd));
|
||||
ASSERT_OK(uv_fileno((uv_handle_t*) t, &fd));
|
||||
uv_handle_type type = uv_guess_handle(fd);
|
||||
ASSERT_EQ(type, UV_TCP);
|
||||
|
||||
@@ -58,11 +58,11 @@ static void read_cb(uv_stream_t* t, ssize_t nread, const uv_buf_t* buf) {
|
||||
|
||||
|
||||
static void connect_cb(uv_connect_t *req, int status) {
|
||||
ASSERT_EQ(status, 0);
|
||||
ASSERT_OK(status);
|
||||
ASSERT_PTR_EQ(req, &connect_req);
|
||||
|
||||
/* Start reading from the connection so we receive the RST in uv__read. */
|
||||
ASSERT_EQ(0, uv_read_start((uv_stream_t*) &tcp, alloc_cb, read_cb));
|
||||
ASSERT_OK(uv_read_start((uv_stream_t*) &tcp, alloc_cb, read_cb));
|
||||
|
||||
/* Write 'QSH' to receive RST from the echo server. */
|
||||
ASSERT_EQ(qbuf.len, uv_try_write((uv_stream_t*) &tcp, &qbuf, 1));
|
||||
@@ -86,21 +86,21 @@ TEST_IMPL(tcp_rst) {
|
||||
qbuf.base = "QSH";
|
||||
qbuf.len = 3;
|
||||
|
||||
ASSERT_EQ(0, uv_ip4_addr("127.0.0.1", TEST_PORT, &server_addr));
|
||||
ASSERT_OK(uv_ip4_addr("127.0.0.1", TEST_PORT, &server_addr));
|
||||
r = uv_tcp_init(uv_default_loop(), &tcp);
|
||||
ASSERT_EQ(r, 0);
|
||||
ASSERT_OK(r);
|
||||
|
||||
r = uv_tcp_connect(&connect_req,
|
||||
&tcp,
|
||||
(const struct sockaddr*) &server_addr,
|
||||
connect_cb);
|
||||
ASSERT_EQ(r, 0);
|
||||
ASSERT_OK(r);
|
||||
|
||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||
|
||||
ASSERT_EQ(called_alloc_cb, 1);
|
||||
ASSERT_EQ(called_connect_cb, 1);
|
||||
ASSERT_EQ(called_close_cb, 1);
|
||||
ASSERT_EQ(1, called_alloc_cb);
|
||||
ASSERT_EQ(1, called_connect_cb);
|
||||
ASSERT_EQ(1, called_close_cb);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user