Skip to content

Commit 6241437

Browse files
committed
Serialize LXMF sends per destination
1 parent 5385325 commit 6241437

2 files changed

Lines changed: 36 additions & 15 deletions

File tree

crates/reticulum_mobile/Cargo.lock

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/reticulum_mobile/src/runtime.rs

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7020,6 +7020,10 @@ fn is_sos_status_metadata(metadata: Option<&MissionSyncMetadata>) -> bool {
70207020
})
70217021
}
70227022

7023+
fn should_serialize_lxmf_destination_send(is_accepted_result: bool, is_sos_status: bool) -> bool {
7024+
!is_accepted_result && !is_sos_status
7025+
}
7026+
70237027
#[expect(
70247028
clippy::too_many_arguments,
70257029
reason = "send policy boundary intentionally keeps transport, payload, metadata, and lane selection explicit"
@@ -7098,21 +7102,17 @@ async fn send_lxmf_with_delivery_policy(
70987102
direct_delivery_ready,
70997103
direct_priority_hops,
71007104
);
7101-
let _destination_send_lock = if !is_accepted_result
7102-
&& !is_sos_status
7103-
&& metadata
7104-
.as_ref()
7105-
.is_some_and(MissionSyncMetadata::is_mission_related)
7106-
{
7107-
Some(
7108-
state
7109-
.mission_destination_locks
7110-
.acquire(canonical_requested_destination.as_str())
7111-
.await?,
7112-
)
7113-
} else {
7114-
None
7115-
};
7105+
let _destination_send_lock =
7106+
if should_serialize_lxmf_destination_send(is_accepted_result, is_sos_status) {
7107+
Some(
7108+
state
7109+
.mission_destination_locks
7110+
.acquire(canonical_requested_destination.as_str())
7111+
.await?,
7112+
)
7113+
} else {
7114+
None
7115+
};
71167116
let prefer_propagation = matches!(send_mode, SendMode::Auto {})
71177117
&& !is_accepted_result
71187118
&& has_active_relay
@@ -10617,6 +10617,14 @@ mod tests {
1061710617
assert!(!is_accepted_result_metadata(Some(&command)));
1061810618
}
1061910619

10620+
#[test]
10621+
fn destination_send_serialization_applies_to_data_but_not_fast_lanes() {
10622+
assert!(should_serialize_lxmf_destination_send(false, false));
10623+
assert!(!should_serialize_lxmf_destination_send(true, false));
10624+
assert!(!should_serialize_lxmf_destination_send(false, true));
10625+
assert!(!should_serialize_lxmf_destination_send(true, true));
10626+
}
10627+
1062010628
fn test_lxmf_report(
1062110629
metadata: MissionSyncMetadata,
1062210630
track_delivery_timeout: bool,

0 commit comments

Comments
 (0)