1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:57:35 +00:00

LibHTTP+LibGemini: Set underlying sockets as idle when detaching

This ultimately makes the sockets not spin while unused (particularly in
the 10s shutdown period that RequestServer's cache has).
This commit is contained in:
Ali Mohammad Pur 2021-10-04 15:14:36 +03:30 committed by Andreas Kling
parent 29acb7fcf8
commit 64e231bd38
3 changed files with 6 additions and 0 deletions

View file

@ -22,6 +22,7 @@ void HttpJob::start(NonnullRefPtr<Core::Socket> socket)
did_fail(Core::NetworkJob::Error::ConnectionFailed);
});
};
m_socket->set_idle(false);
if (m_socket->is_connected()) {
dbgln("Reusing previous connection for {}", url());
deferred_invoke([this] {
@ -52,6 +53,7 @@ void HttpJob::shutdown(ShutdownMode mode)
} else {
m_socket->on_ready_to_read = nullptr;
m_socket->on_connected = nullptr;
m_socket->set_idle(true);
m_socket = nullptr;
}
}