tst_QTcpSocket: fix disconnectWhileLookingUp
... and unblacklist it on Windows. From what I can tell there is no particular reason why this test fails other than that it is a little too slow sometimes (these things happen). So, to fix the test I bumped the timeout, but to avoid the test running for longer on every test-run it now also ends when the socket enters the "Unconnected" state. Previously it failed 171/500 times, and after this patch it failed 0/1000 times. Change-Id: I4266bff6b91aaaf502ee66265d01c3a177706402 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
This commit is contained in:
parent
eade2255ea
commit
5a235da270
@ -6,8 +6,6 @@ windows
|
|||||||
windows
|
windows
|
||||||
[invalidProxy:socks5-on-http]
|
[invalidProxy:socks5-on-http]
|
||||||
windows
|
windows
|
||||||
[disconnectWhileLookingUp]
|
|
||||||
windows
|
|
||||||
[timeoutConnect:ip]
|
[timeoutConnect:ip]
|
||||||
windows
|
windows
|
||||||
]
|
]
|
||||||
|
@ -1447,8 +1447,15 @@ void tst_QTcpSocket::disconnectWhileLookingUp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// let anything queued happen
|
// let anything queued happen
|
||||||
|
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
QTimer::singleShot(50, &loop, SLOT(quit()));
|
// If 'doClose' is false then we called '::waitForDisconnected' earlier, meaning
|
||||||
|
// we are already 'Unconnected'. So we don't need to wait for any potentially slow host lookups.
|
||||||
|
QTimer::singleShot(doClose ? 4000 : 50, &loop, SLOT(quit()));
|
||||||
|
connect(socket, &QTcpSocket::stateChanged, [&loop](QAbstractSocket::SocketState state) {
|
||||||
|
if (state == QAbstractSocket::UnconnectedState)
|
||||||
|
loop.exit(); // we don't need to wait for the timer to expire; we're done.
|
||||||
|
});
|
||||||
loop.exec();
|
loop.exec();
|
||||||
|
|
||||||
// recheck
|
// recheck
|
||||||
|
Loading…
Reference in New Issue
Block a user