mirror of
https://github.com/ratspeak/rsLXMF
synced 2026-11-27 23:00:32 +00:00
Compare commits
22
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df3a500c4f | ||
|
|
8a22f7e951 | ||
|
|
98aa927e1d | ||
|
|
7caacbb382 | ||
|
|
f959b200d8 | ||
|
|
49a1f2a182 | ||
|
|
a48ee9c6a3 | ||
|
|
4a0abec3b4 | ||
|
|
534abbb95b | ||
|
|
86d5e10230 | ||
|
|
09948bf81c | ||
|
|
7a851cc204 | ||
|
|
85e725a064 | ||
|
|
0a34047342 | ||
|
|
bb628ba8ef | ||
|
|
fd69ab4fbc | ||
|
|
8db95825c5 | ||
|
|
7cf129f76c | ||
|
|
d7da7f34aa | ||
|
|
e609864d88 | ||
|
|
e210e0c244 | ||
|
|
fc1c99d3ff |
No files matched your search
@@ -10,7 +10,7 @@ permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
RSLXMF_RSRETICULUM_COMMIT: a1639cc065a9f1744562b95818a583e20a609b11
|
||||
RSLXMF_RSRETICULUM_COMMIT: d4183434fcb969799c208ddcf140bae7550c14fe
|
||||
|
||||
jobs:
|
||||
api-compat:
|
||||
|
||||
@@ -17,8 +17,8 @@ env:
|
||||
RELEASE_TAG: ${{ github.event.inputs.tag_name || github.ref_name }}
|
||||
PACKAGE_ROOT: rsLXMF
|
||||
LXMF_BINS: lxmd-rs
|
||||
RSLXMF_RSRETICULUM_VERSION: 1.2.0
|
||||
RSLXMF_RSRETICULUM_COMMIT: a1639cc065a9f1744562b95818a583e20a609b11
|
||||
RSLXMF_RSRETICULUM_VERSION: 1.3.0
|
||||
RSLXMF_RSRETICULUM_COMMIT: d4183434fcb969799c208ddcf140bae7550c14fe
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
|
||||
@@ -2,6 +2,23 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
|
||||
- Added delivery readiness hooks so applications can react promptly to incoming Link traffic and local send completion.
|
||||
- Added support for updating pending Direct-message compression as peer capabilities become known.
|
||||
|
||||
### Fixed and improved
|
||||
|
||||
- Kept active attachment transfers alive while data is moving and reduced delays between delivery steps.
|
||||
- Corrected progress reporting for transfers split across multiple Resources by weighting each part by its payload size.
|
||||
- Fixed intermittent propagation-node sync and unpeer failures caused by incorrectly encoded peer addresses.
|
||||
|
||||
### Build and compatibility
|
||||
|
||||
- Restricted rsReticulum compatibility to the 1.3 patch line so a later breaking minor release requires an explicit update.
|
||||
- Updated the Python interoperability baseline to Reticulum 1.4.2 and LXMF 1.0.1, with separate LXMF 1.1.0 checks.
|
||||
|
||||
|
||||
## 1.2.0 - 2026-08-17
|
||||
|
||||
- Added the exact-reexport `lxmf_core::message_api` facade, a compiled message
|
||||
|
||||
Generated
+12
-10
@@ -717,9 +717,9 @@ checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.2.0"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
|
||||
checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
@@ -1052,7 +1052,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-crypto"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"cbc",
|
||||
@@ -1070,7 +1070,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-identity"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"rand 0.8.5",
|
||||
@@ -1088,7 +1088,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-interface"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"hex",
|
||||
@@ -1096,6 +1096,7 @@ dependencies = [
|
||||
"jni",
|
||||
"libc",
|
||||
"md-5",
|
||||
"mio",
|
||||
"objc2",
|
||||
"objc2-core-bluetooth",
|
||||
"objc2-foundation",
|
||||
@@ -1116,7 +1117,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-link"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"rand 0.8.5",
|
||||
@@ -1131,7 +1132,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-protocol"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"bzip2",
|
||||
"hex",
|
||||
@@ -1147,7 +1148,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-runtime"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"hex",
|
||||
@@ -1169,11 +1170,12 @@ dependencies = [
|
||||
"thiserror 2.0.18",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rns-transport"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"hex",
|
||||
@@ -1192,7 +1194,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-wire"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"rns-crypto",
|
||||
"sha2",
|
||||
|
||||
+8
-8
@@ -13,14 +13,14 @@ rust-version = "1.87"
|
||||
|
||||
[workspace.dependencies]
|
||||
# Reticulum crates from a sibling rsReticulum checkout during development.
|
||||
rns-crypto = { path = "../rsReticulum/crates/rns-crypto", version = "1.2.0" }
|
||||
rns-wire = { path = "../rsReticulum/crates/rns-wire", version = "1.2.0" }
|
||||
rns-identity = { path = "../rsReticulum/crates/rns-identity", version = "1.2.0" }
|
||||
rns-link = { path = "../rsReticulum/crates/rns-link", version = "1.2.0" }
|
||||
rns-protocol = { path = "../rsReticulum/crates/rns-protocol", version = "1.2.0" }
|
||||
rns-transport = { path = "../rsReticulum/crates/rns-transport", version = "1.2.0" }
|
||||
rns-runtime = { path = "../rsReticulum/crates/rns-runtime", version = "1.2.0" }
|
||||
rns-interface = { path = "../rsReticulum/crates/rns-interface", version = "1.2.0" }
|
||||
rns-crypto = { path = "../rsReticulum/crates/rns-crypto", version = "~1.3.0" }
|
||||
rns-wire = { path = "../rsReticulum/crates/rns-wire", version = "~1.3.0" }
|
||||
rns-identity = { path = "../rsReticulum/crates/rns-identity", version = "~1.3.0" }
|
||||
rns-link = { path = "../rsReticulum/crates/rns-link", version = "~1.3.0" }
|
||||
rns-protocol = { path = "../rsReticulum/crates/rns-protocol", version = "~1.3.0" }
|
||||
rns-transport = { path = "../rsReticulum/crates/rns-transport", version = "~1.3.0" }
|
||||
rns-runtime = { path = "../rsReticulum/crates/rns-runtime", version = "~1.3.0" }
|
||||
rns-interface = { path = "../rsReticulum/crates/rns-interface", version = "~1.3.0" }
|
||||
|
||||
# Workspace LXMF crates
|
||||
lxmf-core = { path = "crates/lxmf-core", version = "1.2.0" }
|
||||
|
||||
@@ -342,11 +342,11 @@ Most daemon and control flags are implemented: `--config`, `--rnsconfig`,
|
||||
Additional rsLXMF-only flags: `--send`, `--send-file`, `--send-method`,
|
||||
`--send-timeout-secs`, and `--send-fields-json`.
|
||||
|
||||
The compatibility-floor corpus is Python LXMF 1.0.1 with Reticulum 1.3.8;
|
||||
current daemon, delivery, Resource/proof, and propagation behavior is also
|
||||
checked against exact LXMF 1.1.0 and Reticulum 1.4.2 sources. Version-specific
|
||||
legacy vectors retain their original provenance instead of being silently
|
||||
rewritten to current expectations.
|
||||
The complete release-baseline corpus and live matrix use Python LXMF 1.0.1
|
||||
with Reticulum 1.4.2. A supplementary lane checks daemon, delivery,
|
||||
Resource/proof, and propagation behavior against exact LXMF 1.1.0 with the
|
||||
same Reticulum 1.4.2 source. Historical vectors retain their original
|
||||
provenance, and RNS 1.5.0 is intentionally deferred.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -25,6 +25,65 @@ delivery methods, proofs, persistence, or runtime behavior. Later reductions
|
||||
to the broader module tree require a reviewed API diff, downstream migration,
|
||||
and an explicit version decision.
|
||||
|
||||
## Delivery-owner integration
|
||||
|
||||
`LinkDeliveryManager::poll_ready` lets one embedding task wait for inbound
|
||||
delivery packets, local admission acknowledgements, endpoint lifecycle changes,
|
||||
and staged-transport capacity. On readiness, call `drain_events` and `tick`.
|
||||
Keep periodic ticks for protocol deadlines, but schedule application maintenance
|
||||
separately. Drains are bounded and may leave another ready turn. Cancelling the
|
||||
wait does not discard a packet or publish an unread endpoint binding; existing
|
||||
periodic consumers remain supported. The API is provisional delivery-owner
|
||||
integration (LXMF-02/03, RET-05/07), not a new wire protocol or success signal.
|
||||
|
||||
`LinkDeliveryManager::set_link_endpoint_dispatch_handle` opts Direct packet
|
||||
sends into the Reticulum owner's exact local-admission receipts. Supply the
|
||||
handle from the same runtime that owns the manager's transport channel.
|
||||
Local FIFO residence and the subsequent measured-RTT proof wait are different
|
||||
phases; neither is a recipient delivery confirmation.
|
||||
|
||||
Applications using responder-owned backchannels should forward the ordered
|
||||
`LinkManagerAccountingEvent` packet and Resource wait observations through
|
||||
`observe_backchannel_packet_wait` and `observe_backchannel_resource_wait`,
|
||||
retaining the exact packet/resource identity and original timestamps.
|
||||
Forward the optional exact packet-cancellation capability with its original
|
||||
wait observation as well. A separate application owner can then cancel a
|
||||
packet still awaiting local admission without closing the shared Link. This
|
||||
cannot retract driver-admitted bytes. When a command receipt cannot be
|
||||
published to its message owner, retain its exact identity for bounded cleanup;
|
||||
close and drain a oneshot receiver before discarding it to fence concurrent
|
||||
publication.
|
||||
Adapters implementing that close-and-drain protocol can install their sender
|
||||
with `set_cancellation_aware_backchannel_sender`, allowing cancellation before
|
||||
the command receipt arrives to notify the adapter immediately. The existing
|
||||
`set_backchannel_sender` retains legacy receipt-after-cancellation behavior.
|
||||
Each pending send captures its adapter policy; replacing a sender does not
|
||||
retroactively change cancellation semantics for older sends.
|
||||
`message_timeout_window` exposes the finite current owner window for an outer
|
||||
orphan watchdog. Externally observed Resource windows include a bounded
|
||||
180-second notification allowance measured from the original protocol deadline;
|
||||
this does not alter the Resource engine's timeout or delay explicit terminal
|
||||
events. It is not renewed by receiving the same observation or by keepalives.
|
||||
Queued messages without an active protocol owner receive no
|
||||
blanket timeout exemption. Explicit rejection and cancellation are not evidence
|
||||
of a failed route.
|
||||
|
||||
When an authenticated recipient announcement rules out compression, call
|
||||
`LinkDeliveryManager::disable_pending_direct_compression` before advancing
|
||||
ready delivery events. It updates unconstructed Direct Resources and queued
|
||||
messages, including Link setup waits. Constructed Resources and split plans
|
||||
remain immutable, and propagation envelopes keep their independent policy.
|
||||
The call only disables compression; new submissions still carry their policy.
|
||||
This additive API remains provisional delivery-owner integration.
|
||||
|
||||
Applications that reserve inbound attachment memory can opt into
|
||||
`set_inbound_resource_completion_handler`. It receives one owned completed
|
||||
payload before the ordinary conclusion callback, so an application can move
|
||||
its exact Link/Resource reservation into a queued payload and retain it through
|
||||
processing. This synchronous callback must not block. It replaces the legacy
|
||||
inbound packet-channel delivery for that Resource, without cloning the data;
|
||||
applications that do not install it keep the existing completion behavior.
|
||||
|
||||
## Compatibility checks
|
||||
|
||||
The `api/` directory contains the evidence used by CI:
|
||||
|
||||
Generated
+8
-8
@@ -319,9 +319,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.2.2"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427"
|
||||
checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
@@ -478,7 +478,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-crypto"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"cbc",
|
||||
@@ -496,7 +496,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-identity"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"rand",
|
||||
@@ -514,7 +514,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-link"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"rand",
|
||||
@@ -529,7 +529,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-protocol"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"bzip2",
|
||||
"hex",
|
||||
@@ -545,7 +545,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-transport"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"hex",
|
||||
@@ -564,7 +564,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rns-wire"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"rns-crypto",
|
||||
"sha2",
|
||||
|
||||
@@ -40,3 +40,20 @@ pub mod legacy {
|
||||
let _ = std::mem::size_of::<UnverifiedReason>();
|
||||
}
|
||||
}
|
||||
|
||||
/// Delivery coordination remains a module-qualified opt-in API.
|
||||
pub mod delivery_ownership {
|
||||
use lxmf_core::link_delivery::LinkDeliveryManager;
|
||||
|
||||
pub fn compile_surface(manager: &mut LinkDeliveryManager) {
|
||||
let _ = LinkDeliveryManager::set_link_endpoint_dispatch_handle;
|
||||
let _ = LinkDeliveryManager::set_cancellation_aware_backchannel_sender;
|
||||
let _ = LinkDeliveryManager::observe_backchannel_packet_wait;
|
||||
let _ = LinkDeliveryManager::observe_backchannel_resource_wait;
|
||||
let _ = LinkDeliveryManager::abandon_backchannel_packet;
|
||||
let _ = LinkDeliveryManager::message_timeout_window;
|
||||
manager.set_inbound_resource_completion_handler(|link_id, resource_id, data| {
|
||||
let _: ([u8; 16], [u8; 32], Vec<u8>) = (link_id, resource_id, data);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -468,10 +468,12 @@ pub lxmf_core::link_delivery::DirectLinkStartReport::link_state: rns_link::link:
|
||||
pub lxmf_core::link_delivery::DirectLinkStartReport::queued_deliveries: usize
|
||||
pub struct lxmf_core::link_delivery::LinkDeliveryManager
|
||||
impl lxmf_core::link_delivery::LinkDeliveryManager
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::abandon_backchannel_packet(&mut self, [u8; 16], [u8; 32]) -> bool
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::backchannel_link_snapshot(&self, [u8; 16]) -> core::option::Option<lxmf_core::link_delivery::BackchannelLinkSnapshot>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::cancel_delivery_by_message_hash(&mut self, [u8; 32]) -> bool
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::delivery_link_available(&self, &[u8; 16]) -> bool
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::direct_link_snapshot(&self, [u8; 16]) -> core::option::Option<lxmf_core::link_delivery::DirectLinkSnapshot>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::disable_pending_direct_compression(&mut self, [u8; 16])
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::drain_events(&mut self, &std::collections::hash::map::HashMap<alloc::string::String, [u8; 64]>)
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::fail_backchannel_link(&mut self, [u8; 16], &str) -> alloc::vec::Vec<lxmf_core::link_delivery::DeliveryResult>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::fail_delivery_by_message_hash(&mut self, [u8; 32], &str) -> alloc::vec::Vec<lxmf_core::link_delivery::DeliveryResult>
|
||||
@@ -485,16 +487,23 @@ pub fn lxmf_core::link_delivery::LinkDeliveryManager::handle_request(&mut self,
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::handle_resource_proof(&mut self, &[u8; 16], &[u8]) -> bool
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::handle_resource_reject(&mut self, &[u8; 16], &[u8]) -> bool
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::message_delivery_snapshot(&self, [u8; 32]) -> core::option::Option<lxmf_core::link_delivery::MessageDeliverySnapshot>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::message_timeout_window(&self, [u8; 32]) -> core::option::Option<(std::time::Instant, core::time::Duration)>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::new(tokio::sync::mpsc::bounded::Sender<rns_transport::messages::TransportMessage>, core::option::Option<[u8; 64]>, core::option::Option<rns_crypto::ed25519::Ed25519PrivateKey>) -> Self
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::observe_backchannel_packet_wait(&mut self, [u8; 16], [u8; 32], std::time::Instant, core::time::Duration, bool, core::option::Option<rns_transport::link_endpoint_dispatch::LinkEndpointDispatchCancellation>) -> bool
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::observe_backchannel_resource_wait(&mut self, [u8; 16], [u8; 32], std::time::Instant, core::time::Duration) -> bool
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::pending_count(&self) -> usize
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::poll_ready(&mut self, &mut core::task::wake::Context<'_>) -> core::task::poll::Poll<()>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::register_backchannel(&mut self, [u8; 16], [u8; 16])
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::remove_backchannel(&mut self, &[u8; 16]) -> core::option::Option<[u8; 16]>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::session_count(&self) -> usize
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_backchannel_sender(&mut self, tokio::sync::mpsc::bounded::Sender<lxmf_core::link_delivery::BackchannelSendCommand>)
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_cancellation_aware_backchannel_sender(&mut self, tokio::sync::mpsc::bounded::Sender<lxmf_core::link_delivery::BackchannelSendCommand>)
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_inbound_packet_sender(&mut self, tokio::sync::mpsc::unbounded::UnboundedSender<(alloc::vec::Vec<u8>, [u8; 16])>)
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_inbound_resource_accept_handler<F>(&mut self, F) where F: core::ops::function::Fn([u8; 16], &rns_protocol::resource_adv::ResourceAdvertisement) -> bool + core::marker::Send + core::marker::Sync + 'static
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_inbound_resource_completion_handler<F>(&mut self, F) where F: core::ops::function::Fn([u8; 16], [u8; 32], alloc::vec::Vec<u8>) + core::marker::Send + core::marker::Sync + 'static
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_inbound_resource_concluded_handler<F>(&mut self, F) where F: core::ops::function::Fn([u8; 16], [u8; 32]) + core::marker::Send + core::marker::Sync + 'static
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_inbound_resource_limit_bytes(&mut self, usize)
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_link_endpoint_dispatch_handle(&mut self, rns_transport::link_endpoint_dispatch::LinkEndpointDispatchHandle)
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_backchannel_delivery(&mut self, lxmf_core::message::LxMessage, [u8; 16]) -> core::result::Result<lxmf_core::link_delivery::BackchannelStartReport, lxmf_core::link_delivery::BackchannelStartFailure>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_delivery(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8) -> core::result::Result<[u8; 16], lxmf_core::link_delivery::LinkDeliveryStartFailure>
|
||||
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_delivery_with_report(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8) -> core::result::Result<lxmf_core::link_delivery::DirectLinkStartReport, lxmf_core::link_delivery::LinkDeliveryStartFailure>
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -114,7 +114,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -125,7 +125,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -136,7 +136,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -147,7 +147,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -158,7 +158,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -328,7 +328,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -339,7 +339,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -350,7 +350,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [
|
||||
@@ -363,7 +363,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
@@ -374,7 +374,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "~1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
|
||||
+31
-16
@@ -19,16 +19,19 @@
|
||||
"sourceCommit": "b8d7afce73f7f098706029361568e63f22888ea3"
|
||||
},
|
||||
"snapshotSource": {
|
||||
"commit": "2ab8fdf22b55bf18708c7181da5d4e07801e7699",
|
||||
"capturedOn": "2026-08-21",
|
||||
"commit": "98aa927e1d2da3ebcc42ebe25f635dcbb503faf7",
|
||||
"capturedOn": "2026-09-24",
|
||||
"review": {
|
||||
"areas": [
|
||||
"message construction and inspection",
|
||||
"message status and identifiers",
|
||||
"owned router persistence snapshots",
|
||||
"Link establishment timing and timing-aware delivery starts"
|
||||
"Exact local packet admission and proof-clock ownership",
|
||||
"Finite original Resource windows and bounded external observation grace",
|
||||
"Cancellation-aware backchannel adapters with legacy compatibility",
|
||||
"Generation-safe cleanup, settlement and queued-message preservation",
|
||||
"Owned reverse Resource completion handoff",
|
||||
"LXMF-02/03 and RET-05/07 event-driven delivery readiness (September 24)",
|
||||
"LXMF-02/03: late authenticated compression capability on pending Direct delivery"
|
||||
],
|
||||
"canonicalPath": "lxmf_core::message_api",
|
||||
"canonicalPath": "lxmf_core::link_delivery::LinkDeliveryManager",
|
||||
"retainedPaths": [
|
||||
"lxmf_core::message",
|
||||
"lxmf_core::constants",
|
||||
@@ -41,18 +44,23 @@
|
||||
"serialized persistence representations",
|
||||
"raw Reticulum transport channels"
|
||||
],
|
||||
"classification": "compatible additive facade and provisional integration APIs",
|
||||
"classification": "compatible additive opt-in provisional delivery-owner integration; existing message facade and public signatures remain unchanged",
|
||||
"publicApiDiff": {
|
||||
"added": 86,
|
||||
"added": 95,
|
||||
"removed": 0
|
||||
},
|
||||
"semver": "compatible additive APIs included in version 1.2.0",
|
||||
"deprecations": "none",
|
||||
"wirePersistenceRuntimeImpact": "no wire-format or persisted-layout change; exact message re-exports are behavior-neutral, owned router snapshots preserve the existing MessagePack layout, and Link establishment deadlines now follow authoritative first-hop timing while existing start methods remain available with the Reticulum fallback",
|
||||
"wirePersistenceRuntimeImpact": "No wire-format, cryptography, message identity or persisted-layout change. Exact local Link admission precedes RTT proof timing. Resource owner windows retain original timestamps; only externally observed Resources receive a finite 180-second accounting allowance after the original protocol deadline. Cancellation-aware adapters close and drain unpublished receipts while legacy sender installation retains its previous behavior. Exact cleanup is bounded and cannot erase replacement Links or lose uncancelled queued messages; authenticated settlement remains owned after Link closure. Optional reverse Resource completion hands off the single owned payload before conclusion cleanup, without changing legacy consumers. Authenticated no-compression announcements can now disable compression for unconstructed Direct Resources and queued payloads. Constructed Resources, split plans and propagation envelopes stay immutable; no wire fields or signatures change.",
|
||||
"platformEvidence": [
|
||||
"compiled message example and external canonical and legacy fixtures",
|
||||
"lxmf-core owned router snapshot and upstream-compatible Link timing unit tests",
|
||||
"macOS and Ubuntu workspace test jobs for source commit 2ab8fdf22b55bf18708c7181da5d4e07801e7699"
|
||||
"clean committed-source all-feature Apple ARM64 snapshot: seven added methods, zero removed; cumulative compatibility-floor diff is 93 additions and zero removals",
|
||||
"564 LXMF core and 55 daemon tests passed on the final implementation checkpoint; strict all-target Clippy and core Rustdoc passed",
|
||||
"independent actual-actor cancellation, captured legacy/aware policy, 256-owner reservation and replacement-Link/settlement review controls passed",
|
||||
"actual encrypted Resource final-proof expiry and same-message retry produced one receiver publication; signed Link reuse/loss/recovery and completion-lease controls passed",
|
||||
"default/all-feature external consumer fixtures and final working app runtime suite passed; no feature/MSRV/native-export changes",
|
||||
"final clean combined host/MSRV/native/interop and artifact qualification remain separately required; focused software evidence is not physical fading-radio or mobile acceptance",
|
||||
"September 24: additive poll_ready method; 75 focused delivery tests, encrypted 65 KB/750 KB/2.6 MB/8 MB readiness-driven transfers, and strict stable/MSRV Clippy passed. Physical radio speed remains separately qualified.",
|
||||
"September 24 first-contact correction: 577 lxmf-core tests and strict all-target Clippy passed; the new API is additive provisional owner integration. Small/Micro native first-contact and full app runtime qualification are retained by the cross-repo maintainer harness."
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -63,8 +71,8 @@
|
||||
"tier": "candidate-stable",
|
||||
"compatibility": "reviewed-snapshot",
|
||||
"snapshot": "api/snapshots/lxmf-core.txt",
|
||||
"itemCount": 1638,
|
||||
"sha256": "5b59de793250e211cd206c06e8e70147d91e40c45ba1d28fb659a4a354e2fd96"
|
||||
"itemCount": 1647,
|
||||
"sha256": "b7b1d52406e2c97a204a5fb567abc6a216733594a7abd63797ff55a70d8d3b73"
|
||||
},
|
||||
{
|
||||
"name": "lxmf-tools",
|
||||
@@ -75,5 +83,12 @@
|
||||
"itemCount": 185,
|
||||
"sha256": "0427d0fab38f8061cbf7f11b701f29f438490478f133524b0a8e4e7cfe6f3924"
|
||||
}
|
||||
]
|
||||
],
|
||||
"deliveryReadinessReview": {
|
||||
"reviewedOn": "2026-09-24",
|
||||
"classification": "Compatible additive provisional integration method; no removed signatures, dependency requirement, MSRV, wire or persistence changes. No release-version bump in this implementation commit.",
|
||||
"ownership": "Input and local receipt lookahead remain owned on cancellation; exact bind readiness does not publish the endpoint. One polling task; periodic deadline ticks remain required.",
|
||||
"scheduling": "Bounded input drain; readiness covers packets, endpoint lifecycle/acknowledgements, backchannel receipts and staged-transport capacity. Existing lxmd-rs periodic consumers remain supported.",
|
||||
"diagnostics": "Aggregate Resource request/part/repeated-part/byte action counts under a closed content-free target; dispatch is not driver admission or recipient delivery."
|
||||
}
|
||||
}
|
||||
+3164
-218
File diff suppressed because it is too large.
Load diff
@@ -745,6 +745,17 @@ impl PropagationNode {
|
||||
PropagationEntry::new_stamped(tid, message_hash, destination_hash, size, sv);
|
||||
pe.stored_at = ts;
|
||||
|
||||
// Older app hosts persisted opaque blobs without their PN
|
||||
// stamp. Their filename TID hashes the entire file, whereas
|
||||
// canonical stamped storage hashes the file before its final
|
||||
// 32-byte stamp. Recover that exact legacy representation so
|
||||
// client /get cannot truncate ciphertext after a restart.
|
||||
// This distinguishes storage format, not stamp authenticity;
|
||||
// retain the existing policy for other opaque/malformed files.
|
||||
if data.len() > DESTINATION_LENGTH && message_hash == tid {
|
||||
pe.stamped = false;
|
||||
}
|
||||
|
||||
if let Ok(msg) = LxMessage::unpack(&data) {
|
||||
pe.message_hash = msg.hash.unwrap_or([0u8; 32]);
|
||||
pe.destination_hash = msg.destination_hash;
|
||||
@@ -2840,9 +2851,140 @@ mod tests {
|
||||
let value: Value = rmpv::decode::read_value(&mut &response[..]).unwrap();
|
||||
assert_eq!(value.as_array().unwrap().len(), 1);
|
||||
|
||||
let full_id = rns_crypto::sha::full_hash(&lxmf_data);
|
||||
let get_request = Value::Array(vec![
|
||||
Value::Array(vec![Value::Binary(full_id.to_vec())]),
|
||||
Value::Array(vec![]),
|
||||
]);
|
||||
let mut get_buf = Vec::new();
|
||||
rmpv::encode::write_value(&mut get_buf, &get_request).unwrap();
|
||||
let response = reloaded
|
||||
.handle_get_request(&get_buf, &[0xBB; 16])
|
||||
.into_response();
|
||||
let value: Value = rmpv::decode::read_value(&mut &response[..]).unwrap();
|
||||
assert_eq!(
|
||||
value.as_array().unwrap()[0].as_slice().unwrap(),
|
||||
lxmf_data.as_slice(),
|
||||
"legacy opaque blobs have no stamp to strip after restart"
|
||||
);
|
||||
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_opaque_blob_reload_preserves_bytes_and_accounting_at_minimum_lengths() {
|
||||
use rmpv::Value;
|
||||
|
||||
// These are storage-format controls, not authenticated ciphertext or
|
||||
// stamp-validation tests. Retain the existing public ingress minimum.
|
||||
for stamped in [false, true] {
|
||||
for len in [17, 31, 32, 33, 48, 49, 144] {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let mut node = PropagationNode::with_storage(
|
||||
PropagationNodeConfig::default(),
|
||||
[0xAA; 16],
|
||||
dir.path().to_path_buf(),
|
||||
)
|
||||
.unwrap();
|
||||
assert!(!node.accept_propagated_blob(&[0xBB; 16], 0));
|
||||
assert!(!node.accept_stamped_propagated_blob(&[0xBB; 16], &[0; 32], 0));
|
||||
assert_eq!(node.message_count(), 0);
|
||||
let mut blob = vec![0xBB; 16];
|
||||
blob.resize(len, 0xCC);
|
||||
let stamp = [0x5A; 32];
|
||||
let full_id = rns_crypto::sha::full_hash(&blob);
|
||||
let mut stored = blob.clone();
|
||||
if stamped {
|
||||
stored.extend_from_slice(&stamp);
|
||||
assert!(node.accept_stamped_propagated_blob(&blob, &stamp, 0));
|
||||
} else {
|
||||
assert!(node.accept_propagated_blob(&blob, 0));
|
||||
}
|
||||
assert_eq!(node.total_size(), stored.len());
|
||||
let path = dir
|
||||
.path()
|
||||
.join(node.store.get(&full_id).unwrap().filename());
|
||||
assert_eq!(std::fs::read(&path).unwrap(), stored);
|
||||
drop(node);
|
||||
|
||||
let mut node = PropagationNode::with_storage(
|
||||
PropagationNodeConfig::default(),
|
||||
[0xAA; 16],
|
||||
dir.path().to_path_buf(),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(node.message_count(), 1);
|
||||
assert_eq!(node.total_size(), stored.len());
|
||||
assert_eq!(node.store.get(&full_id).unwrap().stamped, stamped);
|
||||
// Duplicate admission must neither replace the known format
|
||||
// nor grow the byte/accounting reservation after reload.
|
||||
assert!(!node.accept_propagated_blob(&blob, 0));
|
||||
assert!(!node.accept_stamped_propagated_blob(&blob, &stamp, 0));
|
||||
assert_eq!(node.message_count(), 1);
|
||||
assert_eq!(node.total_size(), stored.len());
|
||||
assert!(node.pending_write_ids.is_empty());
|
||||
assert_eq!(node.pending_write_bytes, 0);
|
||||
let get = Value::Array(vec![
|
||||
Value::Array(vec![Value::Binary(full_id.to_vec())]),
|
||||
Value::Array(vec![]),
|
||||
]);
|
||||
let mut request = Vec::new();
|
||||
rmpv::encode::write_value(&mut request, &get).unwrap();
|
||||
let response = node
|
||||
.handle_get_request(&request, &[0xBB; 16])
|
||||
.into_response();
|
||||
let value: Value = rmpv::decode::read_value(&mut &response[..]).unwrap();
|
||||
let messages = value.as_array().unwrap();
|
||||
assert_eq!(messages.len(), 1);
|
||||
assert_eq!(messages[0].as_slice().unwrap(), blob);
|
||||
assert_eq!(
|
||||
node.message_get_request(&[full_id]),
|
||||
vec![(full_id, stored.clone())]
|
||||
);
|
||||
assert_eq!(std::fs::read(&path).unwrap(), stored);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reloaded_legacy_message_keeps_original_get_bytes() {
|
||||
use rmpv::Value;
|
||||
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let message = make_signed_message([0xBB; 16], [0xCC; 16], "legacy", "full message");
|
||||
let packed = message.pack().unwrap();
|
||||
let full_id = message.transient_id.or(message.hash).unwrap();
|
||||
assert_ne!(full_id, rns_crypto::sha::full_hash(&packed));
|
||||
let mut node = PropagationNode::with_storage(
|
||||
PropagationNodeConfig::default(),
|
||||
[0xAA; 16],
|
||||
dir.path().to_path_buf(),
|
||||
)
|
||||
.unwrap();
|
||||
assert!(node.accept_message(&message));
|
||||
drop(node);
|
||||
let mut node = PropagationNode::with_storage(
|
||||
PropagationNodeConfig::default(),
|
||||
[0xAA; 16],
|
||||
dir.path().to_path_buf(),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(node.message_count(), 1);
|
||||
assert_eq!(node.total_size(), packed.len());
|
||||
assert!(!node.store.get(&full_id).unwrap().stamped);
|
||||
let get = Value::Array(vec![
|
||||
Value::Array(vec![Value::Binary(full_id.to_vec())]),
|
||||
Value::Array(vec![]),
|
||||
]);
|
||||
let mut request = Vec::new();
|
||||
rmpv::encode::write_value(&mut request, &get).unwrap();
|
||||
let response = node
|
||||
.handle_get_request(&request, &[0xBB; 16])
|
||||
.into_response();
|
||||
let value: Value = rmpv::decode::read_value(&mut &response[..]).unwrap();
|
||||
assert_eq!(value.as_array().unwrap()[0].as_slice().unwrap(), packed);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_handle_get_request_purge_phase() {
|
||||
let dir = std::env::temp_dir().join("lxmf_test_get_purge");
|
||||
|
||||
@@ -869,6 +869,46 @@ fn direct_reusable_link_state(
|
||||
}
|
||||
}
|
||||
|
||||
async fn forward_backchannel_receipt(
|
||||
mut runtime_rx: tokio::sync::oneshot::Receiver<
|
||||
Result<
|
||||
rns_runtime::link_manager::LinkPayloadSendReceipt,
|
||||
rns_runtime::link_manager::LinkSendError,
|
||||
>,
|
||||
>,
|
||||
mut owner_tx: tokio::sync::oneshot::Sender<
|
||||
Result<BackchannelSendReceipt, BackchannelSendError>,
|
||||
>,
|
||||
abandon_tx: mpsc::Sender<BackchannelSendReceipt>,
|
||||
) {
|
||||
let result = tokio::select! {
|
||||
biased;
|
||||
result = &mut runtime_rx => Some(result),
|
||||
_ = owner_tx.closed() => None,
|
||||
_ = tokio::time::sleep(std::time::Duration::from_secs(10)) => None,
|
||||
};
|
||||
let Some(result) = result else {
|
||||
// close preserves an already-published value and rejects future sends.
|
||||
// The runtime cancels exact admission if its receipt publication fails.
|
||||
runtime_rx.close();
|
||||
if let Ok(Ok(receipt)) = runtime_rx.try_recv() {
|
||||
let _ = abandon_tx
|
||||
.send(backchannel_receipt_from_runtime(receipt))
|
||||
.await;
|
||||
}
|
||||
let _ = owner_tx.send(Err(BackchannelSendError::TransportUnavailable));
|
||||
return;
|
||||
};
|
||||
let result = match result {
|
||||
Ok(Ok(receipt)) => Ok(backchannel_receipt_from_runtime(receipt)),
|
||||
Ok(Err(error)) => Err(backchannel_error_from_runtime(error)),
|
||||
Err(_) => Err(BackchannelSendError::TransportUnavailable),
|
||||
};
|
||||
if let Err(Ok(receipt)) = owner_tx.send(result) {
|
||||
let _ = abandon_tx.send(receipt).await;
|
||||
}
|
||||
}
|
||||
|
||||
fn backchannel_receipt_from_runtime(
|
||||
receipt: rns_runtime::link_manager::LinkPayloadSendReceipt,
|
||||
) -> BackchannelSendReceipt {
|
||||
@@ -1179,12 +1219,19 @@ struct LxmdRunner {
|
||||
mpsc::UnboundedReceiver<rns_runtime::link_manager::DestinationDeliveryProof>,
|
||||
opportunistic_in_flight: HashMap<[u8; 32], PendingOpportunisticDelivery>,
|
||||
backchannel_command_rx: Option<mpsc::Receiver<BackchannelSendCommand>>,
|
||||
backchannel_abandon_tx: mpsc::Sender<BackchannelSendReceipt>,
|
||||
backchannel_abandon_rx: mpsc::Receiver<BackchannelSendReceipt>,
|
||||
pending_backchannel_abandon: Option<BackchannelSendReceipt>,
|
||||
backchannel_bridge_slots: Arc<tokio::sync::Semaphore>,
|
||||
pending_backchannel_resource_cancellations:
|
||||
VecDeque<lxmf_core::link_delivery::BackchannelResourceCancelRequest>,
|
||||
last_delivery_failure: Option<String>,
|
||||
propagation_sync: Option<lxmf_core::propagation_sync::PropagationSyncTask>,
|
||||
propagation_client: Option<lxmf_core::propagation_client::PropagationClient>,
|
||||
propagation_node: Option<Arc<Mutex<PropagationNode>>>,
|
||||
propagation_admission: Option<Arc<Mutex<PnInboundRuntime>>>,
|
||||
prop_link_command_tx: Option<mpsc::Sender<rns_runtime::link_manager::LinkManagerCommand>>,
|
||||
endpoint_dispatch: Option<rns_transport::link_endpoint_dispatch::LinkEndpointDispatchHandle>,
|
||||
transport_tx: mpsc::Sender<TransportMessage>,
|
||||
pending_runtime_transport: VecDeque<TransportMessage>,
|
||||
required_announces: AnnounceMailbox,
|
||||
@@ -1293,6 +1340,9 @@ impl LxmdRunner {
|
||||
config: DaemonConfig,
|
||||
config_dir: &Path,
|
||||
transport_tx: mpsc::Sender<TransportMessage>,
|
||||
endpoint_dispatch: Option<
|
||||
rns_transport::link_endpoint_dispatch::LinkEndpointDispatchHandle,
|
||||
>,
|
||||
) -> Result<Self, Box<dyn std::error::Error + Send + Sync>> {
|
||||
let paths = LxmdPaths::new(config_dir);
|
||||
std::fs::create_dir_all(&paths.config_dir)?;
|
||||
@@ -1383,6 +1433,7 @@ impl LxmdRunner {
|
||||
// LinkManager handles link handshakes (ECDH), keepalive, identification,
|
||||
// and resource transfers; it forwards plaintext application data here.
|
||||
let (delivery_tx, delivery_rx) = mpsc::channel(256);
|
||||
let (backchannel_abandon_tx, backchannel_abandon_rx) = mpsc::channel(256);
|
||||
let (link_packet_tx, link_packet_rx) = mpsc::unbounded_channel::<(Vec<u8>, [u8; 16])>();
|
||||
let (delivery_accounting_tx, delivery_accounting_rx) =
|
||||
mpsc::unbounded_channel::<LinkManagerAccountingEvent>();
|
||||
@@ -1434,6 +1485,9 @@ impl LxmdRunner {
|
||||
DELIVERY_APP_NAME,
|
||||
signing_key,
|
||||
);
|
||||
if let Some(handle) = &endpoint_dispatch {
|
||||
link_mgr.set_link_endpoint_dispatch_handle(handle.clone());
|
||||
}
|
||||
link_mgr.set_link_packet_channel(link_packet_tx);
|
||||
link_mgr.set_accounting_event_channel(delivery_accounting_tx);
|
||||
link_mgr.set_resource_event_channel(delivery_resource_event_tx);
|
||||
@@ -1572,6 +1626,9 @@ impl LxmdRunner {
|
||||
"lxmf.propagation",
|
||||
Some(prop_signing_key),
|
||||
);
|
||||
if let Some(handle) = &endpoint_dispatch {
|
||||
prop_link_mgr.set_link_endpoint_dispatch_handle(handle.clone());
|
||||
}
|
||||
prop_link_mgr.set_link_packet_channel(prop_link_packet_tx);
|
||||
prop_link_mgr.set_accounting_event_channel(prop_accounting_tx);
|
||||
prop_link_mgr.set_resource_strategy(rns_runtime::prelude::ResourceStrategy::AcceptApp);
|
||||
@@ -1728,6 +1785,9 @@ impl LxmdRunner {
|
||||
CONTROL_APP_NAME,
|
||||
Some(control_signing_key),
|
||||
);
|
||||
if let Some(handle) = &endpoint_dispatch {
|
||||
control_link_mgr.set_link_endpoint_dispatch_handle(handle.clone());
|
||||
}
|
||||
let control_link_identities = control_link_mgr.link_identities_handle();
|
||||
let stats_path_hash =
|
||||
rns_crypto::sha::truncated_hash(lxmf_core::constants::STATS_GET_PATH.as_bytes());
|
||||
@@ -1854,12 +1914,18 @@ impl LxmdRunner {
|
||||
destination_delivery_proof_rx,
|
||||
opportunistic_in_flight: HashMap::new(),
|
||||
backchannel_command_rx: None,
|
||||
backchannel_abandon_tx,
|
||||
backchannel_abandon_rx,
|
||||
pending_backchannel_abandon: None,
|
||||
backchannel_bridge_slots: Arc::new(tokio::sync::Semaphore::new(256)),
|
||||
pending_backchannel_resource_cancellations: VecDeque::new(),
|
||||
last_delivery_failure: None,
|
||||
propagation_sync: None,
|
||||
propagation_client: None,
|
||||
propagation_node: None,
|
||||
propagation_admission,
|
||||
prop_link_command_tx,
|
||||
endpoint_dispatch,
|
||||
transport_tx: transport_tx.clone(),
|
||||
pending_runtime_transport: VecDeque::new(),
|
||||
required_announces,
|
||||
@@ -2395,12 +2461,77 @@ impl LxmdRunner {
|
||||
}
|
||||
|
||||
fn drain_core_backchannel_send_commands(&mut self) {
|
||||
while let Some(receipt) = self
|
||||
.pending_backchannel_abandon
|
||||
.take()
|
||||
.or_else(|| self.backchannel_abandon_rx.try_recv().ok())
|
||||
{
|
||||
match receipt {
|
||||
BackchannelSendReceipt::Packet {
|
||||
link_id,
|
||||
packet_hash,
|
||||
} => {
|
||||
if let Some(ld) = &mut self.link_delivery {
|
||||
if !ld.abandon_backchannel_packet(link_id, packet_hash) {
|
||||
self.pending_backchannel_abandon =
|
||||
Some(BackchannelSendReceipt::Packet {
|
||||
link_id,
|
||||
packet_hash,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
BackchannelSendReceipt::Resource {
|
||||
link_id,
|
||||
resource_hash,
|
||||
} => {
|
||||
self.pending_backchannel_resource_cancellations.push_back(
|
||||
lxmf_core::link_delivery::BackchannelResourceCancelRequest {
|
||||
link_id,
|
||||
resource_hash,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(ld) = &mut self.link_delivery {
|
||||
self.pending_backchannel_resource_cancellations
|
||||
.extend(ld.take_backchannel_resource_cancellations());
|
||||
}
|
||||
while let Some(request) = self.pending_backchannel_resource_cancellations.front() {
|
||||
let command = LinkManagerCommand::CancelLinkResource {
|
||||
link_id: request.link_id,
|
||||
resource_id: request.resource_hash,
|
||||
direction: LinkResourceDirection::Outbound,
|
||||
result_tx: None,
|
||||
};
|
||||
match self.link_command_tx.try_send(command) {
|
||||
Ok(()) => {
|
||||
self.pending_backchannel_resource_cancellations.pop_front();
|
||||
}
|
||||
Err(mpsc::error::TrySendError::Full(_)) => break,
|
||||
Err(mpsc::error::TrySendError::Closed(_)) => {
|
||||
self.pending_backchannel_resource_cancellations.clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
let Some(rx) = self.backchannel_command_rx.as_mut() else {
|
||||
return;
|
||||
};
|
||||
let command_tx = self.link_command_tx.clone();
|
||||
|
||||
while let Ok(command) = rx.try_recv() {
|
||||
if command.result_tx.is_closed() {
|
||||
continue;
|
||||
}
|
||||
let Ok(bridge_slot) = self.backchannel_bridge_slots.clone().try_acquire_owned() else {
|
||||
let _ = command
|
||||
.result_tx
|
||||
.send(Err(BackchannelSendError::TransportUnavailable));
|
||||
continue;
|
||||
};
|
||||
let (result_tx, result_rx) = tokio::sync::oneshot::channel();
|
||||
let link_id = command.link_id;
|
||||
let link_command = rns_runtime::link_manager::LinkManagerCommand::SendLinkPayload {
|
||||
@@ -2411,13 +2542,10 @@ impl LxmdRunner {
|
||||
};
|
||||
match command_tx.try_send(link_command) {
|
||||
Ok(()) => {
|
||||
let abandon_tx = self.backchannel_abandon_tx.clone();
|
||||
tokio::spawn(async move {
|
||||
let result = match result_rx.await {
|
||||
Ok(Ok(receipt)) => Ok(backchannel_receipt_from_runtime(receipt)),
|
||||
Ok(Err(err)) => Err(backchannel_error_from_runtime(err)),
|
||||
Err(_) => Err(BackchannelSendError::TransportUnavailable),
|
||||
};
|
||||
let _ = command.result_tx.send(result);
|
||||
let _bridge_slot = bridge_slot;
|
||||
forward_backchannel_receipt(result_rx, command.result_tx, abandon_tx).await;
|
||||
});
|
||||
}
|
||||
Err(err) => {
|
||||
@@ -2849,6 +2977,7 @@ impl LxmdRunner {
|
||||
self.handle_link_delivery_result(result);
|
||||
}
|
||||
}
|
||||
self.drain_core_backchannel_send_commands();
|
||||
|
||||
self.drive_propagation_sync();
|
||||
|
||||
@@ -3334,6 +3463,68 @@ impl LxmdRunner {
|
||||
|
||||
fn handle_delivery_accounting_event(&mut self, event: LinkManagerAccountingEvent) {
|
||||
match event {
|
||||
LinkManagerAccountingEvent::OutboundPacketWait {
|
||||
receipt,
|
||||
started_at,
|
||||
timeout,
|
||||
awaiting_admission,
|
||||
cancellation,
|
||||
} => {
|
||||
if let Some(ld) = &mut self.link_delivery {
|
||||
ld.observe_backchannel_packet_wait(
|
||||
receipt.link_id,
|
||||
receipt.packet_hash,
|
||||
started_at,
|
||||
timeout,
|
||||
awaiting_admission,
|
||||
cancellation,
|
||||
);
|
||||
}
|
||||
}
|
||||
LinkManagerAccountingEvent::OutboundResourceWait {
|
||||
link_id,
|
||||
resource_id,
|
||||
started_at,
|
||||
timeout,
|
||||
} => {
|
||||
if let Some(ld) = &mut self.link_delivery {
|
||||
ld.observe_backchannel_resource_wait(link_id, resource_id, started_at, timeout);
|
||||
}
|
||||
}
|
||||
LinkManagerAccountingEvent::ResourceEvent(LinkResourceEvent::Concluded {
|
||||
link_id,
|
||||
resource_id,
|
||||
direction: LinkResourceDirection::Outbound,
|
||||
conclusion,
|
||||
}) => {
|
||||
let result = self.link_delivery.as_mut().and_then(|ld| match conclusion {
|
||||
LinkResourceConclusion::Complete => {
|
||||
ld.handle_backchannel_resource_proof(link_id, resource_id)
|
||||
}
|
||||
LinkResourceConclusion::Rejected => ld.handle_backchannel_resource_conclusion(
|
||||
link_id,
|
||||
resource_id,
|
||||
lxmf_core::link_delivery::BackchannelResourceConclusion::Rejected,
|
||||
"resource rejected",
|
||||
),
|
||||
LinkResourceConclusion::Failed(reason) => ld
|
||||
.handle_backchannel_resource_conclusion(
|
||||
link_id,
|
||||
resource_id,
|
||||
lxmf_core::link_delivery::BackchannelResourceConclusion::Failed,
|
||||
reason,
|
||||
),
|
||||
LinkResourceConclusion::Cancelled => ld.handle_backchannel_resource_conclusion(
|
||||
link_id,
|
||||
resource_id,
|
||||
lxmf_core::link_delivery::BackchannelResourceConclusion::Failed,
|
||||
"resource cancelled",
|
||||
),
|
||||
});
|
||||
if let Some(result) = result {
|
||||
self.handle_link_delivery_result(result);
|
||||
}
|
||||
}
|
||||
LinkManagerAccountingEvent::ResourceEvent(event) => {
|
||||
if let Some(event) = delivery_resource_event_from_runtime(event) {
|
||||
self.router.handle_inbound_resource_event(event);
|
||||
@@ -4352,11 +4543,15 @@ impl LxmdRunner {
|
||||
|
||||
fn ensure_link_delivery(&mut self) {
|
||||
if self.link_delivery.is_none() {
|
||||
self.link_delivery = Some(lxmf_core::link_delivery::LinkDeliveryManager::new(
|
||||
let mut delivery = lxmf_core::link_delivery::LinkDeliveryManager::new(
|
||||
self.transport_tx.clone(),
|
||||
Some(self.identity.get_public_key()),
|
||||
self.identity.get_signing_key(),
|
||||
));
|
||||
);
|
||||
if let Some(handle) = &self.endpoint_dispatch {
|
||||
delivery.set_link_endpoint_dispatch_handle(handle.clone());
|
||||
}
|
||||
self.link_delivery = Some(delivery);
|
||||
}
|
||||
self.ensure_backchannel_sender();
|
||||
}
|
||||
@@ -4368,7 +4563,7 @@ impl LxmdRunner {
|
||||
|
||||
let (tx, rx) = mpsc::channel(256);
|
||||
if let Some(ref mut ld) = self.link_delivery {
|
||||
ld.set_backchannel_sender(tx);
|
||||
ld.set_cancellation_aware_backchannel_sender(tx);
|
||||
self.backchannel_command_rx = Some(rx);
|
||||
}
|
||||
}
|
||||
@@ -4712,7 +4907,12 @@ pub(crate) async fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
let mut runner = match LxmdRunner::new(daemon_config.clone(), &config_dir, transport_tx) {
|
||||
let mut runner = match LxmdRunner::new(
|
||||
daemon_config.clone(),
|
||||
&config_dir,
|
||||
transport_tx,
|
||||
Some(rns_handle.link_endpoint_dispatch_handle()),
|
||||
) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
tracing::error!("Failed to initialize LXMF daemon: {e}");
|
||||
@@ -4720,6 +4920,10 @@ pub(crate) async fn main() {
|
||||
}
|
||||
};
|
||||
if let Err(error) = runner.install_announce_subscriptions(&rns_handle).await {
|
||||
if shutdown.is_triggered() {
|
||||
tracing::info!("Startup announce cancelled by shutdown");
|
||||
return;
|
||||
}
|
||||
tracing::error!(%error, "failed to install lxmd announce subscriptions");
|
||||
std::process::exit(1);
|
||||
}
|
||||
@@ -5140,6 +5344,111 @@ pub(crate) async fn main() {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[tokio::test]
|
||||
async fn backchannel_accounting_retains_exact_windows_and_resource_cancellation() {
|
||||
use rns_crypto::ed25519::Ed25519PrivateKey;
|
||||
use std::time::{Duration, Instant};
|
||||
let unique = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_nanos();
|
||||
let temp = std::env::temp_dir().join(format!(
|
||||
"lxmd-backchannel-accounting-{}-{unique}",
|
||||
std::process::id()
|
||||
));
|
||||
let (tx, _rx) = mpsc::channel(64);
|
||||
let mut runner = LxmdRunner::new(DaemonConfig::default(), &temp, tx, None).unwrap();
|
||||
runner.ensure_link_delivery();
|
||||
let (send_tx, mut send_rx) = mpsc::channel(8);
|
||||
runner
|
||||
.link_delivery
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.set_backchannel_sender(send_tx);
|
||||
let link_id = [0x61; 16];
|
||||
let dest = [0x62; 16];
|
||||
let resource_hash = [0x63; 32];
|
||||
let mut message = LxMessage::new(
|
||||
dest,
|
||||
[0x64; 16],
|
||||
"accounting",
|
||||
"bounded",
|
||||
DeliveryMethod::Direct,
|
||||
);
|
||||
message.sign(&Ed25519PrivateKey::generate()).unwrap();
|
||||
let hash = message.hash.unwrap();
|
||||
let ld = runner.link_delivery.as_mut().unwrap();
|
||||
ld.register_backchannel(dest, link_id);
|
||||
ld.start_backchannel_delivery(message, dest).unwrap();
|
||||
send_rx
|
||||
.try_recv()
|
||||
.unwrap()
|
||||
.result_tx
|
||||
.send(Ok(BackchannelSendReceipt::Resource {
|
||||
link_id,
|
||||
resource_hash,
|
||||
}))
|
||||
.unwrap();
|
||||
assert!(ld.tick().is_empty());
|
||||
let original = Instant::now() - Duration::from_secs(400);
|
||||
runner.handle_delivery_accounting_event(LinkManagerAccountingEvent::OutboundResourceWait {
|
||||
link_id,
|
||||
resource_id: resource_hash,
|
||||
started_at: original,
|
||||
timeout: Duration::from_secs(800),
|
||||
});
|
||||
let ld = runner.link_delivery.as_mut().unwrap();
|
||||
assert_eq!(
|
||||
ld.message_timeout_window(hash),
|
||||
Some((original, Duration::from_secs(980)))
|
||||
);
|
||||
assert!(ld.tick().is_empty());
|
||||
assert!(ld.cancel_delivery_by_message_hash(hash));
|
||||
let (command_tx, mut command_rx) = mpsc::channel(1);
|
||||
command_tx
|
||||
.try_send(LinkManagerCommand::CancelLinkResource {
|
||||
link_id: [0; 16],
|
||||
resource_id: [0; 32],
|
||||
direction: LinkResourceDirection::Outbound,
|
||||
result_tx: None,
|
||||
})
|
||||
.unwrap();
|
||||
runner.link_command_tx = command_tx;
|
||||
runner.drain_core_backchannel_send_commands();
|
||||
assert_eq!(runner.pending_backchannel_resource_cancellations.len(), 1);
|
||||
command_rx.try_recv().unwrap();
|
||||
runner.drain_core_backchannel_send_commands();
|
||||
assert!(
|
||||
matches!(command_rx.try_recv(), Ok(LinkManagerCommand::CancelLinkResource {
|
||||
link_id: observed_link, resource_id, direction: LinkResourceDirection::Outbound, ..
|
||||
}) if observed_link == link_id && resource_id == resource_hash)
|
||||
);
|
||||
runner.drain_core_backchannel_send_commands();
|
||||
assert!(runner.pending_backchannel_resource_cancellations.is_empty());
|
||||
assert!(command_rx.try_recv().is_err());
|
||||
// A late terminal is reconciled as already cancelled, not retried or
|
||||
// published a second time by the daemon's second notification path.
|
||||
runner.handle_delivery_accounting_event(LinkManagerAccountingEvent::ResourceEvent(
|
||||
LinkResourceEvent::Concluded {
|
||||
link_id,
|
||||
resource_id: resource_hash,
|
||||
direction: LinkResourceDirection::Outbound,
|
||||
conclusion: LinkResourceConclusion::Rejected,
|
||||
},
|
||||
));
|
||||
assert_eq!(runner.link_delivery.as_ref().unwrap().pending_count(), 0);
|
||||
assert!(
|
||||
runner
|
||||
.link_delivery
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.message_timeout_window(hash)
|
||||
.is_none()
|
||||
);
|
||||
drop(runner);
|
||||
let _ = std::fs::remove_dir_all(temp);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn propagation_download_auth_uses_live_allowed_identity_set() {
|
||||
let allowed = [0x11; 16];
|
||||
@@ -5489,7 +5798,7 @@ mod tests {
|
||||
enforce_stamps,
|
||||
..Default::default()
|
||||
};
|
||||
let mut runner = LxmdRunner::new(config, &temp, tx).expect("runner");
|
||||
let mut runner = LxmdRunner::new(config, &temp, tx, None).expect("runner");
|
||||
let raw = runner.create_announce_packet().expect("delivery announce");
|
||||
let (_, announce) = unpack_announce(&raw);
|
||||
let (_, stamp_cost) = lxmf_core::handlers::parse_announce_app_data(
|
||||
@@ -5734,7 +6043,7 @@ mod tests {
|
||||
stamp_cost: Some(8),
|
||||
..Default::default()
|
||||
};
|
||||
let mut runner = LxmdRunner::new(config, &temp, tx).expect("runner");
|
||||
let mut runner = LxmdRunner::new(config, &temp, tx, None).expect("runner");
|
||||
|
||||
let dest = [0xAB; 16];
|
||||
assert_ne!(dest, runner.lxmf_dest_hash);
|
||||
@@ -5784,7 +6093,7 @@ mod tests {
|
||||
std::process::id()
|
||||
));
|
||||
let (tx, _rx) = mpsc::channel::<TransportMessage>(64);
|
||||
let mut runner = LxmdRunner::new(DaemonConfig::default(), &temp, tx).expect("runner");
|
||||
let mut runner = LxmdRunner::new(DaemonConfig::default(), &temp, tx, None).expect("runner");
|
||||
|
||||
let deliveries = Arc::new(AtomicUsize::new(0));
|
||||
let observed = Arc::clone(&deliveries);
|
||||
|
||||
@@ -45,6 +45,7 @@ impl ControlCommandKind {
|
||||
}
|
||||
}
|
||||
|
||||
/// Query propagation control with a raw peer hash, or no payload for status.
|
||||
pub async fn query_control(
|
||||
transport_tx: tokio::sync::mpsc::Sender<rns_transport::messages::TransportMessage>,
|
||||
identity: Identity,
|
||||
@@ -59,13 +60,25 @@ pub async fn query_control(
|
||||
target_identity_hash,
|
||||
CONTROL_APP_NAME,
|
||||
path,
|
||||
payload,
|
||||
encode_control_payload(payload),
|
||||
0,
|
||||
Duration::from_secs_f64(timeout_secs.max(0.0)),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
fn encode_control_payload(payload: Vec<u8>) -> Vec<u8> {
|
||||
// LinkClient accepts an encoded MessagePack value. Raw hash bytes can
|
||||
// themselves form a complete value (e.g. 0xaf followed by 15 bytes), so
|
||||
// letting Link infer the type can truncate or reinterpret a peer address.
|
||||
// Python sends a bytes object for sync/unpeer and None for status.
|
||||
encode_value(&if payload.is_empty() {
|
||||
Value::Nil
|
||||
} else {
|
||||
Value::Binary(payload)
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn resolve_remote_identity_hash(
|
||||
transport_tx: mpsc::Sender<TransportMessage>,
|
||||
remote_destination_hash: [u8; 16],
|
||||
@@ -844,6 +857,37 @@ fn encode_value(value: &Value) -> Vec<u8> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn control_payload_preserves_every_peer_hash_prefix_as_binary() {
|
||||
for prefix in 0..=u8::MAX {
|
||||
let mut hash = vec![0x41; 16];
|
||||
hash[0] = prefix;
|
||||
assert_eq!(
|
||||
decode_value(&encode_control_payload(hash.clone())),
|
||||
Value::Binary(hash),
|
||||
"peer prefix {prefix:#04x} must not select a MessagePack type"
|
||||
);
|
||||
}
|
||||
for hash in [
|
||||
hex::decode("af55b3f0e0b336fdfdbe263c12a688e0").unwrap(),
|
||||
[vec![0xc4, 14], vec![0x41; 14]].concat(),
|
||||
[vec![0x9f], vec![0; 15]].concat(),
|
||||
] {
|
||||
assert_eq!(
|
||||
decode_value(&encode_control_payload(hash.clone())),
|
||||
Value::Binary(hash)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_control_payload_matches_python_status_nil() {
|
||||
assert_eq!(
|
||||
decode_value(&encode_control_payload(Vec::new())),
|
||||
Value::Nil
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn remote_identity_resolution_uses_recall_and_path_request_without_handlers() {
|
||||
use rns_transport::messages::{
|
||||
|
||||
@@ -65,9 +65,11 @@ def check_packages(document: dict[str, object]) -> tuple[str, str]:
|
||||
)
|
||||
|
||||
requirement = reticulum_requirements.pop()
|
||||
if not requirement.startswith("^"):
|
||||
# The project permits breaking core APIs in a minor release; caret ranges
|
||||
# would silently admit the next incompatible minor line.
|
||||
if not re.fullmatch(r"~\d+\.\d+\.\d+", requirement):
|
||||
fail(f"unexpected rsReticulum compatibility requirement {requirement!r}")
|
||||
return str(versions.pop()), requirement.removeprefix("^")
|
||||
return str(versions.pop()), requirement.removeprefix("~")
|
||||
|
||||
|
||||
def check_workflow_actions() -> None:
|
||||
|
||||
Reference in new issue
Block a user