From ef1c3331adaabf23fa3e4cdf552f9d0ee06b23d7 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Tue, 17 Sep 2024 13:29:36 +0200 Subject: [PATCH] Improved outbound handling --- LXMF/LXMRouter.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/LXMF/LXMRouter.py b/LXMF/LXMRouter.py index 6aafce3..34cfbc8 100644 --- a/LXMF/LXMRouter.py +++ b/LXMF/LXMRouter.py @@ -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() @@ -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 @@ -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)