summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2024-01-09 17:01:57 +0100
committerMårten Nordheim <marten.nordheim@qt.io>2024-01-18 14:18:00 +0100
commit88f5fc47ebf558fa72b7b447f8394a0d44b6bf9d (patch)
tree20ff36042c6ed9ea54322f1c6cfec590c0a0497c
parent24a95c22fc9f09ca4415946e965615d022704ca3 (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.7 6.6 6.5 Change-Id: Id3c3be59fd07120bff574d63481119e5ed9eb88a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 032a280467..6766989690 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)
@@ -1240,7 +1242,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)
@@ -1253,6 +1254,7 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
if (reply)
sendRequestDelayed();
}
+ QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
}
void QHttpNetworkConnectionChannel::requeueHttp2Requests()