From 69ab9105909c507d0aa86b6ab336f0286b7c7449 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Mon, 16 Sep 2024 20:25:32 +0200 Subject: [PATCH] Send commands opportunistically if ratchets are available --- sbapp/sideband/core.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index fd83777..bbea819 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -4147,7 +4147,11 @@ class SidebandCore(): if propagation: desired_method = LXMF.LXMessage.PROPAGATED else: - desired_method = LXMF.LXMessage.DIRECT + if not self.message_router.delivery_link_available(destination_hash) and RNS.Identity.current_ratchet_id(destination_hash) != None: + RNS.log(f"Have ratchet for {RNS.prettyhexrep(destination_hash)}, requesting opportunistic delivery of command", RNS.LOG_DEBUG) + desired_method = LXMF.LXMessage.OPPORTUNISTIC + else: + desired_method = LXMF.LXMessage.DIRECT lxm = LXMF.LXMessage(dest, source, "", title="", desired_method=desired_method, fields = {LXMF.FIELD_COMMANDS: commands}, include_ticket=self.is_trusted(destination_hash)) lxm.register_delivery_callback(self.message_notification)