On 5. 09. 14 11:53, Bozo Dragojevic wrote:

The patch is a bit rough
- not sure I really like the name pn_io_no_iocp()
- missing non-windows stub for pn_io_no_iocp()
- it most likely handles the selector access wrong (see XXX comment)
I missed this bit (blush)

diff --git a/proton-c/src/windows/io.c b/proton-c/src/windows/io.c
index f9c85b4..b5fc7b2 100644
--- a/proton-c/src/windows/io.c
+++ b/proton-c/src/windows/io.c
@@ -263,6 +263,14 @@ pn_socket_t pn_connect(pn_io_t *io, const char *hostarg, const char *port)
   if (io->iocp != NULL) {
     sock = pni_iocp_begin_connect(io->iocp, sock, addr, io->error);
   } else {
+    if (connect(sock, addr->ai_addr, addr->ai_addrlen) != 0) {
+      if (WSAGetLastError() != WSAEWOULDBLOCK) {
+        pni_win32_error(io->error, "connect", WSAGetLastError());
+        freeaddrinfo(addr);
+        closesocket(sock);
+        return INVALID_SOCKET;
+      }
+    }
     freeaddrinfo(addr);
   }
   return sock;

Bozzo

Reply via email to