summaryrefslogtreecommitdiffstats
path: root/examples/network/torrent/peerwireclient.cpp
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2023-01-26 08:38:35 +0100
committerMårten Nordheim <marten.nordheim@qt.io>2023-02-14 18:49:45 +0100
commit3fc26dbb2cfe07d1ae0acf4e18b6c94b64e56662 (patch)
tree23a95f35b1984e1ebbd79d879f82325d8f2d7685 /examples/network/torrent/peerwireclient.cpp
parent69c31f6f68a1399c1fc1e545e318eaa40966fe85 (diff)
Torrent example: Convert some timeouts from int to chrono
Using seconds because then they all have the same type, even if all-but-one could use minutes. Delete one unused interval value. Task-number: QTBUG-110622 Pick-to: 6.5 Change-Id: I66b456de8a4b867859e9e2b13ce72e8ec691c79a Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'examples/network/torrent/peerwireclient.cpp')
-rw-r--r--examples/network/torrent/peerwireclient.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/network/torrent/peerwireclient.cpp b/examples/network/torrent/peerwireclient.cpp
index 56feec5959..f6f81215a1 100644
--- a/examples/network/torrent/peerwireclient.cpp
+++ b/examples/network/torrent/peerwireclient.cpp
@@ -7,11 +7,13 @@
#include <QTimerEvent>
#include <QtEndian>
-static const int PendingRequestTimeout = 60 * 1000;
-static const int ClientTimeout = 120 * 1000;
-static const int ConnectTimeout = 60 * 1000;
-static const int KeepAliveInterval = 30 * 1000;
-static const int PeerRateControlTimerDelay = 2000;
+#include <chrono>
+
+static constexpr std::chrono::seconds PendingRequestTimeout(60);
+static constexpr std::chrono::seconds ClientTimeout(120);
+static constexpr std::chrono::seconds ConnectTimeout(60);
+static constexpr std::chrono::seconds KeepAliveInterval(30);
+static constexpr std::chrono::seconds PeerRateControlTimerDelay(2);
static const int MinimalHeaderSize = 48;
static const char ProtocolId[] = "BitTorrent protocol";
static const char ProtocolIdSize = 19;