summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2016-10-29 19:25:32 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2017-02-01 13:44:11 +0000
commit47cded3e6f271c86de65afee00a028cbe9826403 (patch)
tree9e3d0781e22e6c64096310c14f4862e1fa20d2fe /src/network
parentdd2a871eaefe8925c88a835bf298180044d4b0e9 (diff)
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>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/socket/qsocks5socketengine.cpp13
-rw-r--r--src/network/socket/qsocks5socketengine_p.h1
2 files changed, 0 insertions, 14 deletions
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index a1a8e4649d..6db09f94cf 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -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;
diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h
index 864b163489..ec50d71283 100644
--- a/src/network/socket/qsocks5socketengine_p.h
+++ b/src/network/socket/qsocks5socketengine_p.h
@@ -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();