From a4c837b3a1168ab07415501f141395dfffc3ed18 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 20 Jan 2015 12:30:26 -0800 Subject: Fix QUdpSocket's emission of readyRead() The documentation says that QUdpSocket emits readyRead() only for one datagram and that if you don't read it, the class will not emit again. That should be implemented by disabling of the socket notifier once we have the datagram already read, but was broken. In turn, that breakage caused a live-lock of the event loop: since we didn't disable the notifier nor read the pending datagram, the event loop would fire every time for the same datagram. The re-enabling of the notifier was already working. Task-number: QTBUG-43857 Change-Id: Ic5d393bfd36e48a193fcffff13bb32ad390b5fe8 Reviewed-by: Peter Hartmann Reviewed-by: Richard J. Moore --- src/network/socket/qabstractsocket.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/network/socket') diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 604214ce8e..5a1ad40b90 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -740,8 +740,15 @@ bool QAbstractSocketPrivate::canReadNotification() return true; } - if ((isBuffered || socketType != QAbstractSocket::TcpSocket) && socketEngine) - socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable()); + if (socketEngine) { + // turn the socket engine off if we've either: + // - got pending datagrams + // - reached the buffer size limit + if (isBuffered) + socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable()); + else if (socketType != QAbstractSocket::TcpSocket) + socketEngine->setReadNotificationEnabled(!socketEngine->hasPendingDatagrams()); + } // reset the read socket notifier state if we reentered inside the // readyRead() connected slot. -- cgit v1.2.3 From 6a607aa7aa56ddf4323aa78d64925192494befb8 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 28 Jan 2015 10:44:38 +0100 Subject: Do not specifically mention features supported since XP We do not support Windows older versions in the first place ... Change-Id: I2cd3135f1b7f2dac6929c07624ea9373f4ac0ff1 Reviewed-by: Oswald Buddenhagen --- src/network/socket/qlocalsocket.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/network/socket') diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index 164117e84f..c1beedd53e 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -56,9 +56,6 @@ QT_BEGIN_NAMESPACE waitForReadyRead(), waitForBytesWritten(), and waitForDisconnected() which blocks until the operation is complete or the timeout expires. - \note This feature is not supported on versions of Windows earlier than - Windows XP. - \sa QLocalServer */ -- cgit v1.2.3