From 8e1fdbe10862ccba3bdff2389c1bb732c6e84da4 Mon Sep 17 00:00:00 2001 From: Darkelarious Date: Sun, 4 May 2025 16:08:07 +0200 Subject: database pragmas and timeout restraints --- Changelog | 7 +++++++ README.md | 2 +- bin/MasterServer-Qt5-v0.28 | Bin 0 -> 506504 bytes bin/MasterServer-Qt5hf4 | Bin 506504 -> 0 bytes src/Core/version.h | 4 ++-- src/Database/initdatabase.cpp | 5 +++-- src/Protocols/GameSpy0/gamespy0.cpp | 4 ++++ src/TcpTasks/ListenClientHandler/listenclienthandler.h | 4 ++-- src/TcpTasks/SyncClient/syncclient.h | 2 +- src/TcpTasks/Updater/scheduleupdater.cpp | 2 +- src/TcpTasks/Updater/syncupdater.h | 2 +- 11 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 bin/MasterServer-Qt5-v0.28 delete mode 100644 bin/MasterServer-Qt5hf4 diff --git a/Changelog b/Changelog index def69ce..8b8999c 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,12 @@ Changelog for MasterServer-Qt --- + +v0.28 2025-05-04: + * Fix case sensitive typo in include path + * Trim empty keys after queryid that caused key/value offset + * Loosen restraints for timeouts in TCP clients and sync + * Add database pragmas for WAL and timeout + v0.27 hotfix 4 2025-03-06: * Parse serverinfo differently to handle player gaps * SQL query optimisation for stats diff --git a/README.md b/README.md index b805728..3c0d647 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ NOTE: This is the GitHub mirror/copy for the 333networks masterserver backend. C Website: [https://333networks.com](https://333networks.com) ## INSTALL -The masterserver requires the Qt5 library v5.9.5 or above to run. On linux, these binaries are available through the repository as `qt5-default` or `qt5-base`. For example, on Debian/Ubuntu, you can install the libraries through `sudo apt-get install qt5-default`. +The masterserver requires the Qt5 library v5.9.5 or above to run. On linux, these binaries are available through the repository as `qt5-default` or `qtbase5-dev`. After installing the Qt5 libraries, check which version is installed and active: ``` diff --git a/bin/MasterServer-Qt5-v0.28 b/bin/MasterServer-Qt5-v0.28 new file mode 100644 index 0000000..b9b081f Binary files /dev/null and b/bin/MasterServer-Qt5-v0.28 differ diff --git a/bin/MasterServer-Qt5hf4 b/bin/MasterServer-Qt5hf4 deleted file mode 100644 index 7233442..0000000 Binary files a/bin/MasterServer-Qt5hf4 and /dev/null differ diff --git a/src/Core/version.h b/src/Core/version.h index 5308bfc..10d204c 100644 --- a/src/Core/version.h +++ b/src/Core/version.h @@ -26,10 +26,10 @@ #define BUILD_TYPE QString("MasterServer Qt5") // software version (of this particular type) -#define BUILD_VERSION QString("0.27") +#define BUILD_VERSION QString("0.28") // short version (in query) -- Qt v0.n -#define SHORT_VER QString("Qt-" + BUILD_VERSION + "hf4") +#define SHORT_VER QString("Qt-" + BUILD_VERSION) // build time/date #define BUILD_TIME QStringLiteral("%1 %2").arg(__DATE__).arg(__TIME__) diff --git a/src/Database/initdatabase.cpp b/src/Database/initdatabase.cpp index c3b4823..fb99dfa 100644 --- a/src/Database/initdatabase.cpp +++ b/src/Database/initdatabase.cpp @@ -14,9 +14,10 @@ bool initDatabase(const QString applicationPath) return false; } - // speed up SQLite with keeping journals in memory and asynchronous writing + // SQLite tweaks with async, wal and timeout dbi.exec("PRAGMA synchronous = OFF"); - dbi.exec("PRAGMA journal_mode = MEMORY"); + dbi.exec("PRAGMA journal_mode = WAL"); // previous: MEMORY + dbi.exec("PRAGMA busy_timeout = 500"); // 500ms { // check if the database was generated with this version of the software diff --git a/src/Protocols/GameSpy0/gamespy0.cpp b/src/Protocols/GameSpy0/gamespy0.cpp index 6595d4a..64026b8 100644 --- a/src/Protocols/GameSpy0/gamespy0.cpp +++ b/src/Protocols/GameSpy0/gamespy0.cpp @@ -23,6 +23,10 @@ QMultiHash parseGameSpy0Buffer(const QString &bufferString) // unify valid keys QString key = overrideKey( property.next().trimmed() ); + // skip empty key field (can happen after queryid) + if ( !key.length() ) + continue; + // see if a value for this key exists if ( ! property.hasNext() ) break; diff --git a/src/TcpTasks/ListenClientHandler/listenclienthandler.h b/src/TcpTasks/ListenClientHandler/listenclienthandler.h index 3c857fa..4259312 100644 --- a/src/TcpTasks/ListenClientHandler/listenclienthandler.h +++ b/src/TcpTasks/ListenClientHandler/listenclienthandler.h @@ -9,7 +9,7 @@ #include "Database/Common/commonactions.h" #include "Protocols/GameSpy0/gamespy0.h" -#include "protocols/enctype2.h" +#include "Protocols/enctype2.h" #include "Protocols/GameSpy0/securevalidate.h" class ListenClientHandler : public QObject @@ -20,7 +20,7 @@ public: QTcpSocket *tcpSocket); private: - const int _timeOutTime_ms = 7500; + const int _timeOutTime_ms = 15000; QSharedPointer _coreObject; QScopedPointer _tcpSocket; diff --git a/src/TcpTasks/SyncClient/syncclient.h b/src/TcpTasks/SyncClient/syncclient.h index 8cf253f..49f8155 100644 --- a/src/TcpTasks/SyncClient/syncclient.h +++ b/src/TcpTasks/SyncClient/syncclient.h @@ -20,7 +20,7 @@ public: private: QSharedPointer _coreObject; - const int _timeOutTime_ms = 7500; + const int _timeOutTime_ms = 15000; // tcp client handles QTcpSocket _tcpSocket; diff --git a/src/TcpTasks/Updater/scheduleupdater.cpp b/src/TcpTasks/Updater/scheduleupdater.cpp index 7a96d6e..86a8f29 100644 --- a/src/TcpTasks/Updater/scheduleupdater.cpp +++ b/src/TcpTasks/Updater/scheduleupdater.cpp @@ -2,7 +2,7 @@ bool SyncUpdater::scheduleUpdater() { - // schedule sync X seconds apart (prevent network spikes) + // schedule sync X seconds apart (prevent network/cpu spikes) connect(&_syncTicker, &QTimer::timeout, this, &SyncUpdater::onSyncTickerAction); _syncTicker.setInterval( _graceTime_ms ); diff --git a/src/TcpTasks/Updater/syncupdater.h b/src/TcpTasks/Updater/syncupdater.h index 9bd2299..5d47317 100644 --- a/src/TcpTasks/Updater/syncupdater.h +++ b/src/TcpTasks/Updater/syncupdater.h @@ -17,7 +17,7 @@ public: private: QSharedPointer _coreObject; - const int _graceTime_ms = 5000; + const int _graceTime_ms = 30000; // update/ticker timer QTimer _updaterTimer; -- cgit v1.2.3