From 58e4bbc83f4cd9ee2b87eff34403ac52b069aa1f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 11 Mar 2015 19:53:18 -0700 Subject: [PATCH] tst_QUdpSocket: send two bytes in a datagram I'm getting an error with WSARecvFrom in nativeBytesAvailable() and I don't know why. The number of bytes obtained is correct and the test works for 2 bytes, so let's use that. The Windows nativeBytesAvailable() function has a comment saying that WSAIoctl sometimes indicates 1 byte available when there's a pending error notification, so that function proceeds to do a WSARecvFrom to peek the number of bytes. Somehow that function in this test is getting a SOCKET_ERROR I can't explain. Change-Id: Ic5b19e556e572a72a9df9a405b1fee3b7efb8b24 Reviewed-by: Richard J. Moore --- tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 8de9987ed1..080f763f54 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -1574,7 +1574,7 @@ void tst_QUdpSocket::readyRead() QSignalSpy spy(&receiver, SIGNAL(readyRead())); // send a datagram to that port - sender.writeDatagram("a", makeNonAny(receiver.localAddress()), port); + sender.writeDatagram("aa", makeNonAny(receiver.localAddress()), port); // wait a little // if QTBUG-43857 is still going, we'll live-lock on socket notifications from receiver's socket @@ -1583,8 +1583,8 @@ void tst_QUdpSocket::readyRead() // make sure only one signal was emitted QCOMPARE(spy.count(), 1); QVERIFY(receiver.hasPendingDatagrams()); - QCOMPARE(receiver.bytesAvailable(), qint64(1)); - QCOMPARE(receiver.pendingDatagramSize(), qint64(1)); + QCOMPARE(receiver.bytesAvailable(), qint64(2)); + QCOMPARE(receiver.pendingDatagramSize(), qint64(2)); // write another datagram sender.writeDatagram("ab", makeNonAny(receiver.localAddress()), port); @@ -1594,7 +1594,7 @@ void tst_QUdpSocket::readyRead() QCOMPARE(spy.count(), 1); QVERIFY(receiver.hasPendingDatagrams()); QVERIFY(receiver.bytesAvailable() >= 1); // most likely is 1, but it could be 1 + 2 in the future - QCOMPARE(receiver.pendingDatagramSize(), qint64(1)); + QCOMPARE(receiver.pendingDatagramSize(), qint64(2)); // read all the datagrams (we could read one only, but we can't be sure the OS is queueing) while (receiver.hasPendingDatagrams())