changeset 7295:66d0fc108044

zeroconf: Don't break serve if no internet connection is present.
author Augie Fackler <durin42@gmail.com>
date Wed, 29 Oct 2008 18:54:46 -0500
parents f933076a19fc
children 695383442347
files hgext/zeroconf/__init__.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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)