summaryrefslogtreecommitdiffstats
path: root/src/network/socket
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2015-04-14 11:30:15 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2015-11-19 14:58:11 +0000
commit3d93fb077109e2190ca5f2c7ad04a46768ccad50 (patch)
treec225fe32b73dd5d9be3726ab6bb7013df5e4fc16 /src/network/socket
parent208496091d994c2ffe44ea41368fb659978c1581 (diff)
QAbstractSocket: simplify a check for data availability
We know that the QAbstractSocketPrivate::canReadNotification() slot is called by the engine's read notifier only when new data is available for reading, or when the socket has been closed. This allows us to remove additional checks for engine validity and data availability for unbuffered sockets. Change-Id: Ic278cf2214d418d8fe471ea24a765b8d5840b0a5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/socket')
-rw-r--r--src/network/socket/qabstractsocket.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 08ccff83fa..ed86dbbbae 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -723,14 +723,7 @@ bool QAbstractSocketPrivate::canReadNotification()
}
// Only emit readyRead() if there is data available.
- bool hasData = newBytes > 0
-#ifndef QT_NO_UDPSOCKET
- || (!isBuffered && socketType != QAbstractSocket::TcpSocket && socketEngine && socketEngine->hasPendingDatagrams())
-#endif
- || (!isBuffered && socketType == QAbstractSocket::TcpSocket && socketEngine)
- ;
-
- if (hasData)
+ if (newBytes > 0 || !isBuffered)
emitReadyRead();
// If we were closed as a result of the readyRead() signal,