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>
This commit is contained in:
parent
208496091d
commit
3d93fb0771
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user