diff options
author | Juha Vuolle <juha.vuolle@qt.io> | 2023-11-02 14:41:39 +0200 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@qt.io> | 2023-12-08 15:53:34 +0200 |
commit | 090991123dd82796fe956e4153bc26ace22280ca (patch) | |
tree | 662642bf647c898e8f9f0975071da6decd0ffae7 /src/network/access/qnetworkreplyhttpimpl.cpp | |
parent | 298d5a4bbd3d5f68034c5419f1b80e4535a5c6f5 (diff) |
Support for std::chrono as transferTimeout type
Provide users with means to use more modern time/duration type.
Please note that since QTimer does not currently support
timeouts larger than 'int' milliseconds, the limit on how long
durations can be expressed, remains. This should not
be an issue in practice with network requests, as a typical
int32 system can express timeouts of ~24 days.
[ChangeLog][QtNetwork][QNetworkAccessManager] Add std::chrono
support for transfer timeout.
[ChangeLog][QtNetwork][QNetworkRequest] Add std::chrono support
for transfer timeout.
Fixes: QTBUG-118714
Change-Id: If85678a5994c59bac5926e47f98c9cfeb2a07c30
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/network/access/qnetworkreplyhttpimpl.cpp')
-rw-r--r-- | src/network/access/qnetworkreplyhttpimpl.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 0fa4e24264..53bc0f5283 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -34,6 +34,7 @@ QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; using namespace QtMiscUtils; +using namespace std::chrono_literals; class QNetworkProxy; @@ -2047,9 +2048,9 @@ void QNetworkReplyHttpImplPrivate::setupTransferTimeout() Qt::QueuedConnection); } transferTimeout->stop(); - if (request.transferTimeout()) { + if (request.transferTimeoutAsDuration() > 0ms) { transferTimeout->setSingleShot(true); - transferTimeout->setInterval(request.transferTimeout()); + transferTimeout->setInterval(request.transferTimeoutAsDuration()); QMetaObject::invokeMethod(transferTimeout, "start", Qt::QueuedConnection); |