Fix duplicate interfaces on reconnect and beacon message spam bugs

This commit is contained in:
jacob.eva 2024-06-08 10:31:43 +01:00
parent ab4fcca81c
commit 488e617094
No known key found for this signature in database
GPG Key ID: 0B92E083BBCCAA1E

View File

@ -815,11 +815,15 @@ class RNodeMultiInterface(Interface):
if self.id_interval != None and self.id_callsign != None: if self.id_interval != None and self.id_callsign != None:
if self.first_tx != None: if self.first_tx != None:
if time.time() > self.first_tx + self.id_interval: if time.time() > self.first_tx + self.id_interval:
RNS.log("Interface "+str(self)+" is transmitting beacon data on all subinterfaces: "+str(self.id_callsign.decode("utf-8")), RNS.LOG_DEBUG) interface_available = False
for interface in self.subinterfaces: for interface in self.subinterfaces:
if interface != 0: if interface != 0 and interface.online:
interface_available = True
self.subinterfaces[interface.index].processOutgoing(self.id_callsign) self.subinterfaces[interface.index].processOutgoing(self.id_callsign)
if interface_available:
RNS.log("Interface "+str(self)+" is transmitting beacon data on all subinterfaces: "+str(self.id_callsign.decode("utf-8")), RNS.LOG_DEBUG)
sleep(0.08) sleep(0.08)
except Exception as e: except Exception as e:
@ -832,6 +836,8 @@ class RNodeMultiInterface(Interface):
RNS.log("Reticulum will attempt to reconnect the interface periodically.", RNS.LOG_ERROR) RNS.log("Reticulum will attempt to reconnect the interface periodically.", RNS.LOG_ERROR)
self.teardown_subinterfaces()
self.online = False self.online = False
try: try:
self.serial.close() self.serial.close()
@ -866,6 +872,14 @@ class RNodeMultiInterface(Interface):
self.setRadioState(KISS.RADIO_STATE_OFF, interface) self.setRadioState(KISS.RADIO_STATE_OFF, interface)
self.leave() self.leave()
def teardown_subinterfaces(self):
for interface in self.subinterfaces:
if interface != 0:
if interface in RNS.Transport.interfaces:
RNS.Transport.interfaces.remove(interface)
self.subinterfaces[interface.index] = 0
del interface
def should_ingress_limit(self): def should_ingress_limit(self):
return False return False