ensure we update if no cached IPs

This commit is contained in:
brent s. 2020-05-15 01:53:37 -04:00
parent a8475d9001
commit c45754b1a3
Signed by: bts
GPG Key ID: 8C004C2F93481F6B

View File

@ -65,6 +65,8 @@ class TunnelBroker(object):
chk_tuple = (datetime.datetime.utcnow(), self.my_ip) chk_tuple = (datetime.datetime.utcnow(), self.my_ip)
if len(self.cached_ips) >= 1 and self.my_ip.str != self.cached_ips[-1][1].str: if len(self.cached_ips) >= 1 and self.my_ip.str != self.cached_ips[-1][1].str:
self.needs_update = True self.needs_update = True
elif len(self.cached_ips) == 0:
self.needs_update = True
if self.needs_update: if self.needs_update:
self.cached_ips.append(chk_tuple) self.cached_ips.append(chk_tuple)
with open(self.ip_cache, 'w') as fh: with open(self.ip_cache, 'w') as fh: