Skip to main content

Module connection

Module connection 

Source

StructsΒ§

MuxConnection πŸ”’
QUIC path: one stream per protocol, each with its own writer task. send_queues and recv_queues are keyed by protocol id.
MuxStream πŸ”’
One QUIC protocol stream’s halves, returned from setup_quic_streams.
SingleConnection πŸ”’
TCP / TLS path: one shared writer drains send_queue; a single reader demuxes incoming PeerNetMsgs into the matching recv_queues.

ConstantsΒ§

RECV_QUEUE_SIZE πŸ”’
SEND_QUEUE_SIZE πŸ”’

TraitsΒ§

PeerConnection πŸ”’
Per-peer wire abstraction. Hides single-pipe (TCP/TLS) vs. stream-mux (QUIC) framing from the layers above.

FunctionsΒ§

broadcast_shutdown πŸ”’
Push ProtocolEvent::Shutdown into every recv queue, waking blocked recv callers.
build_recv_queues πŸ”’
One bounded recv queue per protocol id.
from_queued πŸ”’
Build the right PeerConnection for the post-handshake QueuedConn. Picks MuxConnection when QUIC is in use, SingleConnection otherwise.
setup_quic_streams πŸ”’
Open / accept one QUIC stream per negotiated protocol and return the per-stream send queues plus the reader/writer halves.
spawn_demux_reader πŸ”’
Spawn the single-pipe reader task. Reads PeerNetMsgs, routes Protocol payloads into the matching recv queue, signals the peer via stop_chan on Shutdown / error.
spawn_quic_reader πŸ”’
Spawn a per-stream QUIC reader task. The stream is already keyed by protocol id, so messages go straight into recv_queue.
spawn_writer_task πŸ”’
Spawn a task that drains queue into writer. Exits when the writer fails (peer hung up).