Commit 0f97c026 authored by Johan Hugé's avatar Johan Hugé Committed by Thomas Gambier

Fix issue causing nodes to ignore countries after restart

If a node restarts and has its address with its country in the cache, it
won't set the _country attribute, and will therefore ignore countries
when making tunnels.

See merge request !31
parent e8629de5
...@@ -662,11 +662,9 @@ class BaseTunnelManager(object): ...@@ -662,11 +662,9 @@ 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: family, ip = resolve(*a[:3])
return a[3]
family, ip = resolve(*a)
for ip in ip: for ip in ip:
country = self._geoiplookup(ip) country = a[3] if len(a) > 3 else self._geoiplookup(ip)
if country: if country:
if self._country.get(family) != country: if self._country.get(family) != country:
self._country[family] = country self._country[family] = country
......
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