In handle_incoming() (session.rs:267-269), if a peer tries to connect while one is already active:
if state.session.lock().await.is_some() {
return Ok(()); // Silent return, connection not acknowledged
}
This causes:
- Connection hangs: The initiator sends HANDSHAKE_INIT and waits for ACK indefinitely
- No protocol error: The peer never sends back an error, just closes the stream
- User confusion: Both users think they're waiting for a response
Scenario:
- Alice and Bob already have a session
- Charlie tries to connect to Alice at the same time Bob sends a message
- Charlie's HANDSHAKE_INIT is dropped, Charlie hangs
- Alice sees no indication of the failed connection attempt
Proposed solution:
- Send an explicit protocol error (e.g., type="err", code="session_active")
- Or: Support multiple concurrent sessions (complex, but aligns with group chat)
- Track and log failed connection attempts for user visibility
In handle_incoming() (session.rs:267-269), if a peer tries to connect while one is already active:
This causes:
Scenario:
Proposed solution: