zeroconf: Don't break serve if no internet connection is present.
authorAugie Fackler <durin42@gmail.com>
Wed, 29 Oct 2008 18:54:46 -0500
changeset 7295 66d0fc108044
parent 7294 f933076a19fc
child 7296 695383442347
zeroconf: Don't break serve if no internet connection is present.
hgext/zeroconf/__init__.py
--- a/hgext/zeroconf/__init__.py	Thu Oct 30 09:46:45 2008 +0100
+++ b/hgext/zeroconf/__init__.py	Wed Oct 29 18:54:46 2008 -0500
@@ -46,7 +46,11 @@
 def publish(name, desc, path, port):
     global server, localip
     if not server:
-        server = Zeroconf.Zeroconf()
+        try:
+            server = Zeroconf.Zeroconf()
+        except socket.gaierror:
+            # if we have no internet connection, this can happen.
+            return
         ip = getip()
         localip = socket.inet_aton(ip)