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,6 +89,10 @@ _ext_ip = None
def get_external_ip():
global _ext_ip
if _ext_ip is None:
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