From 53a004fa74009a5adfb764ee200474eb45c21b15 Mon Sep 17 00:00:00 2001 From: H-M-H Date: Thu, 28 Jan 2016 23:13:31 +0100 Subject: [PATCH] reset preferred sql-server to the first specified on map load --- src/engine/server/sql_connector.h | 4 +++- src/game/server/score/sql_score.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/engine/server/sql_connector.h b/src/engine/server/sql_connector.h index 6d1d8a036..4d24fdff5 100644 --- a/src/engine/server/sql_connector.h +++ b/src/engine/server/sql_connector.h @@ -22,10 +22,12 @@ public: static void SetReadServers(CSqlServer** ppReadServers) { ms_ppSqlReadServers = ppReadServers; } static void SetWriteServers(CSqlServer** ppWriteServers) { ms_ppSqlWriteServers = ppWriteServers; } + static void ResetReachable() { ms_ReachableReadServer = 0; ms_ReachableWriteServer = 0; } + bool ConnectSqlServer(bool ReadOnly = true); bool MaxTriesReached(bool ReadOnly = true) { return ReadOnly ? m_NumReadRetries >= CSqlServer::ms_NumReadServer : m_NumWriteRetries >= CSqlServer::ms_NumWriteServer; } - + private: CSqlServer *m_pSqlServer; diff --git a/src/game/server/score/sql_score.cpp b/src/game/server/score/sql_score.cpp index 159904ebb..318085869 100644 --- a/src/game/server/score/sql_score.cpp +++ b/src/game/server/score/sql_score.cpp @@ -32,6 +32,8 @@ m_pServer(pGameServer->Server()) CSqlData::ms_pPlayerData = PlayerData(0); CSqlData::ms_pMap = m_aMap; + CSqlConnector::ResetReachable(); + void* InitThread = thread_init(ExecSqlFunc, new CSqlExecData(Init, new CSqlData())); thread_detach(InitThread); }