summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/socket/qudpsocket
diff options
context:
space:
mode:
authorRobin Burchell <robin+qt@viroteck.net>2012-03-30 16:23:24 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-02 12:49:38 +0200
commitc82d40749dc1ce816333e84d7f3232e59fbe2058 (patch)
tree340231cf80134be4ac7b3b82cbd522ec320a3e5d /tests/auto/network/socket/qudpsocket
parentc7f8f459bd9bb388aa06d2fb4564012d3eec3906 (diff)
Fix multicast join/leave when binding to QHostAddress::Any.
On OS X and Windows, this was not working, because the socket was being bound in v6 mode (due to ::Any being for dual mode), but the address passed was a v4 address, meaning it took the wrong codepath. Linux, strangely, apparently works anyway. This is fixable in OS X (by using the v6 join path when bound in v6/dual mode), but the same fix doesn't work on Windows, failing with WSAEADDRNOTAVAIL. Don't allow this behaviour, and provide a sane error message telling the user what to do instead. Done-with: Shane Kearns Task-number: QTBUG-25047 Change-Id: Iaf5bbee82e13ac92e11b60c558f5af9ce26f474b Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'tests/auto/network/socket/qudpsocket')
-rw-r--r--tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
index c53450eec6..f63c593f91 100644
--- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
@@ -1202,6 +1202,7 @@ void tst_QUdpSocket::multicast_data()
QHostAddress groupAddress = QHostAddress("239.255.118.62");
QHostAddress any6Address = QHostAddress(QHostAddress::AnyIPv6);
QHostAddress group6Address = QHostAddress("FF01::114");
+ QHostAddress dualAddress = QHostAddress(QHostAddress::Any);
QTest::addColumn<QHostAddress>("bindAddress");
QTest::addColumn<bool>("bindResult");
@@ -1213,6 +1214,8 @@ void tst_QUdpSocket::multicast_data()
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("dual bind, group ipv4 address") << dualAddress << true << groupAddress << false;
+ QTest::newRow("dual bind, group ipv6 address") << dualAddress << true << group6Address << true;
}
void tst_QUdpSocket::multicast()