diff --git a/src/engine/server/register.cpp b/src/engine/server/register.cpp index d61449271..1d6eef4af 100644 --- a/src/engine/server/register.cpp +++ b/src/engine/server/register.cpp @@ -118,6 +118,9 @@ class CRegister : public IRegister CConfig *m_pConfig; IConsole *m_pConsole; IEngine *m_pEngine; + // Don't start sending registers before the server has initialized + // completely. + bool m_GotFirstUpdateCall = false; int m_ServerPort; char m_aConnlessTokenHex[16]; @@ -505,6 +508,7 @@ CRegister::CRegister(CConfig *pConfig, IConsole *pConsole, IEngine *pEngine, int void CRegister::Update() { + m_GotFirstUpdateCall = true; if(!m_GotServerInfo) { return; @@ -605,6 +609,11 @@ void CRegister::OnConfigChange() str_copy(m_aaExtraHeaders[m_NumExtraHeaders], aHeader); m_NumExtraHeaders += 1; } + // Don't start registering before the first `CRegister::Update` call. + if(!m_GotFirstUpdateCall) + { + return; + } for(int i = 0; i < NUM_PROTOCOLS; i++) { if(aOldProtocolEnabled[i] == m_aProtocolEnabled[i]) @@ -670,6 +679,12 @@ void CRegister::OnNewInfo(const char *pInfo) m_pGlobal->m_InfoSerial += 1; } + // Don't start registering before the first `CRegister::Update` call. + if(!m_GotFirstUpdateCall) + { + return; + } + // Immediately send new info if it changes, but at most once per second. int64_t Now = time_get(); int64_t Freq = time_freq();