From 052128bf4e9e9917d6098bb50cc0350c3e5a69dc Mon Sep 17 00:00:00 2001 From: DeFiDude <59237470+DeFiDude@users.noreply.github.com> Date: Tue, 10 Nov 2026 12:45:02 -0700 Subject: [PATCH] delivery: count inbound link data toward link liveness --- crates/lxmf-core/src/link_delivery.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/lxmf-core/src/link_delivery.rs b/crates/lxmf-core/src/link_delivery.rs index 155dbf1..430ee25 100644 --- a/crates/lxmf-core/src/link_delivery.rs +++ b/crates/lxmf-core/src/link_delivery.rs @@ -2155,6 +2155,16 @@ impl LinkDeliveryManager { ); continue; } + // Link.py:1030; packet proofs reach the Link only as receipts (Transport.py:2997-3036). + let link_receives = header.flags.packet_type + != rns_wire::flags::PacketType::Proof + || header.context == rns_wire::context::PacketContext::ResourcePrf; + if link_receives + && header.context != rns_wire::context::PacketContext::Keepalive + && let Some(delivery) = self.pending.get_mut(&link_id) + { + delivery.link.record_inbound_data(); + } match header.context { rns_wire::context::PacketContext::Lrproof @@ -5393,7 +5403,6 @@ fn drive_link_action( false } LinkAction::TransitionedToStale => { - // Python sends one more keepalive when an initiator transitions stale. send_keepalive_packet( transport_tx, pending_transport, @@ -5488,7 +5497,7 @@ fn send_link_close_payload( } fn link_data_idle_for(link: &Link) -> Duration { - link.no_data_for().min(link.no_outbound_for()) + link.no_data_for() } fn direct_link_idle_expired(delivery: &PendingDelivery) -> bool {