Skip to content

Commit 3fedd0a

Browse files
committed
Added separate LXMF PN message size and sync transfer size limits
1 parent 34e0bde commit 3fedd0a

File tree

4 files changed

+31
-14
lines changed

4 files changed

+31
-14
lines changed

nomadnet/Directory.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ def pn_announce_received(self, source_hash, app_data, associated_peer, associate
193193
found_node = True
194194
break
195195

196-
if not found_node:
196+
# TODO: Remove debug and rethink this (needs way to set PN when node is saved)
197+
if True or not found_node:
197198
if self.app.compact_stream:
198199
try:
199200
remove_announces = []

nomadnet/NomadNetworkApp.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def __init__(self, configdir = None, rnsconfigdir = None, daemon = False, force_
128128
self.notify_on_new_message = True
129129

130130
self.lxmf_max_propagation_size = None
131+
self.lxmf_max_sync_size = None
131132
self.lxmf_max_incoming_size = None
132133

133134
self.periodic_lxmf_sync = True
@@ -302,7 +303,7 @@ def __init__(self, configdir = None, rnsconfigdir = None, daemon = False, force_
302303

303304
self.message_router = LXMF.LXMRouter(
304305
identity = self.identity, storagepath = self.storagepath, autopeer = True,
305-
propagation_limit = self.lxmf_max_propagation_size, delivery_limit = self.lxmf_max_incoming_size,
306+
propagation_limit = self.lxmf_max_propagation_size, sync_limit = self.lxmf_max_sync_size, delivery_limit = self.lxmf_max_incoming_size,
306307
max_peers = self.max_peers, static_peers = static_peers,
307308
)
308309

@@ -888,6 +889,14 @@ def applyConfig(self):
888889
value = 1
889890
self.lxmf_max_propagation_size = value
890891

892+
if not "max_sync_size" in self.config["node"]:
893+
self.lxmf_max_sync_size = 256*40
894+
else:
895+
value = self.config["node"].as_float("max_sync_size")
896+
if value < self.lxmf_max_propagation_size:
897+
value = self.lxmf_max_propagation_size
898+
self.lxmf_max_sync_size = value
899+
891900
if not "announce_at_start" in self.config["node"]:
892901
self.node_announce_at_start = False
893902
else:
@@ -1182,16 +1191,20 @@ def quit(self):
11821191
# message_storage_limit = 2000
11831192
11841193
# The maximum accepted transfer size per in-
1185-
# coming propagation transfer, in kilobytes.
1186-
# This also sets the upper limit for the size
1187-
# of single messages accepted onto this node.
1194+
# coming propagation message, in kilobytes.
1195+
# This sets the upper limit for the size of
1196+
# single messages accepted onto this node.
1197+
max_transfer_size = 256
1198+
1199+
# The maximum accepted transfer size per in-
1200+
# coming propagation node sync.
11881201
#
11891202
# If a node wants to propagate a larger number
11901203
# of messages to this node, than what can fit
11911204
# within this limit, it will prioritise sending
1192-
# the smallest, newest messages first, and try
1205+
# the smallest messages first, and try again
11931206
# with any remaining messages at a later point.
1194-
max_transfer_size = 256
1207+
max_sync_size = 10240
11951208
11961209
# You can tell the LXMF message router to
11971210
# prioritise storage for one or more

nomadnet/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.8.0"
1+
__version__ = "0.8.1"

nomadnet/ui/textui/Network.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,15 +1843,18 @@ def __init__(self, app, peer, delegate, trust_level):
18431843
style = "list_unresponsive"
18441844
focus_style = "list_focus_unresponsive"
18451845

1846-
if peer.propagation_transfer_limit:
1847-
txfer_limit = RNS.prettysize(peer.propagation_transfer_limit*1000)
1848-
else:
1849-
txfer_limit = "No"
1846+
if peer.propagation_transfer_limit: txfer_limit = RNS.prettysize(peer.propagation_transfer_limit*1000)
1847+
else: txfer_limit = "No"
1848+
1849+
if peer.propagation_sync_limit: sync_limit = RNS.prettysize(peer.propagation_sync_limit*1000)
1850+
else: sync_limit = "Unknown"
1851+
18501852
ar = round(peer.acceptance_rate*100, 2)
18511853
peer_info_str = sym+" "+display_str+"\n "+alive_string+", last heard "+pretty_date(int(peer.last_heard))
1852-
peer_info_str += "\n "+str(peer.unhandled_message_count)+f" unhandled LXMs, {txfer_limit} sync limit\n"
1854+
peer_info_str += f"\n {sync_limit} sync limit, {txfer_limit} msg limit\n"
18531855
peer_info_str += f" {RNS.prettyspeed(peer.sync_transfer_rate)} STR, "
1854-
peer_info_str += f"{RNS.prettyspeed(peer.link_establishment_rate)} LER, {ar}% AR\n"
1856+
peer_info_str += f"{RNS.prettyspeed(peer.link_establishment_rate)} LER"
1857+
peer_info_str += "\n "+str(peer.unhandled_message_count)+f" unhandled LXMs, {ar}% AR"
18551858
widget = ListEntry(peer_info_str)
18561859
self.display_widget = urwid.AttrMap(widget, style, focus_style)
18571860
self.display_widget.destination_hash = destination_hash

0 commit comments

Comments
 (0)