COORDS_PRESENT warmup-then-reactive for DataPackets

Include source and destination coordinates on the first N DataPackets
of each session (default 5, configurable via
node.session.coords_warmup_packets). This warms transit node
coord_caches so multi-hop forwarding and error signal routing work
after SessionSetup cache entries expire.

On CoordsRequired receipt, reset the counter to re-enable coordinate
inclusion for the next N packets, handling mid-session cache expiry
and path changes.

Changes:
- SessionConfig: add coords_warmup_packets field (default 5)
- SessionEntry: add coords_warmup_remaining counter, initialized on
  Established transition (both initiator and responder paths)
- send_session_data(): attach coords via DataPacket::with_coords()
  while counter > 0, decrement per send
- handle_coords_required(): reset counter for affected session
- 4 new unit tests for counter lifecycle and config default
This commit is contained in:
Johnathan Corgan
2026-02-16 23:28:24 +00:00
parent f374370e5c
commit 1f60fbd7a2
4 changed files with 135 additions and 2 deletions
+7
View File
@@ -231,6 +231,11 @@ pub struct SessionConfig {
/// Established sessions with no activity for this duration are removed.
#[serde(default = "SessionConfig::default_idle_timeout_secs")]
pub idle_timeout_secs: u64,
/// Number of initial DataPackets per session that include COORDS_PRESENT
/// for transit cache warmup (`node.session.coords_warmup_packets`).
/// Also used as the reset count on CoordsRequired receipt.
#[serde(default = "SessionConfig::default_coords_warmup_packets")]
pub coords_warmup_packets: u8,
}
impl Default for SessionConfig {
@@ -240,6 +245,7 @@ impl Default for SessionConfig {
pending_packets_per_dest: 16,
pending_max_destinations: 256,
idle_timeout_secs: 90,
coords_warmup_packets: 5,
}
}
}
@@ -249,6 +255,7 @@ impl SessionConfig {
fn default_pending_packets_per_dest() -> usize { 16 }
fn default_pending_max_destinations() -> usize { 256 }
fn default_idle_timeout_secs() -> u64 { 90 }
fn default_coords_warmup_packets() -> u8 { 5 }
}
/// Internal buffers (`node.buffers.*`).