diff options
author | MÃ¥rten Nordheim <[email protected]> | 2024-01-09 17:01:57 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <[email protected]> | 2024-01-18 21:12:37 +0000 |
commit | db447658b45ef562ca4d277883abb0330b36c9b1 (patch) | |
tree | 80b58d4654e34489f10ab566f66386ff2ca07365 | |
parent | 57e98a41364dd9433bc8b18f7b8d1d21606c4cf0 (diff) |
Http: Start more connections faster after determining network layer
Previously we would more or less wait for the first connection to finish before
initiating more connections. This was just happening by virtue of
calling startNextRequest when a request was finished.
Since we have already determined the preferred network layer, let's just
try to start more connections. In case we are using https this doesn't
make a difference because we will try http2 upgrade first before allowing
multiple connections. Unless, of course, http2 has been disabled.
Fixes: QTBUG-120619
Pick-to: 6.5
Change-Id: Id3c3be59fd07120bff574d63481119e5ed9eb88a
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Timur Pocheptsov <[email protected]>
(cherry picked from commit 88f5fc47ebf558fa72b7b447f8394a0d44b6bf9d)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
(cherry picked from commit 0002ba47e63151e37c15b61f0c0b809aefb378e1)
-rw-r--r-- | src/network/access/qhttpnetworkconnectionchannel.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 02ba8aa168e..14b5b861b3b 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -856,6 +856,8 @@ void QHttpNetworkConnectionChannel::_q_connected() connection->d_func()->networkLayerState = QHttpNetworkConnectionPrivate::IPv6; } connection->d_func()->networkLayerDetected(networkLayerPreference); + if (connection->d_func()->activeChannelCount > 1 && !connection->d_func()->encrypt) + QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } else { bool anyProtocol = networkLayerPreference == QAbstractSocket::AnyIPProtocol; if (((connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv4) @@ -1242,7 +1244,6 @@ void QHttpNetworkConnectionChannel::_q_encrypted() emit pair.second->encrypted(); // In case our peer has sent us its settings (window size, max concurrent streams etc.) // let's give _q_receiveReply a chance to read them first ('invokeMethod', QueuedConnection). - QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } } else { // HTTP if (!reply) @@ -1255,6 +1256,7 @@ void QHttpNetworkConnectionChannel::_q_encrypted() if (reply) sendRequestDelayed(); } + QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } void QHttpNetworkConnectionChannel::requeueHttp2Requests() |