From ae59271da3a199eb936aa709893ef592cd51f172 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 22 Sep 2017 14:17:31 +0900 Subject: Use epoch milliseconds instead of std::rand() to seed the txn counter std::rand() on MinGW on Windows 7, at least in debug mode, nicely generates the same value across runs, reliably leading to messages loss as the server discards them. --- connectiondata.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/connectiondata.cpp b/connectiondata.cpp index cd91ef27..6f15577e 100644 --- a/connectiondata.cpp +++ b/connectiondata.cpp @@ -21,7 +21,6 @@ #include "logging.h" #include -#include using namespace QMatrixClient; @@ -38,7 +37,7 @@ struct ConnectionData::Private QString lastEvent; mutable unsigned int txnCounter = 0; - const int id = std::rand(); // We don't really care about pure randomness + const qint64 id = QDateTime::currentMSecsSinceEpoch(); }; ConnectionData::ConnectionData(QUrl baseUrl) -- cgit v1.2.3