diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-05-14 02:16:57 +0300 |
|---|---|---|
| committer | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-05-14 10:04:56 +0300 |
| commit | 555ad5446199c9bd5258466f75e235d3efecbb84 (patch) | |
| tree | 94a9cb904d26c63226eb0476c7713fb62503c2ec /tests | |
| parent | a0985c42f307e5137f9afa57edae219f7300211b (diff) | |
| download | accel-ppp-555ad5446199c9bd5258466f75e235d3efecbb84.tar.gz accel-ppp-555ad5446199c9bd5258466f75e235d3efecbb84.zip | |
metrics: per-client read timeout and max-clients cap
A scrape client that opens a TCP connection and never sends a full
request line+headers used to keep its accel-pppd-side fd registered
indefinitely. Combined with the default `allowed_ips` (= allow all),
a single peer could exhaust the daemon's file descriptors
slowloris-style.
Give every accepted connection a triton timer armed for
`read_timeout` seconds (default 5). On expiry, disconnect_client()
tears down the fd, the timer, and the buffer. The timer is canceled
implicitly when the client is disconnected for any other reason
because disconnect_client() now deletes the timer before freeing the
client.
Also cap the number of in-flight clients at `max_clients`
(default 64). Excess connections are accepted and immediately
closed so the kernel listen backlog still drains.
Both knobs accept 0 to disable. The default values are documented in
accel-ppp.conf(5) alongside the existing [metrics] options.
Smoke-tested:
* a connection that sends nothing is dropped from the daemon's fd
table when read_timeout elapses; subsequent scrapes still
succeed;
* with max_clients=3 and five concurrent silent connections, the
daemon holds exactly three ESTAB sockets, the others are closed.
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions
