mirror of
https://github.com/markqvist/Sideband.git
synced 2024-12-27 00:19:25 -05:00
Improved autointerface rediscovery
This commit is contained in:
parent
f7516693bd
commit
74ed2dced7
@ -2382,11 +2382,25 @@ class SidebandCore():
|
|||||||
time.sleep(SidebandCore.SERVICE_JOB_INTERVAL)
|
time.sleep(SidebandCore.SERVICE_JOB_INTERVAL)
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
|
||||||
if self.interface_local.carrier_changed:
|
if hasattr(self, "interface_local"):
|
||||||
RNS.log("AutoInterface carrier change detected, retaking wake locks", RNS.LOG_DEBUG)
|
if self.interface_local != None:
|
||||||
self.owner_service.take_locks(force_multicast=True)
|
if self.interface_local.carrier_changed:
|
||||||
self.interface_local.carrier_changed = False
|
RNS.log("AutoInterface carrier change detected, retaking wake locks", RNS.LOG_DEBUG)
|
||||||
last_multicast_lock_check = now
|
self.owner_service.take_locks(force_multicast=True)
|
||||||
|
self.interface_local.carrier_changed = False
|
||||||
|
last_multicast_lock_check = now
|
||||||
|
|
||||||
|
if (self.interface_local != None and len(self.interface_local.adopted_interfaces) == 0) or (self.config["connect_local"] and self.interface_local == None):
|
||||||
|
if not self.interface_local_adding:
|
||||||
|
RNS.log("No suitable interfaces on AutoInterface, scheduling re-init", RNS.LOG_DEBUG)
|
||||||
|
if self.interface_local in RNS.Transport.interfaces:
|
||||||
|
RNS.Transport.interfaces.remove(self.interface_local)
|
||||||
|
del self.interface_local
|
||||||
|
self.interface_local = None
|
||||||
|
self.interface_local_adding = True
|
||||||
|
def job():
|
||||||
|
self.__add_localinterface(delay=60)
|
||||||
|
threading.Thread(target=job, daemon=True).start()
|
||||||
|
|
||||||
if (now - last_multicast_lock_check > 120):
|
if (now - last_multicast_lock_check > 120):
|
||||||
RNS.log("Checking multicast and wake locks", RNS.LOG_DEBUG)
|
RNS.log("Checking multicast and wake locks", RNS.LOG_DEBUG)
|
||||||
@ -2418,19 +2432,6 @@ class SidebandCore():
|
|||||||
|
|
||||||
self.interface_local.had_peers = have_peers
|
self.interface_local.had_peers = have_peers
|
||||||
|
|
||||||
if len(self.interface_local.adopted_interfaces) == 0:
|
|
||||||
if not self.interface_local_adding:
|
|
||||||
RNS.log("No suitable interfaces on AutoInterface, scheduling re-init", RNS.LOG_DEBUG)
|
|
||||||
if self.interface_local in RNS.Transport.interfaces:
|
|
||||||
RNS.Transport.interfaces.remove(self.interface_local)
|
|
||||||
del self.interface_local
|
|
||||||
self.interface_local = None
|
|
||||||
def job():
|
|
||||||
self.__add_localinterface(delay=60)
|
|
||||||
threading.Thread(target=job, daemon=True).start()
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
|
||||||
for interface in RNS.Transport.interfaces:
|
for interface in RNS.Transport.interfaces:
|
||||||
if not hasattr(self, "interface_local") or interface != self.interface_local:
|
if not hasattr(self, "interface_local") or interface != self.interface_local:
|
||||||
if hasattr(interface, "was_online"):
|
if hasattr(interface, "was_online"):
|
||||||
|
Loading…
Reference in New Issue
Block a user