Browse code

make non-blocking connect work on Windows

Instead of EINPROGRESS WinSock2 returns WSAEWOULDBLOCK if a non-blocking
connect(2) cannot be completed immediately.

Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: 1342541993-32462-1-git-send-email-heiko.hund@sophos.com
URL: http://article.gmane.org/gmane.network.openvpn.devel/6875
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>

Heiko Hund authored on 2012/07/18 01:19:53
Showing 1 changed files
... ...
@@ -1165,7 +1165,13 @@ openvpn_connect (socket_descriptor_t sd,
1165 1165
   status = connect (sd, &remote->addr.sa, af_addr_size(remote->addr.sa.sa_family));
1166 1166
   if (status)
1167 1167
     status = openvpn_errno_socket ();
1168
-  if (status == EINPROGRESS)
1168
+  if (
1169
+#ifdef WIN32
1170
+    status == WSAEWOULDBLOCK
1171
+#else
1172
+    status == EINPROGRESS
1173
+#endif
1174
+  )
1169 1175
     {
1170 1176
       while (true)
1171 1177
 	{