From 03d044b88dd1377281caa44c0133d9f22579ba90 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 28 Nov 2026 22:16:45 +0100 Subject: Add a generation to a task on the workqueue to prevent its result being sent to the next client reusing the fd --- DESIGN | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'DESIGN') diff --git a/DESIGN b/DESIGN index 480aa9b..2e1883e 100644 --- a/DESIGN +++ b/DESIGN @@ -57,6 +57,13 @@ A socket is read or written, never both. http_interest_set replaces an add-and-drop pair so that the invariant cannot be broken by accident, and the event layer hears about a change once instead of twice. +A task belongs to a connection, not to a descriptor number. The queue files +it under the number, and the kernel hands that number to the next connection +the moment this one closes. So a connection that is owed an answer is not +read from, closing it cancels every task filed under its number, and a result +carries the generation the descriptor had when the task was pushed, which the +main loop holds against the current one before it sends anything. + Accept waits until the client's request has arrived: TCP_DEFER_ACCEPT on Linux, the accf_data filter on FreeBSD. Measured against a flood of silent connections, the filter serves more requests than no filter, not fewer, so it -- cgit v1.3