h1_acceptor (h1 v0.2.0)

View Source

HTTP/1.1 acceptor loop.

One lightweight process per acceptor. Blocks on accept against a shared listen socket, spawns a server loop for each accepted connection, and transfers socket ownership to it.

The TLS handshake runs inside the server-loop process (not here) so one slow handshake never blocks the accept queue.

Summary

Types

args/0

-type args() ::
          #{transport := transport(),
            listen_socket := term(),
            handler := term(),
            conn_opts := map(),
            server_opts := map()}.

transport/0

-type transport() :: gen_tcp | ssl.

Functions

loop(Args)

-spec loop(args()) -> no_return().

start_link(Args)

-spec start_link(args()) -> {ok, pid()}.