windows: turn WSAECONNABORTED from WSARecv to UV_ECONNRESET
This commit is contained in:
parent
4794c12f58
commit
f17d4837a8
@ -830,9 +830,10 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle,
|
||||
err = GET_REQ_SOCK_ERROR(req);
|
||||
|
||||
if (err == WSAECONNABORTED) {
|
||||
/* Treat WSAECONNABORTED as connection closed. */
|
||||
handle->flags |= UV_HANDLE_EOF;
|
||||
uv__set_error(loop, UV_EOF, ERROR_SUCCESS);
|
||||
/*
|
||||
* Turn WSAECONNABORTED into UV_ECONNRESET to be consistent with Unix.
|
||||
*/
|
||||
uv__set_error(loop, UV_ECONNRESET, err);
|
||||
} else {
|
||||
uv__set_sys_error(loop, err);
|
||||
}
|
||||
@ -898,9 +899,10 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle,
|
||||
handle->read_cb((uv_stream_t*)handle, 0, buf);
|
||||
} else {
|
||||
if (err == WSAECONNABORTED) {
|
||||
/* Treat WSAECONNABORTED as connection closed. */
|
||||
handle->flags |= UV_HANDLE_EOF;
|
||||
uv__set_error(loop, UV_EOF, ERROR_SUCCESS);
|
||||
/*
|
||||
* Turn WSAECONNABORTED into UV_ECONNRESET to be consistent with Unix.
|
||||
*/
|
||||
uv__set_error(loop, UV_ECONNRESET, err);
|
||||
} else {
|
||||
/* Ouch! serious error. */
|
||||
uv__set_sys_error(loop, err);
|
||||
|
||||
@ -40,8 +40,6 @@ static uv_write_t write_req;
|
||||
|
||||
static int write_cb_called;
|
||||
static int read_cb_called;
|
||||
static int read_eof_cb_called;
|
||||
|
||||
|
||||
static void connection_cb(uv_stream_t* server, int status) {
|
||||
int r;
|
||||
@ -76,12 +74,11 @@ static uv_buf_t alloc_cb(uv_handle_t* handle, size_t suggested_size) {
|
||||
static void read_cb(uv_stream_t* stream, ssize_t nread, uv_buf_t buf) {
|
||||
if (nread == -1) {
|
||||
fprintf(stderr, "read_cb error: %s\n", uv_err_name(uv_last_error(stream->loop)));
|
||||
ASSERT(uv_last_error(stream->loop).code == UV_EOF);
|
||||
ASSERT(uv_last_error(stream->loop).code == UV_ECONNRESET ||
|
||||
uv_last_error(stream->loop).code == UV_EOF);
|
||||
|
||||
uv_close((uv_handle_t*)&tcp_server, NULL);
|
||||
uv_close((uv_handle_t*)&tcp_peer, NULL);
|
||||
|
||||
read_eof_cb_called++;
|
||||
}
|
||||
|
||||
read_cb_called++;
|
||||
@ -133,7 +130,6 @@ TEST_IMPL(tcp_write_to_half_open_connection) {
|
||||
|
||||
ASSERT(write_cb_called > 0);
|
||||
ASSERT(read_cb_called > 0);
|
||||
ASSERT(read_eof_cb_called > 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user