Expand description
The listeners and connection loops.
Server::setup binds the listener (and, in the http1 build, creates the
thread pool); then Server::run (http1), run_tls (TLS with HTTP/2 via
ALPN, or plain HTTP/1.1 without a certificate), run_quic (HTTP/3) and
run_redirect (HTTP → HTTPS) accept connections, parse requests and hand
them to your Application.
ConnectionInfo carries the client and server addresses and the TLS SNI
name. Examples: src/server/example/.
Modules§
- per_
core - Per-core runtimes (
RWS_CONFIG_RUNTIME=per-core, Unix only): one single-threaded tokio runtime per core, each accepting on its ownSO_REUSEPORTsocket, the way nginx runs one worker per core. A connection stays on the thread the kernel gave it to, so there’s no work stealing, no cross-thread wake-ups and no idle workers searching for work.
Structs§
- Address
- IP address and port pair.
- Connection
Info - Network context for the current connection, passed into every
Controller. - Server
Constants§
- REQUEST_
HEAD_ TIMEOUT - Longest time from the first byte of a request head to its end (nginx’s
client_header_timeout). The idle timeout alone restarts on every read, so a client sending one byte every few seconds could hold a connection for weeks with a 64 KiB head.
Functions§
- request_
shutdown - Shut the server down gracefully, as SIGTERM does — for hosts that stop a
process some other way (a Windows service’s Stop control). The accept
loops of
run_tls,run_plain,run_quicandrun_redirectend.