QSocks5SocketEngine: account for in-transit signal when waiting for read
When calling waitFor{ReadyRead,Disconnected} it will wait for data but
if the data is already received and the read notification has been
queued (and there's no more data coming in) it will return false.
By checking if a read notification has been queued and then handling
this we can easily take care of this scenario.
Fixes some flaky tests which missed the read data in waitForDisconnect
and similar.
Fixes: QTBUG-38385
Change-Id: Ic05d59883c1175783e56ff1822b6636c35aec874
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
parent
5e0a45e932
commit
1eeab2d27f
|
|
@ -1753,6 +1753,11 @@ bool QSocks5SocketEngine::waitForRead(int msecs, bool *timedOut)
|
|||
return false;
|
||||
if (d->data->controlSocket->state() == QAbstractSocket::UnconnectedState)
|
||||
return true;
|
||||
if (bytesAvailable() && d->readNotificationPending) {
|
||||
// We've got some data incoming, but the queued call hasn't been performed yet.
|
||||
// The data is where we expect it to be already, so just return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
// we're connected
|
||||
if (d->mode == QSocks5SocketEnginePrivate::ConnectMode ||
|
||||
|
|
|
|||
|
|
@ -328,8 +328,8 @@ void tst_QTcpSocket::initTestCase_data()
|
|||
|
||||
qDebug() << QtNetworkSettings::serverName();
|
||||
QTest::newRow("WithoutProxy") << false << 0 << false;
|
||||
//QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy) << false; ### temporarily disabled, QTBUG-38385
|
||||
//QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic) << false; ### temporarily disabled, QTBUG-38385
|
||||
QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy) << false;
|
||||
QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic) << false;
|
||||
|
||||
QTest::newRow("WithHttpProxy") << true << int(HttpProxy) << false;
|
||||
QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic) << false;
|
||||
|
|
@ -337,8 +337,8 @@ void tst_QTcpSocket::initTestCase_data()
|
|||
|
||||
#ifndef QT_NO_SSL
|
||||
QTest::newRow("WithoutProxy SSL") << false << 0 << true;
|
||||
//QTest::newRow("WithSocks5Proxy SSL") << true << int(Socks5Proxy) << true; ### temporarily disabled, QTBUG-38385
|
||||
//QTest::newRow("WithSocks5AuthProxy SSL") << true << int(Socks5Proxy | AuthBasic) << true; ### temporarily disabled, QTBUG-38385
|
||||
QTest::newRow("WithSocks5Proxy SSL") << true << int(Socks5Proxy) << true;
|
||||
QTest::newRow("WithSocks5AuthProxy SSL") << true << int(Socks5Proxy | AuthBasic) << true;
|
||||
|
||||
QTest::newRow("WithHttpProxy SSL") << true << int(HttpProxy) << true;
|
||||
QTest::newRow("WithHttpProxyBasicAuth SSL") << true << int(HttpProxy | AuthBasic) << true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue