stream: support empty uv_try_write on unix

PR-URL: https://github.com/libuv/libuv/pull/558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Fedor Indutny 2015-10-03 16:19:11 -04:00
parent 764877fd9e
commit 5e761a5f81
2 changed files with 6 additions and 1 deletions

View File

@ -1471,7 +1471,7 @@ int uv_try_write(uv_stream_t* stream,
uv__stream_osx_interrupt_select(stream);
}
if (written == 0)
if (written == 0 && req_size != 0)
return -EAGAIN;
else
return written;

View File

@ -58,6 +58,11 @@ static void connect_cb(uv_connect_t* req, int status) {
break;
}
} while (1);
do {
buf = uv_buf_init("", 0);
r = uv_try_write((uv_stream_t*) &client, &buf, 1);
} while (r != 0);
uv_close((uv_handle_t*) &client, close_cb);
}