From: Daira Hopwood Date: Tue, 25 Jun 2013 18:51:27 +0000 (+0100) Subject: iputil.py: simplify address finding code on cygwin. X-Git-Tag: allmydata-tahoe-1.10.1a1~230 X-Git-Url: https://git.rkrishnan.org/?a=commitdiff_plain;h=08590b1f6a880d51751fdcacea6a007ebc568f2e;p=tahoe-lafs%2Ftahoe-lafs.git iputil.py: simplify address finding code on cygwin. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/util/iputil.py b/src/allmydata/util/iputil.py index c1239f0e..bd1d82f7 100644 --- a/src/allmydata/util/iputil.py +++ b/src/allmydata/util/iputil.py @@ -81,11 +81,11 @@ def get_local_addresses_async(target="198.41.0.4"): # A.ROOT-SERVERS.NET """ addresses = [] local_ip = get_local_ip_for(target) - if local_ip: + if local_ip is not None: addresses.append(local_ip) if sys.platform == "cygwin": - d = _cygwin_hack_find_addresses(target) + d = _cygwin_hack_find_addresses() else: d = _find_addresses_via_config() @@ -211,14 +211,11 @@ def _query(path, args, regex): return addresses -def _cygwin_hack_find_addresses(target): +def _cygwin_hack_find_addresses(): addresses = [] - for h in [target, "localhost", "127.0.0.1",]: - try: - addr = get_local_ip_for(h) - if addr not in addresses: - addresses.append(addr) - except socket.gaierror: - pass + for h in ["localhost", "127.0.0.1",]: + addr = get_local_ip_for(h) + if addr is not None and addr not in addresses: + addresses.append(addr) return defer.succeed(addresses)