Skip to content

Commit

Permalink
win: store the tcp deferred bind error in uv_tcp_t.bind_error, remove…
Browse files Browse the repository at this point in the history
… uv_handle_t.error
  • Loading branch information
piscisaureus committed Aug 23, 2011
1 parent b931e93 commit 8118287
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/uv-win.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 }; \
Expand Down
1 change: 0 additions & 1 deletion src/win/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/win/loop-watcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(); \
\
Expand Down
1 change: 0 additions & 1 deletion src/win/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/win/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
8 changes: 4 additions & 4 deletions src/win/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 0 additions & 1 deletion src/win/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 8118287

Please sign in to comment.