mirror of
https://github.com/markqvist/LXMF.git
synced 2025-11-19 23:13:04 -05:00
Allow configuring max remote peering cost
This commit is contained in:
parent
4350a239e4
commit
401328fa16
3 changed files with 7 additions and 6 deletions
|
|
@ -173,7 +173,7 @@ def pn_announce_data_is_valid(data):
|
|||
try:
|
||||
if type(data) != bytes: return False
|
||||
else: data = msgpack.unpackb(data)
|
||||
if len(data) < 7: raise ValueError("Invalid announce data: Insufficient peer data")
|
||||
if len(data) < 7: raise ValueError("Invalid announce data: Insufficient peer data, likely from deprecated LXMF version")
|
||||
else:
|
||||
try: int(data[1])
|
||||
except: raise ValueError("Invalid announce data: Could not decode timebase")
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class LXMRouter:
|
|||
enforce_ratchets=False, enforce_stamps=False, static_peers = [], max_peers=None,
|
||||
from_static_only=False, sync_strategy=LXMPeer.STRATEGY_PERSISTENT,
|
||||
propagation_cost=PROPAGATION_COST, propagation_cost_flexibility=PROPAGATION_COST_FLEX,
|
||||
peering_cost=PEERING_COST, name=None):
|
||||
peering_cost=PEERING_COST, max_peering_cost=MAX_PEERING_COST, name=None):
|
||||
|
||||
random.seed(os.urandom(10))
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ class LXMRouter:
|
|||
self.propagation_stamp_cost = propagation_cost
|
||||
self.propagation_stamp_cost_flexibility = propagation_cost_flexibility
|
||||
self.peering_cost = peering_cost
|
||||
self.max_peering_cost = LXMRouter.MAX_PEERING_COST
|
||||
self.max_peering_cost = max_peering_cost
|
||||
self.enforce_ratchets = enforce_ratchets
|
||||
self._enforce_stamps = enforce_stamps
|
||||
self.pending_deferred_stamps = {}
|
||||
|
|
@ -2420,7 +2420,6 @@ class LXMRouter:
|
|||
|
||||
else:
|
||||
propagation_stamp = selected_lxm.get_propagation_stamp(target_cost=pn_target_cost)
|
||||
RNS.log(f"Generated propagation stamp: {RNS.hexrep(propagation_stamp)}")
|
||||
if propagation_stamp:
|
||||
selected_lxm.propagation_stamp = propagation_stamp
|
||||
selected_lxm.defer_propagation_stamp = False
|
||||
|
|
|
|||
|
|
@ -377,6 +377,8 @@ def program_setup(configdir = None, rnsconfigdir = None, run_pn = False, on_inbo
|
|||
propagation_limit = active_configuration["propagation_transfer_max_accepted_size"],
|
||||
propagation_cost = active_configuration["propagation_stamp_cost_target"],
|
||||
propagation_cost_flexibility = active_configuration["propagation_stamp_cost_flexibility"],
|
||||
peering_cost = active_configuration["peering_cost"],
|
||||
max_peering_cost = active_configuration["remote_peering_cost_max"],
|
||||
sync_limit = active_configuration["propagation_sync_max_accepted_size"],
|
||||
delivery_limit = active_configuration["delivery_transfer_max_accepted_size"],
|
||||
max_peers = active_configuration["max_peers"],
|
||||
|
|
@ -1009,7 +1011,7 @@ autopeer_maxdepth = 4
|
|||
# value required for a remote node to peer with
|
||||
# and deliver messages to this node.
|
||||
|
||||
# peering_cost = 10
|
||||
# peering_cost = 18
|
||||
|
||||
# You can configure the maximum peering cost
|
||||
# of remote nodes that this node will peer with.
|
||||
|
|
@ -1019,7 +1021,7 @@ autopeer_maxdepth = 4
|
|||
# more computation time during initial peering
|
||||
# when generating the peering key.
|
||||
|
||||
# remote_peering_cost_max = 12
|
||||
# remote_peering_cost_max = 24
|
||||
|
||||
# You can tell the LXMF message router to
|
||||
# prioritise storage for one or more
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue