Bug 1163992 - [moznetwork] When multiple IPs are found on Windows pick the first one. r=wlachance

This commit is contained in:
Dave Hunt 2015-05-14 09:48:19 +01:00
parent d544362e3d
commit 143c19534e

View File

@ -120,8 +120,11 @@ def get_ip():
ips = socket.gethostbyname_ex(hostname)[2]
if len(ips) == 1:
ip = ips[0]
else:
elif len(ips) > 1:
logger.debug('Multiple addresses found: %s' % ips)
# no fallback on Windows so take the first address
ip = ips[0] if mozinfo.isWin else None
else:
ip = None
except socket.gaierror:
# sometimes the hostname doesn't resolve to an ip address, in which