From 0bd368691eb0d9051725d76b2a3721bb902c919b Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 31 Oct 2026 16:34:30 +0100 Subject: Make the mainloop behave like every worker by claiming and releasing a socket being worked on --- opentracker.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opentracker.c b/opentracker.c index e5efff5..6e073e9 100644 --- a/opentracker.c +++ b/opentracker.c @@ -137,12 +137,14 @@ static void *server_mainloop(void *args) { else if ((intptr_t)cookie == FLAG_SELFPIPE) while (read((int)sock, ws.inbuf, G_INBUF_SIZE) > 0) ; - else { + else if (fdstate_claim((int)sock, ready[i].generation)) { if (ready[i].what & EVENT_IN) tcp_read(sock, &ws); /* The read may have closed it, so look again before writing */ if ((ready[i].what & EVENT_OUT) && fdstate_generation((int)sock) == ready[i].generation) tcp_write(sock); + if (fdstate_generation((int)sock) == ready[i].generation) + fdstate_release((int)sock); } } -- cgit v1.3