rouse-context/core
Jason Monk da28a140b0 Fix TLS handshake: handle multi-record mux DATA frames, use Channel.receive()
Two bugs prevented the TLS handshake from completing:

1. TlsAcceptor NEED_UNWRAP always called stream.read() even when netIn
   already had data from a previous read. When the client sends
   ClientKeyExchange + ChangeCipherSpec + Finished in a single mux DATA
   frame, the first unwrap consumed part of it, the loop hit NEED_UNWRAP
   again and blocked on stream.read() forever. Fix: only read from the
   stream when netIn is empty.

2. MuxStreamImpl.read() used flow.first() which throws
   NoSuchElementException on empty flow completion. Changed to
   Channel.receive() which throws ClosedReceiveChannelException with a
   clearer error message.

Verified: full TLS handshake completes end-to-end through the relay
passthrough to the device (CN=main-board.rousecontext.com, TLSv1.2).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 15:15:56 -04:00
..
bridge Extract core:bridge module for TLS accept + MCP session bridging 2026-04-06 14:22:37 -04:00
mcp Wire mux OPEN frames to TLS accept and MCP HTTP server 2026-04-06 13:51:35 -04:00
tunnel Fix TLS handshake: handle multi-record mux DATA frames, use Channel.receive() 2026-04-06 15:15:56 -04:00