Don't bind to QHostAddress::Any if we want to do IPv4 multicast ops

Linux gracefully allows us to do that and treat the v6 socket as if it
were v4. Other OS (notably OS X) aren't so forgiving.

Change-Id: I13dd3274be2a4b13e8b1eef93cbc2dd17b648f96
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
Thiago Macieira 2014-12-24 17:01:01 -02:00 committed by Tony Sarajärvi
parent 4560ce4ec6
commit b699ac070c

View File

@ -1062,7 +1062,7 @@ void tst_QUdpSocket::multicastTtlOption_data()
QTest::addColumn<int>("expected");
QList<QHostAddress> addresses;
addresses += QHostAddress(QHostAddress::Any);
addresses += QHostAddress(QHostAddress::AnyIPv4);
addresses += QHostAddress(QHostAddress::AnyIPv6);
foreach (const QHostAddress &address, addresses) {
@ -1103,7 +1103,7 @@ void tst_QUdpSocket::multicastLoopbackOption_data()
QTest::addColumn<int>("expected");
QList<QHostAddress> addresses;
addresses += QHostAddress(QHostAddress::Any);
addresses += QHostAddress(QHostAddress::AnyIPv4);
addresses += QHostAddress(QHostAddress::AnyIPv6);
foreach (const QHostAddress &address, addresses) {
@ -1216,7 +1216,7 @@ void tst_QUdpSocket::setMulticastInterface()
// bind initializes the socket
bool bound = udpSocket.bind((address.protocol() == QAbstractSocket::IPv6Protocol
? QHostAddress(QHostAddress::AnyIPv6)
: QHostAddress(QHostAddress::Any)),
: QHostAddress(QHostAddress::AnyIPv4)),
0);
if (!bound)
QTest::ignoreMessage(QtWarningMsg, "QUdpSocket::setMulticastInterface() called on a QUdpSocket when not in QUdpSocket::BoundState");