From 31b3ac71c2e7c6337c50862d82d460183f555dc2 Mon Sep 17 00:00:00 2001 From: Learath Date: Sun, 28 Jan 2024 19:34:30 +0100 Subject: [PATCH] Fix client/server updates --- src/engine/client/updater.cpp | 12 +++++++----- src/engine/client/updater.h | 3 +++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/engine/client/updater.cpp b/src/engine/client/updater.cpp index b2db339f2..97cb4a115 100644 --- a/src/engine/client/updater.cpp +++ b/src/engine/client/updater.cpp @@ -84,6 +84,8 @@ CUpdater::CUpdater() m_Percent = 0; m_pCurrentTask = nullptr; + m_ClientUpdate = m_ServerUpdate = m_ClientFetched = m_ServerFetched = false; + IStorage::FormatTmpPath(m_aClientExecTmp, sizeof(m_aClientExecTmp), CLIENT_EXEC); IStorage::FormatTmpPath(m_aServerExecTmp, sizeof(m_aServerExecTmp), SERVER_EXEC); } @@ -345,17 +347,17 @@ void CUpdater::RunningUpdate() } else { - if(m_ServerUpdate) + if(m_ServerUpdate && !m_ServerFetched) { FetchFile(PLAT_SERVER_DOWN, m_aServerExecTmp); - m_ServerUpdate = false; + m_ServerFetched = true; return; } - if(m_ClientUpdate) + if(m_ClientUpdate && !m_ClientFetched) { - FetchFile(PLAT_SERVER_DOWN, m_aServerExecTmp); - m_ClientUpdate = false; + FetchFile(PLAT_CLIENT_DOWN, m_aClientExecTmp); + m_ClientFetched = true; return; } diff --git a/src/engine/client/updater.h b/src/engine/client/updater.h index c9934ad81..746c81b02 100644 --- a/src/engine/client/updater.h +++ b/src/engine/client/updater.h @@ -65,6 +65,9 @@ class CUpdater : public IUpdater bool m_ClientUpdate; bool m_ServerUpdate; + bool m_ClientFetched; + bool m_ServerFetched; + void AddFileJob(const char *pFile, bool Job); void FetchFile(const char *pFile, const char *pDestPath = nullptr) REQUIRES(!m_Lock); bool MoveFile(const char *pFile);