From 2827b23a1ec319d6a70eadccfa45cb5b7d8c83cc Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sat, 26 Sep 2026 10:46:30 +0100 Subject: Count a connection's deadline from its last progress pure-serve renewed a connection's deadline when a request arrived or an answer finished, not while an answer was being sent, so a client that read a large answer steadily but slowly was cut off after ten seconds (a 1 MiB document over a 50 KB/s link never arrived). Every write that makes progress now renews it; only a stalled connection expires. --- prototypes/connections/serve.c | 1 + 1 file changed, 1 insertion(+) (limited to 'prototypes/connections/serve.c') diff --git a/prototypes/connections/serve.c b/prototypes/connections/serve.c index b6d6b26..a3e991f 100644 --- a/prototypes/connections/serve.c +++ b/prototypes/connections/serve.c @@ -360,6 +360,7 @@ static void drive(Connection *c) { if (n < 0 && errno == EAGAIN) { c->writable = false; return; } if (n < 0 && errno == EINTR) continue; if (n < 0) { close_connection(c); return; } + c->deadline = now_ms() + c->host->timeout_ms; /* a slow reader is fine while it reads */ for (size_t sent = (size_t)n; c->out_at < c->out_count;) { struct iovec *v = &c->out[c->out_at]; if (sent < v->iov_len) { -- cgit v1.2.3