Commit ecda9f06 authored by Joanne Hugé's avatar Joanne Hugé

Fix TypeError in _updateCountry

Addresses passed to _updateCountry can contain countries if
cache.my_address is used to initialize address in BaseTunnelManager init
function, which causes resolve to be called with too many arguments.
parent bbde1c0d
...@@ -662,6 +662,8 @@ class BaseTunnelManager(object): ...@@ -662,6 +662,8 @@ class BaseTunnelManager(object):
def _updateCountry(self, address): def _updateCountry(self, address):
def update(): def update():
for a in address: for a in address:
if len(a) > 3:
return a[3]
family, ip = resolve(*a) family, ip = resolve(*a)
for ip in ip: for ip in ip:
country = self._geoiplookup(ip) country = self._geoiplookup(ip)
...@@ -672,7 +674,7 @@ class BaseTunnelManager(object): ...@@ -672,7 +674,7 @@ class BaseTunnelManager(object):
family_dict[family], country, ip) family_dict[family], country, ip)
return country return country
country = self._conf_country or update() country = self._conf_country or update()
return [a + (country,) for a in address] if country else address return [a[:3] + (country,) for a in address] if country else address
class TunnelManager(BaseTunnelManager): class TunnelManager(BaseTunnelManager):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment