Silence warning in tst_QUdpSocket::multicast for Any+IPv4
QUdpSocket doesn't support binding to QHostAddress::Any and then joining an IPv4 multicat group since QHostAddress::Any is really an IPv6 socket with v6only = false. The test did check this case, but failed to ignore the warning. Change-Id: I62d782408319a6e566e0ff1a6081b706ac1f669c Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
parent
14c5f149cd
commit
98a7497d74
@ -641,8 +641,8 @@ bool QNativeSocketEngine::joinMulticastGroup(const QHostAddress &groupAddress,
|
||||
if (groupAddress.protocol() == QAbstractSocket::IPv4Protocol &&
|
||||
(d->socketProtocol == QAbstractSocket::IPv6Protocol ||
|
||||
d->socketProtocol == QAbstractSocket::AnyIPProtocol)) {
|
||||
qWarning("QAbstractSocket: cannot bind to QHostAddress::Any (or an IPv6 address) and join an IPv4 multicast group");
|
||||
qWarning("QAbstractSocket: bind to QHostAddress::AnyIPv4 instead if you want to do this");
|
||||
qWarning("QAbstractSocket: cannot bind to QHostAddress::Any (or an IPv6 address) and join an IPv4 multicast group;"
|
||||
" bind to QHostAddress::AnyIPv4 instead if you want to do this");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1249,7 +1249,7 @@ void tst_QUdpSocket::multicast_data()
|
||||
QTest::newRow("same bind, group ipv4 address") << groupAddress << true << groupAddress << true;
|
||||
QTest::newRow("valid bind, group ipv6 address") << any6Address << true << group6Address << true;
|
||||
QTest::newRow("valid bind, invalid group ipv6 address") << any6Address << true << any6Address << false;
|
||||
QTest::newRow("same bind, group ipv6 address") << group6Address << true << group6Address << true;
|
||||
QTest::newRow("same bind, group ipv6 address") << group6Address << false << group6Address << false;
|
||||
QTest::newRow("dual bind, group ipv4 address") << dualAddress << true << groupAddress << false;
|
||||
QTest::newRow("dual bind, group ipv6 address") << dualAddress << true << group6Address << true;
|
||||
}
|
||||
@ -1279,6 +1279,12 @@ void tst_QUdpSocket::multicast()
|
||||
if (!bindResult)
|
||||
return;
|
||||
|
||||
if (bindAddress == QHostAddress::Any && groupAddress.protocol() == QAbstractSocket::IPv4Protocol) {
|
||||
QCOMPARE(joinResult, false);
|
||||
QTest::ignoreMessage(QtWarningMsg,
|
||||
"QAbstractSocket: cannot bind to QHostAddress::Any (or an IPv6 address) and join an IPv4 multicast group;"
|
||||
" bind to QHostAddress::AnyIPv4 instead if you want to do this");
|
||||
}
|
||||
QVERIFY2(receiver.joinMulticastGroup(groupAddress) == joinResult,
|
||||
qPrintable(receiver.errorString()));
|
||||
if (!joinResult)
|
||||
|
Loading…
x
Reference in New Issue
Block a user