[module/publicip] handle netifaces errors
make sure the monitoring thread doesn't terminate when there are netifaces errors. see #909
This commit is contained in:
parent
a7dba79664
commit
7a47e9e13d
1 changed files with 6 additions and 1 deletions
|
@ -60,8 +60,13 @@ class Module(core.module.Module):
|
|||
current_default_route = None
|
||||
default_route = None
|
||||
while threading.main_thread().is_alive():
|
||||
try:
|
||||
current_default_route = netifaces.gateways()["default"][2]
|
||||
except:
|
||||
# error reading out default gw -> assume none exists
|
||||
current_default_route = None
|
||||
if current_default_route != default_route:
|
||||
default_route = current_default_route
|
||||
self.update()
|
||||
time.sleep(1)
|
||||
|
||||
|
|
Loading…
Reference in a new issue