mirror of
https://github.com/markqvist/LXMF.git
synced 2024-10-01 01:35:36 -04:00
Added peering settings to lxmd
This commit is contained in:
parent
1c4928a29b
commit
2d81b47b6a
@ -976,7 +976,8 @@ class LXMRouter:
|
||||
remote_hash = remote_destination.hash
|
||||
|
||||
if not remote_hash in self.peers:
|
||||
self.peer(remote_hash, remote_timebase)
|
||||
if self.autopeer and RNS.Transport.hops_to(remote_hash) <= self.autopeer_maxdepth:
|
||||
self.peer(remote_hash, remote_timebase)
|
||||
|
||||
messages = data[1]
|
||||
for lxmf_data in messages:
|
||||
|
@ -94,6 +94,16 @@ def apply_config():
|
||||
else:
|
||||
active_configuration["node_announce_at_start"] = False
|
||||
|
||||
if "propagation" in lxmd_config and "autopeer" in lxmd_config["propagation"]:
|
||||
active_configuration["autopeer"] = lxmd_config["propagation"].as_bool("autopeer")
|
||||
else:
|
||||
active_configuration["autopeer"] = True
|
||||
|
||||
if "propagation" in lxmd_config and "autopeer_maxdepth" in lxmd_config["propagation"]:
|
||||
active_configuration["autopeer_maxdepth"] = lxmd_config["propagation"].as_int("autopeer_maxdepth")
|
||||
else:
|
||||
active_configuration["autopeer_maxdepth"] = None
|
||||
|
||||
if "propagation" in lxmd_config and "announce_interval" in lxmd_config["propagation"]:
|
||||
active_configuration["node_announce_interval"] = lxmd_config["propagation"].as_int("announce_interval")*60
|
||||
else:
|
||||
@ -241,7 +251,12 @@ def program_setup(configdir = None, rnsconfigdir = None, run_pn = False, on_inbo
|
||||
exit(2)
|
||||
|
||||
# Start LXMF
|
||||
message_router = LXMF.LXMRouter(identity = identity, storagepath = storagedir, autopeer = True)
|
||||
message_router = LXMF.LXMRouter(
|
||||
identity = identity,
|
||||
storagepath = storagedir,
|
||||
autopeer = active_configuration["autopeer"],
|
||||
autopeer_maxdepth = active_configuration["autopeer_maxdepth"],
|
||||
)
|
||||
message_router.register_delivery_callback(lxmf_delivery)
|
||||
|
||||
for destination_hash in active_configuration["ignored_lxmf_destinations"]:
|
||||
@ -371,6 +386,10 @@ announce_at_start = yes
|
||||
# propagation nodes on the network.
|
||||
autopeer = yes
|
||||
|
||||
# The maximum peering depth (in hops) for
|
||||
# automatically peered nodes.
|
||||
autopeer_maxdepth = 4
|
||||
|
||||
# The maximum amount of storage to use for
|
||||
# the LXMF Propagation Node message store,
|
||||
# specified in megabytes. When this limit
|
||||
|
Loading…
Reference in New Issue
Block a user