Expand description
Connection pool for the capture proxy.
Sits in front of the DNS/TCP/TLS/handshake path. Before opening a fresh
connection to an upstream, forward_request asks the pool whether we
already have a working connection to (host, port, protocol). If yes,
we reuse it and skip all handshake phases — DNS, TCP, TLS, and HTTP/2’s
SETTINGS frame exchange — because the underlying transport is already
established. If no, we fall through to the existing “fresh connection”
path AND cache the resulting connection for the next request to the
same upstream.
Currently pools two connection types:
- HTTP/2
SendRequesthandles (cheap to clone; one handle per host can service unlimited concurrent streams via multiplexing). - HTTP/1.1 keep-alive
TcpStream/TlsStream— one stream per host for sequential reuse.
Entries auto-evict after IDLE_TIMEOUT of unused time.
Structs§
- Connection
Pool - Thread-safe connection pool shared across concurrent
forward_requesttasks. Cloneable — internal state lives behind anArc<Mutex<...>>so cloning is cheap (bumps the ref-count).
Type Aliases§
- Pooled
H2Sender - The type stored per host in the HTTP/2 pool.
SendRequestisClone(it’s just a channel handle into the shared connection driver task), so we can hand out a fresh clone to every caller and multiplex requests over the same underlying TCP+TLS session for free.