hgext/zeroconf/__init__.py
changeset 30885 564a96a56b73
parent 29841 d5883fd055c6
child 33178 a0068f49b5f6
equal deleted inserted replaced
30884:a68510b69f41 30885:564a96a56b73
    62         pass
    62         pass
    63 
    63 
    64     # Generic method, sometimes gives useless results
    64     # Generic method, sometimes gives useless results
    65     try:
    65     try:
    66         dumbip = socket.gethostbyaddr(socket.gethostname())[2][0]
    66         dumbip = socket.gethostbyaddr(socket.gethostname())[2][0]
    67         if not dumbip.startswith('127.') and ':' not in dumbip:
    67         if ':' in dumbip:
       
    68             dumbip = '127.0.0.1'
       
    69         if not dumbip.startswith('127.'):
    68             return dumbip
    70             return dumbip
    69     except (socket.gaierror, socket.herror):
    71     except (socket.gaierror, socket.herror):
    70         dumbip = '127.0.0.1'
    72         dumbip = '127.0.0.1'
    71 
    73 
    72     # works elsewhere, but actually sends a packet
    74     # works elsewhere, but actually sends a packet