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);