From b9d2d1b478a947fd1152d62786abce0711bd862a Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Sat, 2 Mar 2024 17:43:04 +0100 Subject: [PATCH] LibHTTP: Disable finish repeat timer before deferring job completion It was possible to reach this via the timer itself (when the client is only slightly busy), and then to have the timer fire before the deferred invocation fires. This commit removes the race by disabling the timer when the final deferred-accept state is reached. --- Userland/Libraries/LibHTTP/Job.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Userland/Libraries/LibHTTP/Job.cpp b/Userland/Libraries/LibHTTP/Job.cpp index 99e6ab4f4f3..ba8f4c497c7 100644 --- a/Userland/Libraries/LibHTTP/Job.cpp +++ b/Userland/Libraries/LibHTTP/Job.cpp @@ -621,6 +621,7 @@ void Job::finish_up() return; } + stop_timer(); m_has_scheduled_finish = true; auto response = HttpResponse::create(m_code, move(m_headers), m_received_size); deferred_invoke([this, response = move(response)] {