Skip to content

Commit

Permalink
Overhead calculation for propagation transfer limits
Browse files Browse the repository at this point in the history
  • Loading branch information
markqvist committed Mar 1, 2024
1 parent 7ecd3c0 commit 2249300
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions LXMF/LXMPeer.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,16 @@ def sync(self):
self.unhandled_messages.pop(transient_id)

unhandled_entries.sort(key=lambda e: e[1], reverse=False)
cumulative_size = 0
per_message_overhead = 16 # Really only 2 bytes, but set a bit higher for now
cumulative_size = 24 # Initialised to highest reasonable binary structure overhead
for unhandled_entry in unhandled_entries:
transient_id = unhandled_entry[0]
weight = unhandled_entry[1]
lxm_size = unhandled_entry[2]
if self.propagation_transfer_limit != None and cumulative_size + lxm_size > (self.propagation_transfer_limit*1000):
pass
else:
cumulative_size += lxm_size
cumulative_size += (lxm_size+per_message_overhead)
unhandled_ids.append(transient_id)

RNS.log("Sending sync request to peer "+str(self.destination), RNS.LOG_DEBUG)
Expand Down

0 comments on commit 2249300

Please sign in to comment.