diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-07-31 20:05:05 +0300 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-10-07 02:28:12 +0300 |
commit | 032ffb70a829184fb620cf14fa146580b742e0e8 (patch) | |
tree | 6994fa22f63b186007c9eb0b79afa4e71f8eeec9 /tests/manual/socketengine | |
parent | 51c812af0747573ccf07fc232d860170c4ba2877 (diff) |
QAbstractSocketEngine: port to QDeadlineTimer
qnativesocketengine_win.cpp: don't check if timeout is < 0, because
remainingTimeAsDuration() doesn't return negative values.
All the changes done in one go, not function by function, as that causes
the least churn. You can think of them as a couple of very similar
changes repeated various times.
Drive-by change: replace `forever {` with `for (;;)`
Task-number: QTBUG-113518
Change-Id: Ie9f20031bf0d4ff19e5b2da5034822ba61f9cbc3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/manual/socketengine')
-rw-r--r-- | tests/manual/socketengine/main.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/manual/socketengine/main.cpp b/tests/manual/socketengine/main.cpp index d79f14f339..79a000fa76 100644 --- a/tests/manual/socketengine/main.cpp +++ b/tests/manual/socketengine/main.cpp @@ -13,6 +13,8 @@ #include <cstdio> #include <QCoreApplication> +using namespace std::chrono_literals; + const int bufsize = 16*1024; char buf[bufsize]; @@ -39,7 +41,7 @@ int main(int argc, char**argv) int r = socketEngine->connectToHost(QHostAddress("74.125.77.99"), 80); // google bool readyToRead = false; bool readyToWrite = false; - socketEngine->waitForReadOrWrite(&readyToRead, &readyToWrite, true, true, 10*1000); + socketEngine->waitForReadOrWrite(&readyToRead, &readyToWrite, true, true, 10s); if (r <= 0) //timeout or error exit(1); if (readyToWrite) { @@ -49,7 +51,7 @@ int main(int argc, char**argv) if (ret == request.length()) { // read the response in a loop do { - bool waitReadResult = socketEngine->waitForRead(10*1000); + bool waitReadResult = socketEngine->waitForRead(10s); int available = socketEngine->bytesAvailable(); if (waitReadResult == true && available == 0) { // disconnected |