From fa0851180437cc5ba087e23c64f78286077a5c2a Mon Sep 17 00:00:00 2001 From: mnovak Date: Fri, 4 Dec 2026 12:56:44 +0100 Subject: [PATCH] [domistream] ENet: take VERIFY_CONNECT's session ids as stock ENet does (incoming = verify.incoming) The client stored them the other way round (out_session from verify.incoming_session_id). Against a fresh stock slot both are 0, so it never showed; after a reconnect stock ENet answers with two different ids and the client would send with the host's outgoing id and drop every host datagram. Found by the ENet host engineer; facts from stock ENet v1.3.18 as logged in S-17/S-34 (PROTOCOL.md 3.1), no new source read. --- crates/domistream/src/enet/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/domistream/src/enet/mod.rs b/crates/domistream/src/enet/mod.rs index 76a42e3..b0499de 100644 --- a/crates/domistream/src/enet/mod.rs +++ b/crates/domistream/src/enet/mod.rs @@ -333,8 +333,10 @@ impl EnetClient { } if self.state == EnetState::Connecting && p.connect_id == self.connect_id { self.host_peer_id = p.outgoing_peer_id & protocol::MAX_PEER_ID; - self.out_session = p.incoming_session_id & 0x3; - self.in_session = p.outgoing_session_id & 0x3; + // Both ids are given from the client's point of view (PROTOCOL.md 3.1 [E]): the incoming one is + // what the host sends with, the outgoing one what we send with. + self.in_session = p.incoming_session_id & 0x3; + self.out_session = p.outgoing_session_id & 0x3; let count = u8::try_from(p.channel_count.clamp(1, 255)).unwrap_or(1); self.channel_count = self.channel_count.min(count); let mtu = usize::try_from(p.mtu).unwrap_or(MAX_DATAGRAM_BYTES);