Added transfer limit handling to announce handler

This commit is contained in:
Mark Qvist 2024-03-01 22:33:53 +01:00
parent bb1b9e4163
commit c7489dc0fa

View File

@ -34,11 +34,17 @@ class LXMFPropagationAnnounceHandler:
data = msgpack.unpackb(app_data)
if self.lxmrouter.propagation_node and self.lxmrouter.autopeer:
node_timebase = data[1]
propagation_transfer_limit = None
if len(data) >= 3:
propagation_transfer_limit = data[2]
if data[0] == True:
if RNS.Transport.hops_to(destination_hash) <= self.lxmrouter.autopeer_maxdepth:
self.lxmrouter.peer(destination_hash, data[1])
self.lxmrouter.peer(destination_hash, node_timebase, propagation_transfer_limit)
elif data[0] == False:
self.lxmrouter.unpeer(destination_hash, data[1])
self.lxmrouter.unpeer(destination_hash, node_timebase)
except Exception as e:
RNS.log("Error while evaluating propagation node announce, ignoring announce.", RNS.LOG_DEBUG)