From f37d26572acc95f5eb25af8e2bc81eae110144c4 Mon Sep 17 00:00:00 2001 From: brent s Date: Fri, 15 May 2020 01:48:26 -0400 Subject: [PATCH] first-run cache issue --- utils/he_ipv6/config.py | 4 +++- utils/he_ipv6/tunnelbroker.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/he_ipv6/config.py b/utils/he_ipv6/config.py index 1d6f073..b82e0eb 100644 --- a/utils/he_ipv6/config.py +++ b/utils/he_ipv6/config.py @@ -266,7 +266,9 @@ class HETunnelConfig(HEBaseConfig): self.my_ip = None # Client IPv4 (not necessary; we locally cache Tunnel.my_ip) self.allocations = {} # keys are 64 and 48 self.rdns = [] # Also not necessary, but it's in the XML so why not. - self.tun_xml = self.xml.find('tunnel') # Will only return a single for this URL. + # Will only return a single for this URL. + # TODO: I can probably consolidate all this into HECond instead? + self.tun_xml = self.xml.find('tunnel') self.parse() def _alloc(self): diff --git a/utils/he_ipv6/tunnelbroker.py b/utils/he_ipv6/tunnelbroker.py index c9d7b6c..2fb7cd7 100644 --- a/utils/he_ipv6/tunnelbroker.py +++ b/utils/he_ipv6/tunnelbroker.py @@ -63,7 +63,7 @@ class TunnelBroker(object): ipr.close() logger.debug('Set my_ip to {0}.'.format(self.my_ip.str)) chk_tuple = (datetime.datetime.utcnow(), self.my_ip) - if 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 if self.needs_update: self.cached_ips.append(chk_tuple)