mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:57:47 +00:00
RequestServer: Ignore preconnect requests for available connections
There's no need to schedule a useless job when the connection is already there and established.
This commit is contained in:
parent
4974727dbb
commit
a3fe981daa
1 changed files with 4 additions and 3 deletions
|
@ -138,8 +138,7 @@ void ClientConnection::ensure_connection(URL const& url, ::RequestServer::CacheL
|
||||||
if (!is_tls && socket->is_connected())
|
if (!is_tls && socket->is_connected())
|
||||||
is_connected = true;
|
is_connected = true;
|
||||||
|
|
||||||
if (is_connected)
|
VERIFY(!is_connected);
|
||||||
return ConnectionCache::request_did_finish(m_url, socket);
|
|
||||||
|
|
||||||
bool did_connect;
|
bool did_connect;
|
||||||
if (is_tls) {
|
if (is_tls) {
|
||||||
|
@ -167,6 +166,8 @@ void ClientConnection::ensure_connection(URL const& url, ::RequestServer::CacheL
|
||||||
|
|
||||||
dbgln("EnsureConnection: Pre-connect to {}", url);
|
dbgln("EnsureConnection: Pre-connect to {}", url);
|
||||||
auto do_preconnect = [&](auto& cache) {
|
auto do_preconnect = [&](auto& cache) {
|
||||||
|
auto it = cache.find({ url.host(), url.port_or_default() });
|
||||||
|
if (it == cache.end() || it->value->is_empty())
|
||||||
ConnectionCache::get_or_create_connection(cache, url, job);
|
ConnectionCache::get_or_create_connection(cache, url, job);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue