diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-21 08:17:21 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-21 08:17:21 +0100 |
commit | 158a3a4159bdc5a49caecd63e021dacbc06cf23c (patch) | |
tree | c3ed9aee6cabd46e5e8615b3815b92d32857c4da /tests/auto/other/networkselftest | |
parent | 26ece94a68fb5ae680c5639716b06c4e1ae979a8 (diff) | |
parent | 7b2fb038ae4b8b9231ae989ad309b6eca107a858 (diff) | |
download | qtbase-158a3a4159bdc5a49caecd63e021dacbc06cf23c.tar.gz |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
src/corelib/io/qiodevice_p.h
src/corelib/kernel/qvariant_p.h
src/corelib/tools/qsimd.cpp
src/gui/kernel/qguiapplication.cpp
tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
Diffstat (limited to 'tests/auto/other/networkselftest')
-rw-r--r-- | tests/auto/other/networkselftest/tst_networkselftest.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp index 257a7fc03d..f51aac9cac 100644 --- a/tests/auto/other/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp @@ -171,14 +171,16 @@ static bool doSocketRead(QTcpSocket *socket, int minBytesAvailable, int timeout { QElapsedTimer timer; timer.start(); + int t = timeout; forever { if (socket->bytesAvailable() >= minBytesAvailable) return true; - timeout = qt_subtract_from_timeout(timeout, timer.elapsed()); - if (socket->state() == QAbstractSocket::UnconnectedState - || timeout == 0) + if (socket->state() == QAbstractSocket::UnconnectedState) return false; - if (!socket->waitForReadyRead(timeout)) + if (!socket->waitForReadyRead(t)) + return false; + t = qt_subtract_from_timeout(timeout, timer.elapsed()); + if (t == 0) return false; } } @@ -199,6 +201,7 @@ static bool doSocketFlush(QTcpSocket *socket, int timeout = 4000) #endif QTime timer; timer.start(); + int t = timeout; forever { if (socket->bytesToWrite() == 0 #ifndef QT_NO_SSL @@ -206,11 +209,12 @@ static bool doSocketFlush(QTcpSocket *socket, int timeout = 4000) #endif ) return true; - timeout = qt_subtract_from_timeout(timeout, timer.elapsed()); - if (socket->state() == QAbstractSocket::UnconnectedState - || timeout == 0) + if (socket->state() == QAbstractSocket::UnconnectedState) + return false; + if (!socket->waitForBytesWritten(t)) return false; - if (!socket->waitForBytesWritten(timeout)) + t = qt_subtract_from_timeout(timeout, timer.elapsed()); + if (t == 0) return false; } } |