aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-09-22 14:17:31 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-09-22 14:17:31 +0900
commitae59271da3a199eb936aa709893ef592cd51f172 (patch)
treef4f8b2b9139bc4e6b74ee4d944d6b55c4efc04b9
parent15feb65dbb17161ccfbda614e0635f2698beacd7 (diff)
downloadlibquotient-ae59271da3a199eb936aa709893ef592cd51f172.tar.gz
libquotient-ae59271da3a199eb936aa709893ef592cd51f172.zip
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.
-rw-r--r--connectiondata.cpp3
1 files changed, 1 insertions, 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 <QtNetwork/QNetworkAccessManager>
-#include <cstdlib>
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)