1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

RequestServer+LibProtocol: Make starting requests fully async

This makes it so the clients don't have to wait for RS to become
responsive, potentially allowing them to do other things while RS
handles the connections.
Fixes #23306.
This commit is contained in:
Ali Mohammad Pur 2024-02-24 14:36:57 +01:00 committed by Andreas Kling
parent 18d26142f0
commit 5232afa13d
26 changed files with 114 additions and 87 deletions

View file

@ -71,13 +71,15 @@ void request_did_finish(URL const& url, Core::Socket const* socket)
connection->job_data.fail(Core::NetworkJob::Error::ConnectionFailed);
return;
}
Core::deferred_invoke([&, url] {
dbgln_if(REQUESTSERVER_DEBUG, "Running next job in queue for connection {} @{}", &connection, connection->socket);
connection->timer.start();
connection->current_url = url;
connection->job_data = connection->request_queue.take_first();
connection->socket->set_notifications_enabled(true);
connection->job_data.start(*connection->socket);
connection->has_started = true;
Core::deferred_invoke([&connection = *connection, url] {
dbgln_if(REQUESTSERVER_DEBUG, "Running next job in queue for connection {}", &connection);
connection.timer.start();
connection.current_url = url;
connection.job_data = connection.request_queue.take_first();
connection.socket->set_notifications_enabled(true);
connection.job_data.start(*connection.socket);
});
}
};