Skip to main content

Module server

Module server 

Source

Structs§

ServerAuth
Authentication material and DoS bounds applied before a TCP connection may reach the frame router.

Enums§

ConnectionError
ServerError

Constants§

CONNECTION_EGRESS_BYTE_BUDGET
Bytes (envelope header plus body) one connection’s egress queue may hold before a non-waiting enqueue is refused, which closes that connection.
CONNECTION_EGRESS_FRAME_CAP
Frame-count backstop for the same queue (the tokio channel’s capacity). The byte budget is the real bound; this one only matters for floods of tiny or empty frames, which cost bookkeeping per frame rather than bytes. 32,768 frames times 128 bytes is exactly the 4 MiB budget, so for any mean frame of 128 bytes or more the byte budget binds first; below that (for example 21-byte empty frames, of which 4 MiB would be almost 200,000) the count does. The channel allocates slots lazily, so a large capacity costs nothing until it is used.
DEFAULT_AUTH_DEADLINE
DEFAULT_MAX_UNAUTHENTICATED_CONNECTIONS
MAX_PENDING_ROUTE_OPENS_PER_CONNECTION
A pending route.open holds one reserved slot in the connection’s egress queue until its module answers, and its response is sent outside the byte budget. Eight concurrent opens per connection keep a reconnect burst parallel while bounding both the reserved slots and the bytes that bypass the budget.

Functions§

handle_connection
Run the authenticated frame read -> route loop for one connection.
serve_listener
Serve an already-bound TCP listener. Each accepted connection gets its own async task so concurrent clients do not block the accept loop.
serve_listeners
Serve all already-bound loopback TCP listeners until one accept loop fails.