diff options
| author | eunhhu <[email protected]> | 2026-09-26 10:46:30 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-26 10:46:30 +0100 |
| commit | 2827b23a1ec319d6a70eadccfa45cb5b7d8c83cc (patch) | |
| tree | 216e26dc38493031d6828ad9eecbe7c76c8906d8 /prototypes/connections | |
| parent | 0c47bc2bc2497771740410bcd965d4d4fd0e3524 (diff) | |
| download | pure-2827b23a1ec319d6a70eadccfa45cb5b7d8c83cc.tar.gz pure-2827b23a1ec319d6a70eadccfa45cb5b7d8c83cc.zip | |
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.
Diffstat (limited to 'prototypes/connections')
| -rw-r--r-- | prototypes/connections/serve.c | 1 |
1 files changed, 1 insertions, 0 deletions
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) { |
