diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2020-08-12 19:00:54 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2020-08-13 19:58:14 +0200 |
commit | 1a8627cf199e7435d02424f1959e090bae4e3409 (patch) | |
tree | 900bfd4cd3c2cbcb4ce3bea9cd8c284e4b114881 /src | |
parent | 7e55642c87b71fdc41f30a1770efc45597e85837 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/network/access/qhttpnetworkconnectionchannel.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index d305fae094..24720be7da 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -884,8 +884,11 @@ void QHttpNetworkConnectionChannel::_q_connected() } connection->d_func()->networkLayerDetected(networkLayerPreference); } else { - if (((connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv4) && (networkLayerPreference != QAbstractSocket::IPv4Protocol)) - || ((connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv6) && (networkLayerPreference != QAbstractSocket::IPv6Protocol))) { + bool anyProtocol = networkLayerPreference == QAbstractSocket::AnyIPProtocol; + if (((connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv4) + && (networkLayerPreference != QAbstractSocket::IPv4Protocol && !anyProtocol)) + || ((connection->d_func()->networkLayerState == QHttpNetworkConnectionPrivate::IPv6) + && (networkLayerPreference != QAbstractSocket::IPv6Protocol && !anyProtocol))) { close(); // 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); |