Made PN peer throttle time configurable

This commit is contained in:
Mark Qvist committed 2026-11-02 21:05:20 +01:00
1 parent 8ded002689
commit 40dcd7d084
2 files changed
+26 -4

No files matched your search

+6 -4
View File
@@ -69,7 +69,7 @@ class LXMRouter:
DELIVERY_LIMIT = 1000
PR_PATH_TIMEOUT = 10
PN_STAMP_THROTTLE = 180
PN_STAMP_THROTTLE = 300
PR_IDLE = 0x00
PR_PATH_REQUESTED = 0x01
@@ -110,7 +110,8 @@ class LXMRouter:
from_static_only=False, sync_strategy=LXMPeer.STRATEGY_PERSISTENT,
propagation_cost=PROPAGATION_COST, propagation_cost_flexibility=PROPAGATION_COST_FLEX,
peering_cost=PEERING_COST, max_peering_cost=MAX_PEERING_COST, max_inbound_syncs=MAX_INBOUND_SYNCS,
sequential_validation=SEQUENTIAL_VALIDATION, static_sequential=STATIC_SEQUENTIAL):
sequential_validation=SEQUENTIAL_VALIDATION, static_sequential=STATIC_SEQUENTIAL,
pn_stamp_throttle=PN_STAMP_THROTTLE):
random.seed(os.urandom(10))
@@ -136,7 +137,8 @@ class LXMRouter:
self.name = name
self.propagation_node = False
self.propagation_node_start_time = None
self.propagation_node_start_time = None
self.pn_stamp_throttle = pn_stamp_throttle
if storagepath == None: raise ValueError("LXMF cannot be initialised without a storage path")
else:
@@ -2586,7 +2588,7 @@ class LXMRouter:
if invalid_message_count > 0:
resource.link.teardown()
if remote_identity != None:
throttle_time = LXMRouter.PN_STAMP_THROTTLE
throttle_time = self.pn_stamp_throttle
self.throttled_peers[remote_hash] = time.time()+throttle_time
ms = "" if invalid_message_count == 1 else "s"
RNS.log(f"Propagation transfer from {remote_str} contained {invalid_message_count} message{ms} with invalid stamps, throttled for {RNS.prettytime(throttle_time)}", RNS.LOG_NOTICE)
+20
View File
@@ -197,6 +197,13 @@ def apply_config():
else:
active_configuration["propagation_stamp_cost_flexibility"] = LXMF.LXMRouter.PROPAGATION_COST_FLEX
if "propagation" in lxmd_config and "propagation_stamp_throttle" in lxmd_config["propagation"]:
active_configuration["propagation_stamp_throttle"] = lxmd_config["propagation"].as_float("propagation_stamp_throttle")*60
if active_configuration["propagation_stamp_throttle"] < LXMF.LXMRouter.PN_STAMP_THROTTLE:
active_configuration["propagation_stamp_throttle"] = LXMF.LXMRouter.PN_STAMP_THROTTLE
else:
active_configuration["propagation_stamp_throttle"] = LXMF.LXMRouter.PN_STAMP_THROTTLE
if "propagation" in lxmd_config and "peering_cost" in lxmd_config["propagation"]:
active_configuration["peering_cost"] = lxmd_config["propagation"].as_float("peering_cost")
if active_configuration["peering_cost"] < 0:
@@ -412,6 +419,7 @@ def program_setup(configdir = None, rnsconfigdir = None, run_pn = False, on_inbo
max_peers = active_configuration["max_peers"],
static_peers = active_configuration["static_peers"],
from_static_only = active_configuration["from_static_only"],
pn_stamp_throttle = active_configuration["propagation_stamp_throttle"],
name = active_configuration["node_name"])
message_router.register_delivery_callback(lxmf_delivery)
@@ -1038,6 +1046,18 @@ autopeer_maxdepth = 6
# propagation_stamp_cost_flexibility = 3.0
# If a peer delivers messages with stamp costs
# not conforming to this node's targets, it'll
# be throttled, by default for 5 minutes. You
# can configure the throttle period, and for
# constrained nodes, it may be a good idea to
# set a much higher throttle time. Real LXMF
# propagation nodes will never deliver messages
# with lower stamp values than required by the
# receiving node.
# propagation_stamp_throttle = 5
# The peering_cost option configures the target
# value required for a remote node to peer with
# and deliver messages to this node.