Expand description
io_uring-based multiplexed reader with multishot RECV.
Uses IORING_OP_RECV with IORING_RECV_MULTISHOT — a single SQE per
connection produces multiple CQEs as data arrives, eliminating the
resubmission overhead of standard RECV. Combined with a ring-mapped
provided-buffer ring (IOSQE_BUFFER_SELECT + buf_ring), the kernel
selects a buffer from a shared pool for each recv, and consumed
buffers are recycled with a shared-memory store — no per-recv
ProvideBuffers SQE/CQE round trip. Requires kernel ≥ 5.19.
Uses a single reader thread — io_uring is efficient enough for hundreds of connections. New connections are registered via eventfd wakeup.
Connection state is stored in a slab (index-stable Vec) so that io_uring user_data carries a slab index, not an fd. This avoids fd-reuse races where a recycled fd number could match a stale CQE.
Structs§
- Reader
Registration - Command sent from the accept loop to a reader thread.
- Uring
Reader Handle - Handle for the accept loop to register connections with the io_uring reader.
Functions§
- spawn_
reader - Spawn the io_uring reader thread. Returns a handle for registering connections.
Type Aliases§
- Request
Decoder Arc - Decoder type alias: request decoder bound to the application’s
Eventtype. Mirrorscrate::response::ResponseEncoderArc; hides thedyn RequestDecoder<Event = …>spelling at call sites that thread the decoder through several functions.