mirror of
https://github.com/markqvist/LXMF.git
synced 2024-10-01 01:35:36 -04:00
Added transfer limit handling to announce handler
This commit is contained in:
parent
bb1b9e4163
commit
c7489dc0fa
@ -34,11 +34,17 @@ class LXMFPropagationAnnounceHandler:
|
|||||||
data = msgpack.unpackb(app_data)
|
data = msgpack.unpackb(app_data)
|
||||||
|
|
||||||
if self.lxmrouter.propagation_node and self.lxmrouter.autopeer:
|
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 data[0] == True:
|
||||||
if RNS.Transport.hops_to(destination_hash) <= self.lxmrouter.autopeer_maxdepth:
|
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:
|
elif data[0] == False:
|
||||||
self.lxmrouter.unpeer(destination_hash, data[1])
|
self.lxmrouter.unpeer(destination_hash, node_timebase)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Error while evaluating propagation node announce, ignoring announce.", RNS.LOG_DEBUG)
|
RNS.log("Error while evaluating propagation node announce, ignoring announce.", RNS.LOG_DEBUG)
|
||||||
|
Loading…
Reference in New Issue
Block a user