From 032ffb70a829184fb620cf14fa146580b742e0e8 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Mon, 31 Jul 2023 20:05:05 +0300 Subject: QAbstractSocketEngine: port to QDeadlineTimer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: MÃ¥rten Nordheim --- tests/manual/socketengine/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/manual/socketengine/main.cpp') diff --git a/tests/manual/socketengine/main.cpp b/tests/manual/socketengine/main.cpp index d79f14f339b..79a000fa76f 100644 --- a/tests/manual/socketengine/main.cpp +++ b/tests/manual/socketengine/main.cpp @@ -13,6 +13,8 @@ #include #include +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 -- cgit v1.2.3