diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-05-14 02:29:44 +0300 |
|---|---|---|
| committer | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-05-14 10:04:56 +0300 |
| commit | 391edc5c59b4c66ef97ef435a64eff4f68c32e63 (patch) | |
| tree | 7e18c098c763a164f2d64900ca3880050027bea4 /tests | |
| parent | 0197e6e96ea391d6b44e9440f2add84a5dc70645 (diff) | |
| download | accel-ppp-391edc5c59b4c66ef97ef435a64eff4f68c32e63.tar.gz accel-ppp-391edc5c59b4c66ef97ef435a64eff4f68c32e63.zip | |
metrics: queue partial response writes
write_all() previously did a blocking-style loop on a O_NONBLOCK
socket and bailed on the first EAGAIN. With a slow scrape client or
a small kernel send buffer that meant the response was truncated and
the connection dropped mid-flight.
Allocate one contiguous xmit_buf per response holding header + body,
then drain it in xmit_flush():
* full write → mark the client for disconnect on the next event
loop tick;
* EAGAIN/EWOULDBLOCK → enable MD_MODE_WRITE so cln_write() resumes
the drain when the socket becomes writable;
* hard error → mark for disconnect, caller tears down.
cln_read() now stops reading once a response is queued (read events
during the response phase are uninteresting since we'll close on
flush), and cln_write() finishes the drain and disconnects when the
last byte is out. The existing per-client read timer doubles as a
write deadline, so a peer that opens the connection and never reads
still gets cleaned up after read_timeout seconds.
Smoke-tested with a python client that uses SO_RCVBUF=256 and
sleep(0.05) between recv()s — it now reads the entire ~2.8 KiB body
across many short reads. Five concurrent slow readers plus a fast
scrape all complete successfully.
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions
