r/protonvpn: watchdog: reconfigure at startup

If the remote address configuration for strongSwan is not valid when the
Proton VPN watchdog starts, it will now regenerate it immediately.  This
can happen, for example, if the Internet has been down for a while, and
the watchdog has iterated through all of the servers in the cache.
Restarting the service will now force it to reconfigure the tunnel and
bring the VPN back up.
ntfy
Dustin 2021-10-31 01:24:52 -05:00
parent 328f2fa586
commit 19330ac555
1 changed files with 10 additions and 0 deletions

View File

@ -174,6 +174,16 @@ class AsyncDaemon(BaseAsyncDaemon):
async def manage_serverlist(self) -> None:
while 1:
self.serverlist = await self.get_serverlist()
try:
st = os.stat(self.CONFIG)
except FileNotFoundError:
await self.reconfigure()
except OSError as e:
log.error('Error checking config file attributes: %s', e)
await self.reconfigure()
else:
if st.st_size < 10:
await self.reconfigure()
await asyncio.sleep(3600 + random.randint(0, 900))
def mark_bad(self, addr: str) -> None: