From d5286d8375f3a91e29b8da0e4f054cd6a722ffd7 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Sun, 21 Aug 2011 19:38:20 +0200
Subject: [PATCH] improve connect to remote host in zeroconf under windows

---
 src/common/zeroconf/client_zeroconf.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/common/zeroconf/client_zeroconf.py b/src/common/zeroconf/client_zeroconf.py
index 2f70bc72e2..c5049c6fc9 100644
--- a/src/common/zeroconf/client_zeroconf.py
+++ b/src/common/zeroconf/client_zeroconf.py
@@ -458,7 +458,10 @@ class P2PConnection(IdleObject, PlugIn):
             self._sock.setblocking(False)
         except Exception, ee:
             (errnum, errstr) = ee
-        if errnum in (errno.EINPROGRESS, errno.EALREADY, errno.EWOULDBLOCK):
+        errors = (errno.EINPROGRESS, errno.EALREADY, errno.EWOULDBLOCK)
+        if 'WSAEINVAL' in errno.__dict__:
+            errors += (errno.WSAEINVAL,)
+        if errnum in errors:
             return
         # win32 needs this
         elif errnum not in (0, 10056, errno.EISCONN) or self.state != 0:
-- 
GitLab