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>
bb10
Mårten Nordheim 2024-01-09 17:01:57 +01:00
parent 24a95c22fc
commit 88f5fc47eb
1 changed files with 3 additions and 1 deletions

View File

@ -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()