Flip T3 to substrate-initiated actuator commands

This commit is contained in:
Valère Plantevin
2026-05-13 15:03:23 -04:00
parent 272d3b3c59
commit baa075fe0f
22 changed files with 1003 additions and 749 deletions

View File

@@ -11,8 +11,8 @@ use std::time::Duration;
use anyhow::Result;
use simulator::client::SimulatorClient;
use substrate::config::QuicConfig;
use substrate::transport::server::{accept_loop, bind_endpoint};
use substrate::transport::{QuicMessage, SensorType, T1Sender, T2Sender, T3Sender};
use substrate::transport::server::{accept_loop, bind_endpoint, new_connection_registry};
use substrate::transport::{OutboundT3, QuicMessage, SensorType, T1Sender, T2Sender};
use tokio::sync::mpsc;
use uuid::Uuid;
@@ -31,6 +31,7 @@ fn loopback_config(cert: PathBuf, key: PathBuf) -> QuicConfig {
t1_capacity: 1024,
t2_capacity: 512,
t3_capacity: 256,
synthetic_t3_rate_hz: 0.0,
}
}
@@ -50,13 +51,17 @@ async fn t1_datagram_decoded_into_ecs_channel() -> Result<()> {
// demux pushes into the ECS bridge.
let (t1_tx, mut t1_rx) = mpsc::channel(64);
let (t2_tx, _t2_rx) = mpsc::channel(64);
let (t3_tx, _t3_rx) = mpsc::channel(64);
let (t3_out_tx, t3_out_rx) = mpsc::channel::<OutboundT3>(64);
let registry = new_connection_registry();
let server_task = tokio::spawn(accept_loop(
endpoint,
T1Sender::new(t1_tx),
T2Sender::new(t2_tx),
T3Sender::new(t3_tx),
registry,
t3_out_rx,
t3_out_tx,
0.0, // synthetic driver disabled
));
// Connect a client and send one datagram.
@@ -99,13 +104,17 @@ async fn t1_burst_preserves_order_and_count() -> Result<()> {
// T1 capacity 64 ≥ burst size 32 so nothing is dropped under loopback.
let (t1_tx, mut t1_rx) = mpsc::channel(64);
let (t2_tx, _t2_rx) = mpsc::channel(8);
let (t3_tx, _t3_rx) = mpsc::channel(8);
let (t3_out_tx, t3_out_rx) = mpsc::channel::<OutboundT3>(8);
let registry = new_connection_registry();
let server_task = tokio::spawn(accept_loop(
endpoint,
T1Sender::new(t1_tx),
T2Sender::new(t2_tx),
T3Sender::new(t3_tx),
registry,
t3_out_rx,
t3_out_tx,
0.0,
));
let client = SimulatorClient::connect(server_addr, "localhost", &cert).await?;