[PATCH] Zeroconf breaks serve if there is no internet connection
Augie Fackler
lists at durin42.com
Thu Oct 30 09:22:42 CDT 2008
On Oct 30, 2008, at 5:14 AM, Benoit Boissinot wrote:
> On Thu, Oct 30, 2008 at 1:55 AM, Augie Fackler <lists at durin42.com>
> wrote:
>> The included patch fixes a bug I encountered in the zeroconf
>> extension
>> while on a plane. Adding this patch fixes zeroconf in situations when
>> no internet connection is available, but allows it to work normally
>> when there is one.
>
> Shouldn't it try to bind on lo ?
I fully expected it to, but it doesn't on OS X at the very least.
Here's an updated patch:
# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1225324486 18000
# Node ID 64a137f10f3fde6a27c37756ff261224025c7108
# Parent a3871028aacfd7102a766bd4cb986e3ff73c255f
zeroconf: Don't break serve if no internet connection is present.
diff --git a/hgext/zeroconf/__init__.py b/hgext/zeroconf/__init__.py
--- a/hgext/zeroconf/__init__.py
+++ b/hgext/zeroconf/__init__.py
@@ -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)
More information about the Mercurial-devel
mailing list