From 1ece8fb85ff73d9db9028743760044fe058cc38c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 25 Jul 2014 12:48:16 +0200 Subject: [PATCH] windows: return bind error immediately when implicitly binding If a TCP handle is bound automatically when calling uv_listen or uv_connect, there is a remote possibility that it fails, return the error if so. --- src/win/tcp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/win/tcp.c b/src/win/tcp.c index 61ae6e9a..e2d21010 100644 --- a/src/win/tcp.c +++ b/src/win/tcp.c @@ -539,6 +539,8 @@ int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) { 0); if (err) return err; + if (handle->flags & UV_HANDLE_BIND_ERROR) + return handle->bind_error; } if (!handle->func_acceptex) { @@ -725,6 +727,8 @@ static int uv_tcp_try_connect(uv_connect_t* req, err = uv_tcp_try_bind(handle, bind_addr, addrlen, 0); if (err) return err; + if (handle->flags & UV_HANDLE_BIND_ERROR) + return handle->bind_error; } if (!handle->func_connectex) {