Expand description
Reader/writer task split helpers.
Splitting the per-peer endpoint into two cooperating Tokio tasks lets inbound decoding and outbound serialization overlap, removing the head-of-line blocking that the unified-loop design has under load.
This module ships the orchestrator that the EndpointManager
plugs into. It does not own a transport — instead it accepts a
RawTransport adapter so the same shape works for TcpTransport
today and for the TLS variant once 5.E lands the wire integration.
Both tasks are tokio::spawn-ed; the orchestrator returns a
ReaderWriterHandle that gives access to the outbound tx,
the inbound rx, and a JoinHandle for shutdown coordination.
Structs§
- Reader
Writer Handle - Handle returned by
spawn_reader_writer. The orchestrator surfaces the outboundtx, the inboundrx, and per-taskJoinHandles so the manager canawaitclean shutdown.
Traits§
- RawTransport
- Trait the orchestrator drives. The transport produces inbound
frames on
recvand accepts outbound frames onsend. Either end signals graceful shutdown by returningNone(read EOF) orErr(_)(write failure) — the orchestrator stops both tasks.
Functions§
- spawn_
reader_ writer - Spawn a reader/writer pair around
transport. The reader pumps inbound frames into atokio::mpscchannel; the writer drains the outbound channel onto the wire. Either failure stops both.