Use the new algorthm preferentially when getting external IP

This commit is contained in:
Kovid Goyal 2016-01-09 15:07:32 +05:30
parent ccd34f8d3f
commit 3a1bb4ad0a

View File

@ -89,7 +89,11 @@ _ext_ip = None
def get_external_ip(): def get_external_ip():
global _ext_ip global _ext_ip
if _ext_ip is None: if _ext_ip is None:
_ext_ip = _get_external_ip() from calibre.utils.ip_routing import get_default_route_src_address
try:
_ext_ip = get_default_route_src_address()
except Exception:
_ext_ip = _get_external_ip()
return _ext_ip return _ext_ip
def start_server(): def start_server():