Skip to content

Instantly share code, notes, and snippets.

@saghul
Created July 8, 2014 20:21
Show Gist options
  • Save saghul/a2da3e48433006669c43 to your computer and use it in GitHub Desktop.
Save saghul/a2da3e48433006669c43 to your computer and use it in GitHub Desktop.
commit daf360ee7660d683da44650c5a154ba11403b7d5
Author: Saúl Ibarra Corretgé <[email protected]>
Date: Tue Jul 8 22:17:34 2014 +0200
windows: set readable and writable flags on uv_tcp_open
We don't know if it's connected already, but do it as a best-effort
approach. FWIW we do the same on Unix.
diff --git a/src/win/tcp.c b/src/win/tcp.c
index 61ae6e9..7db0005 100644
--- a/src/win/tcp.c
+++ b/src/win/tcp.c
@@ -1403,6 +1403,10 @@ int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock) {
return uv_translate_sys_error(err);
}
+ /* we don't know where the socket comes from, so as a best-effor approach
+ * assume it might already be connected */
+ handle->flags |= UV_HANDLE_READABLE | UV_HANDLE_WRITABLE;
+
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment