test: simplify test-tcp-try-write
Use a smaller buffer thus making sure that uv_try_write will succeed at least once
This commit is contained in:
parent
40ad12e5be
commit
b018dc5b72
@ -54,21 +54,17 @@ static void close_cb(uv_handle_t* handle) {
|
||||
|
||||
|
||||
static void connect_cb(uv_connect_t* req, int status) {
|
||||
static char zeroes[1024];
|
||||
int r;
|
||||
uv_buf_t buf;
|
||||
ASSERT(status == 0);
|
||||
connect_cb_called++;
|
||||
|
||||
do {
|
||||
buf = uv_buf_init(zeroes, sizeof(zeroes));
|
||||
buf = uv_buf_init("PING", 4);
|
||||
r = uv_try_write((uv_stream_t*) &client, &buf, 1);
|
||||
ASSERT(r > 0 || r == UV_EAGAIN);
|
||||
if (r > 0) {
|
||||
bytes_written += r;
|
||||
|
||||
/* Partial write */
|
||||
if (r != (int) sizeof(zeroes))
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user