Fix client/server updates

This commit is contained in:
Learath 2024-01-28 19:34:30 +01:00
parent d60852a020
commit 31b3ac71c2
2 changed files with 10 additions and 5 deletions

View file

@ -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;
}

View file

@ -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);