Commit 4fda2dc7 authored by Julien Muchembled's avatar Julien Muchembled

Fix wrong WARNING when own ip is unknown at startup

parent d7a4d73f
...@@ -203,12 +203,15 @@ class Cache(object): ...@@ -203,12 +203,15 @@ class Cache(object):
def my_address(self): def my_address(self):
for x, in self._db.execute("SELECT address FROM peer WHERE NOT prefix"): for x, in self._db.execute("SELECT address FROM peer WHERE NOT prefix"):
return x return x
return ''
@my_address.setter @my_address.setter
def my_address(self, *args): def my_address(self, value):
if value:
with self._db as db: with self._db as db:
db.execute("INSERT OR REPLACE INTO peer VALUES ('', ?)", args) db.execute("INSERT OR REPLACE INTO peer VALUES ('', ?)",
(value,))
else:
del self.my_address
@my_address.deleter @my_address.deleter
def my_address(self): def my_address(self):
......
...@@ -213,7 +213,9 @@ class BaseTunnelManager(object): ...@@ -213,7 +213,9 @@ class BaseTunnelManager(object):
if any(address_dict.itervalues()): if any(address_dict.itervalues()):
del cache.my_address del cache.my_address
else: else:
for address in utils.parse_address(cache.my_address): address = cache.my_address
if address:
for address in utils.parse_address(address):
try: try:
proto = proto_dict[address[2]] proto = proto_dict[address[2]]
except KeyError: except KeyError:
......
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