diff --git a/src/common/zeroconf/client_zeroconf.py b/src/common/zeroconf/client_zeroconf.py index c60834525..2599ca141 100644 --- a/src/common/zeroconf/client_zeroconf.py +++ b/src/common/zeroconf/client_zeroconf.py @@ -58,9 +58,12 @@ class ZeroconfListener(IdleObject): self.caller = conn_holder.caller self.conn_holder = conn_holder - def bind(self): + def bind(self): + flags = socket.AI_PASSIVE + if hasattr(socket, 'AI_ADDRCONFIG'): + flags |= socket.AI_ADDRCONFIG) ai = socket.getaddrinfo(None, self.port, socket.AF_UNSPEC, - socket.SOCK_STREAM, 0, socket.AI_PASSIVE | socket.AI_ADDRCONFIG)[0] + socket.SOCK_STREAM, 0, flags)[0] self._serv = socket.socket(ai[0], ai[1]) self._serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self._serv.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) diff --git a/src/common/zeroconf/connection_zeroconf.py b/src/common/zeroconf/connection_zeroconf.py index b0bab07c8..f57338403 100644 --- a/src/common/zeroconf/connection_zeroconf.py +++ b/src/common/zeroconf/connection_zeroconf.py @@ -246,7 +246,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): self.status = 'offline' self.dispatch('CONNECTION_LOST', (_('Could not connect to "%s"') % self.name, - _('Please check if Avahi is installed.'))) + _('Please check if Avahi or Bonjour is installed.'))) self.disconnect() return result = self.connection.connect(show, msg) diff --git a/src/common/zeroconf/zeroconf.py b/src/common/zeroconf/zeroconf.py index 8d8e70185..c33ff48c3 100644 --- a/src/common/zeroconf/zeroconf.py +++ b/src/common/zeroconf/zeroconf.py @@ -31,6 +31,8 @@ def test_bonjour(): try: import pybonjour except ImportError: + return False + except WindowsError: return False return True