cultmesh-rs tests: the scripted peer starts a session only on a Connect

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-28 05:31:16 +01:00
commit d0a28918ce

View file

@ -95,9 +95,13 @@ fn serve(socket: UdpSocket, commands: Receiver<PeerCommand>, received: Sender<Cu
break found;
}
};
let Ok(packet) = decode_rudp_packet(&wire[..length]) else {
let _ = socket.recv_from(&mut wire);
continue;
// Only a Connect starts a session; whatever else is waiting (a dead session's pings and resends) is dropped.
let packet = match decode_rudp_packet(&wire[..length]) {
Ok(packet) if packet.packet_type == cultnet_rs::CultNetRudpPacketType::Connect => packet,
_ => {
let _ = socket.recv_from(&mut wire);
continue;
}
};
let mut session = CultNetRudpSocketTransportConnection::new(CultNetRudpSocketTransportOptions {
media_delivery: None,