Skip to content

Commit

Permalink
Improved outbound handling
Browse files Browse the repository at this point in the history
  • Loading branch information
markqvist committed Sep 17, 2024
1 parent e1a56be commit ef1c333
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions LXMF/LXMRouter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,7 @@ def handle_outbound(self, lxmessage):
if not RNS.Transport.has_path(destination_hash) and lxmessage.method == LXMessage.OPPORTUNISTIC:
RNS.log(f"Pre-emptively requesting unknown path for opportunistic {lxmessage}", RNS.LOG_DEBUG)
RNS.Transport.request_path(destination_hash)
lxmessage.next_delivery_attempt = time.time() + LXMRouter.PATH_REQUEST_WAIT
unknown_path_requested = True

lxmessage.determine_transport_encryption()
Expand All @@ -1245,11 +1246,13 @@ def handle_outbound(self, lxmessage):
lxmessage.defer_stamp = False

if not lxmessage.defer_stamp:
while not unknown_path_requested and self.processing_outbound:
time.sleep(0.05)

self.pending_outbound.append(lxmessage)
if not unknown_path_requested:
while self.processing_outbound:
time.sleep(0.05)
self.process_outbound()

else:
self.pending_deferred_stamps[lxmessage.message_id] = lxmessage

Expand Down Expand Up @@ -1786,6 +1789,7 @@ def process_outbound(self, sender = None):
elif lxmessage.method == LXMessage.PROPAGATED and lxmessage.state == LXMessage.SENT:
RNS.log("Propagation has occurred for "+str(lxmessage)+", removing from outbound queue", RNS.LOG_DEBUG)
self.pending_outbound.remove(lxmessage)

else:
RNS.log("Starting outbound processing for "+str(lxmessage)+" to "+RNS.prettyhexrep(lxmessage.get_destination().hash), RNS.LOG_DEBUG)

Expand Down

0 comments on commit ef1c333

Please sign in to comment.