Bug 714903 - Fix getLanIp to work with Mac OS X as well instead of dying with an exception. r=jmaher

This commit is contained in:
Kartikaya Gupta 2012-01-03 15:15:02 -05:00
Родитель acc8960f93
Коммит 4cf5ad3f3e
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -500,7 +500,10 @@ class NetworkTools:
return None
def getLanIp(self):
ip = socket.gethostbyname(socket.gethostname())
try:
ip = socket.gethostbyname(socket.gethostname())
except socket.gaierror:
ip = socket.gethostbyname(socket.gethostname() + ".local") # for Mac OS X
if ip.startswith("127.") and os.name != "nt":
interfaces = ["eth0","eth1","eth2","wlan0","wlan1","wifi0","ath0","ath1","ppp0"]
for ifname in interfaces: