QNAM: Don't close the connection due to not having a layer preference

This seems to only be happening when we have a single channel because
otherwise it will try IPv4 in one channel and IPv6 in the second.

Change-Id: I0d513e25fefffeabfc733e895827aa12da335ef9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Mårten Nordheim 2020-08-12 19:00:54 +02:00
parent 7e55642c87
commit 1a8627cf19

View File

@ -884,8 +884,11 @@ void QHttpNetworkConnectionChannel::_q_connected()
} }
connection->d_func()->networkLayerDetected(networkLayerPreference); connection->d_func()->networkLayerDetected(networkLayerPreference);
} else { } else {
if (((connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv4) && (networkLayerPreference != QAbstractSocket::IPv4Protocol)) bool anyProtocol = networkLayerPreference == QAbstractSocket::AnyIPProtocol;
|| ((connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv6) && (networkLayerPreference != QAbstractSocket::IPv6Protocol))) { if (((connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv4)
&& (networkLayerPreference != QAbstractSocket::IPv4Protocol && !anyProtocol))
|| ((connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv6)
&& (networkLayerPreference != QAbstractSocket::IPv6Protocol && !anyProtocol))) {
close(); close();
// This is the second connection so it has to be closed and we can schedule it for another request. // This is the second connection so it has to be closed and we can schedule it for another request.
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);