From 811828719ff265a7f9de99620aab3c66afe65ab2 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Tue, 23 Aug 2011 20:33:26 +0200 Subject: [PATCH] win: store the tcp deferred bind error in uv_tcp_t.bind_error, remove uv_handle_t.error --- include/uv-win.h | 2 +- src/win/async.c | 1 - src/win/loop-watcher.c | 1 - src/win/process.c | 1 - src/win/stream.c | 1 - src/win/tcp.c | 8 ++++---- src/win/timer.c | 1 - 7 files changed, 5 insertions(+), 10 deletions(-) diff --git a/include/uv-win.h b/include/uv-win.h index 83dbebe3..bcbbb5bd 100644 --- a/include/uv-win.h +++ b/include/uv-win.h @@ -58,7 +58,6 @@ typedef struct uv_buf_t { size_t queued_bytes; \ }; \ }; \ - uv_err_t error; \ struct uv_req_s* next_req; #define UV_WRITE_PRIVATE_FIELDS \ @@ -109,6 +108,7 @@ typedef struct uv_buf_t { #define UV_TCP_PRIVATE_FIELDS \ SOCKET socket; \ + uv_err_t bind_error; \ union { \ struct { uv_tcp_server_fields }; \ struct { uv_tcp_connection_fields }; \ diff --git a/src/win/async.c b/src/win/async.c index e3ca2a47..1a6fb088 100644 --- a/src/win/async.c +++ b/src/win/async.c @@ -78,7 +78,6 @@ int uv_async_init(uv_async_t* handle, uv_async_cb async_cb) { handle->type = UV_ASYNC; handle->flags = 0; handle->async_sent = 0; - handle->error = uv_ok_; handle->async_cb = async_cb; req = &handle->async_req; diff --git a/src/win/loop-watcher.c b/src/win/loop-watcher.c index 3038218c..1344cde0 100644 --- a/src/win/loop-watcher.c +++ b/src/win/loop-watcher.c @@ -44,7 +44,6 @@ void uv_loop_watcher_endgame(uv_handle_t* handle) { int uv_##name##_init(uv_##name##_t* handle) { \ handle->type = UV_##NAME; \ handle->flags = 0; \ - handle->error = uv_ok_; \ \ uv_ref(); \ \ diff --git a/src/win/process.c b/src/win/process.c index 22d06060..f5523faf 100644 --- a/src/win/process.c +++ b/src/win/process.c @@ -54,7 +54,6 @@ typedef struct env_var { static void uv_process_init(uv_process_t* handle) { handle->type = UV_PROCESS; handle->flags = 0; - handle->error = uv_ok_; handle->exit_cb = NULL; handle->pid = 0; handle->exit_signal = 0; diff --git a/src/win/stream.c b/src/win/stream.c index fcd88b8d..b2c5aa34 100644 --- a/src/win/stream.c +++ b/src/win/stream.c @@ -29,7 +29,6 @@ void uv_stream_init(uv_stream_t* handle) { handle->write_queue_size = 0; handle->flags = 0; - handle->error = uv_ok_; uv_counters()->handle_init++; uv_counters()->stream_init++; diff --git a/src/win/tcp.c b/src/win/tcp.c index 81c3ab92..9f5aa72e 100644 --- a/src/win/tcp.c +++ b/src/win/tcp.c @@ -174,7 +174,7 @@ static int uv__bind(uv_tcp_t* handle, int domain, struct sockaddr* addr, int add err = WSAGetLastError(); if (err == WSAEADDRINUSE) { /* Some errors are not to be reported until connect() or listen() */ - handle->error = uv_new_sys_error(err); + handle->bind_error = uv_new_sys_error(err); handle->flags |= UV_HANDLE_BIND_ERROR; } else { uv_set_sys_error(err); @@ -335,7 +335,7 @@ int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) { assert(backlog > 0); if (handle->flags & UV_HANDLE_BIND_ERROR) { - LOOP->last_error = handle->error; + LOOP->last_error = handle->bind_error; return -1; } @@ -452,7 +452,7 @@ int uv_tcp_connect(uv_connect_t* req, uv_tcp_t* handle, DWORD bytes; if (handle->flags & UV_HANDLE_BIND_ERROR) { - LOOP->last_error = handle->error; + LOOP->last_error = handle->bind_error; return -1; } @@ -507,7 +507,7 @@ int uv_tcp_connect6(uv_connect_t* req, uv_tcp_t* handle, } if (handle->flags & UV_HANDLE_BIND_ERROR) { - LOOP->last_error = handle->error; + LOOP->last_error = handle->bind_error; return -1; } diff --git a/src/win/timer.c b/src/win/timer.c index ea5e7195..68d3e302 100644 --- a/src/win/timer.c +++ b/src/win/timer.c @@ -117,7 +117,6 @@ int uv_timer_init(uv_timer_t* handle) { handle->type = UV_TIMER; handle->flags = 0; - handle->error = uv_ok_; handle->timer_cb = NULL; handle->repeat = 0;