diff --git a/oio-win.c b/oio-win.c index 64923909..f307f8d3 100644 --- a/oio-win.c +++ b/oio-win.c @@ -230,6 +230,7 @@ static oio_err_code oio_translate_sys_error(int sys_errno) { case WSAEINVAL: return OIO_EINVAL; case WSAEALREADY: return OIO_EALREADY; case ERROR_OUTOFMEMORY: return OIO_ENOMEM; + case ERROR_CONNECTION_REFUSED: return OIO_ECONNREFUSED; default: return OIO_UNKNOWN; } } diff --git a/test/test-connection-fail.c b/test/test-connection-fail.c index 3a268c59..a9ebe30a 100644 --- a/test/test-connection-fail.c +++ b/test/test-connection-fail.c @@ -40,13 +40,13 @@ static void on_close(oio_handle* handle, int status) { static void on_connect(oio_req *req, int status) { ASSERT(status == -1); + ASSERT(oio_last_error().code == OIO_ECONNREFUSED); connect_cb_calls++; - oio_close(req->handle); } -TEST_IMPL(test_connection_fail) { +TEST_IMPL(connection_fail) { struct sockaddr_in client_addr, server_addr; int r; diff --git a/test/test-list.h b/test/test-list.h index 4451e2d9..20fffc3f 100644 --- a/test/test-list.h +++ b/test/test-list.h @@ -24,7 +24,7 @@ TEST_DECLARE (close_cb_stack) TEST_DECLARE (timeout) TEST_DECLARE (fail_always) TEST_DECLARE (pass_always) -TEST_DECLARE (test_connection_fail) +TEST_DECLARE (connection_fail) HELPER_DECLARE (echo_server) TASK_LIST_START @@ -39,5 +39,5 @@ TASK_LIST_START TEST_ENTRY (fail_always) TEST_ENTRY (pass_always) - TEST_ENTRY (test_connection_fail) + TEST_ENTRY (connection_fail) TASK_LIST_END