From cbf4b60df6c6c8c7208dc29708677d24b2724deb Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Fri, 30 Oct 2026 13:17:39 +0100 Subject: Enforce the invariant that each socket is only ever expected to be read from or written to, never both --- opentracker.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'opentracker.c') diff --git a/opentracker.c b/opentracker.c index b54327a..27b2570 100644 --- a/opentracker.c +++ b/opentracker.c @@ -180,12 +180,11 @@ static void handle_write(const int64_t sock) { /* In a chunked transfer, wait for the next piece once everything queued has gone out */ if (chunked) - http_interest_drop(sock, cookie, EVENT_OUT); + http_interest_set(sock, cookie, 0); else if (keep_alive) { - /* The reply is out and the client asked to keep the connection, so stop - waiting to write and go back to waiting for the next request */ - http_interest_drop(sock, cookie, EVENT_OUT); - http_interest_add(sock, cookie, EVENT_IN); + /* The reply is out and the client asked to keep the connection, so go + back to waiting for the next request */ + http_interest_set(sock, cookie, EVENT_IN); fdstate_set_expiry(sock, time_future_seconds(OT_CLIENT_TIMEOUT)); } else http_close(sock); -- cgit v1.3