QSocks5SocketEngine: stop polling on UDP
There is no need in additional polling, because readyRead() signal of the inner socket is directly connected to the slot which extracts the datagrams. Moreover, calling _q_udpSocketReadNotification() from the engine code might cause the spurious notifications both in the outer and inner sockets. Change-Id: Ibe75f5990e27b7460d628fa4a1ca4e64657e302c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
dd2a871eae
commit
47cded3e6f
@ -1270,13 +1270,6 @@ void QSocks5SocketEnginePrivate::_q_controlSocketStateChanged(QAbstractSocket::S
|
||||
}
|
||||
|
||||
#ifndef QT_NO_UDPSOCKET
|
||||
void QSocks5SocketEnginePrivate::checkForDatagrams() const
|
||||
{
|
||||
// udp should be unbuffered so we need to do some polling at certain points
|
||||
if (udpData->udpSocket->hasPendingDatagrams())
|
||||
const_cast<QSocks5SocketEnginePrivate *>(this)->_q_udpSocketReadNotification();
|
||||
}
|
||||
|
||||
void QSocks5SocketEnginePrivate::_q_udpSocketReadNotification()
|
||||
{
|
||||
QSOCKS5_D_DEBUG << "_q_udpSocketReadNotification()";
|
||||
@ -1610,8 +1603,6 @@ bool QSocks5SocketEngine::hasPendingDatagrams() const
|
||||
Q_D(const QSocks5SocketEngine);
|
||||
Q_INIT_CHECK(false);
|
||||
|
||||
d->checkForDatagrams();
|
||||
|
||||
return !d->udpData->pendingDatagrams.isEmpty();
|
||||
}
|
||||
|
||||
@ -1619,8 +1610,6 @@ qint64 QSocks5SocketEngine::pendingDatagramSize() const
|
||||
{
|
||||
Q_D(const QSocks5SocketEngine);
|
||||
|
||||
d->checkForDatagrams();
|
||||
|
||||
if (!d->udpData->pendingDatagrams.isEmpty())
|
||||
return d->udpData->pendingDatagrams.head().data.size();
|
||||
return 0;
|
||||
@ -1632,8 +1621,6 @@ qint64 QSocks5SocketEngine::readDatagram(char *data, qint64 maxlen, QIpPacketHea
|
||||
#ifndef QT_NO_UDPSOCKET
|
||||
Q_D(QSocks5SocketEngine);
|
||||
|
||||
d->checkForDatagrams();
|
||||
|
||||
if (d->udpData->pendingDatagrams.isEmpty())
|
||||
return 0;
|
||||
|
||||
|
@ -248,7 +248,6 @@ public:
|
||||
void _q_controlSocketReadNotification();
|
||||
void _q_controlSocketError(QAbstractSocket::SocketError);
|
||||
#ifndef QT_NO_UDPSOCKET
|
||||
void checkForDatagrams() const;
|
||||
void _q_udpSocketReadNotification();
|
||||
#endif
|
||||
void _q_controlSocketBytesWritten();
|
||||
|
Loading…
Reference in New Issue
Block a user