summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibHTTP/HttpsJob.cpp
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-10-04 15:14:36 +0330
committerAndreas Kling <kling@serenityos.org>2021-10-04 15:31:26 +0200
commit64e231bd389e0ac3afe72bf8189c703cabee8546 (patch)
tree4369825cdfcd256123e65f01f3ce75fb5968b05d /Userland/Libraries/LibHTTP/HttpsJob.cpp
parent29acb7fcf8993d96d7c776d6e60dbb7464d8ebad (diff)
downloadserenity-64e231bd389e0ac3afe72bf8189c703cabee8546.zip
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).
Diffstat (limited to 'Userland/Libraries/LibHTTP/HttpsJob.cpp')
-rw-r--r--Userland/Libraries/LibHTTP/HttpsJob.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibHTTP/HttpsJob.cpp b/Userland/Libraries/LibHTTP/HttpsJob.cpp
index cadfbea933..3464527590 100644
--- a/Userland/Libraries/LibHTTP/HttpsJob.cpp
+++ b/Userland/Libraries/LibHTTP/HttpsJob.cpp
@@ -43,6 +43,7 @@ void HttpsJob::start(NonnullRefPtr<Core::Socket> socket)
if (on_certificate_requested)
on_certificate_requested(*this);
};
+ m_socket->set_idle(false);
if (m_socket->is_established()) {
dbgln("Reusing previous connection for {}", url());
deferred_invoke([this] { on_socket_connected(); });
@@ -72,6 +73,7 @@ void HttpsJob::shutdown(ShutdownMode mode)
m_socket->on_tls_ready_to_read = nullptr;
m_socket->on_tls_connected = nullptr;
m_socket->set_on_tls_ready_to_write(nullptr);
+ m_socket->set_idle(true);
m_socket = nullptr;
}
}