[PATCH] zeroconf: fail nicely on IPv6 only system

Augie Fackler raf at durin42.com
Thu Feb 9 21:50:05 EST 2017


On Wed, Feb 08, 2017 at 08:10:48AM -0800, Simon Farnsworth wrote:
> # HG changeset patch
> # User Simon Farnsworth <simonfar at fb.com>
> # Date 1486570121 28800
> #      Wed Feb 08 08:08:41 2017 -0800
> # Node ID a847eb00fcfeffce458e11b80ad38d4d4e7a700f
> # Parent  d50cda2a403786836d1f0d5c99401599dc4f43ec
> zeroconf: fail nicely on IPv6 only system

Queued, thanks.

> 
> zeroconf only knows how to deal with IPv4; I develop on a system where the only
> IPv4 address is 127.0.0.1.
> 
> Teach zeroconf to ignore IPv6 addresses when looking for plausible IPv4
> connectivity.
> 
> diff --git a/hgext/zeroconf/__init__.py b/hgext/zeroconf/__init__.py
> --- a/hgext/zeroconf/__init__.py
> +++ b/hgext/zeroconf/__init__.py
> @@ -64,7 +64,9 @@
>     # Generic method, sometimes gives useless results
>     try:
>         dumbip = socket.gethostbyaddr(socket.gethostname())[2][0]
> -        if not dumbip.startswith('127.') and ':' not in dumbip:
> +        if ':' in dumbip:
> +            dumbip = '127.0.0.1'
> +        if not dumbip.startswith('127.'):
>             return dumbip
>     except (socket.gaierror, socket.herror):
>         dumbip = '127.0.0.1'
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list