diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 9a1240525..0e399edea 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -3103,6 +3103,7 @@ void CClient::Run() } GameClient()->OnInit(); + m_ServerBrowser.OnInit(); char aBuf[256]; str_format(aBuf, sizeof(aBuf), "version %s", GameClient()->NetVersion()); diff --git a/src/engine/client/serverbrowser.cpp b/src/engine/client/serverbrowser.cpp index 10a4b80ee..aa36db592 100644 --- a/src/engine/client/serverbrowser.cpp +++ b/src/engine/client/serverbrowser.cpp @@ -106,6 +106,11 @@ void CServerBrowser::SetBaseInfo(class CNetClient *pClient, const char *pNetVers RegisterCommands(); } +void CServerBrowser::OnInit() +{ + m_pHttp = CreateServerBrowserHttp(m_pEngine, m_pConsole, m_pStorage, g_Config.m_BrCachedBestServerinfoUrl); +} + void CServerBrowser::RegisterCommands() { m_pConsole->Register("leak_ip_address_to_all_servers", "", CFGFLAG_CLIENT, Con_LeakIpAddress, this, "Leaks your IP address to all servers by pinging each of them, also acquiring the latency in the process"); @@ -1145,11 +1150,6 @@ void CServerBrowser::Update(bool ForceResort) int64 Timeout = time_freq(); int64 Now = time_get(); - if(!m_pHttp) - { - m_pHttp = CreateServerBrowserHttp(m_pEngine, m_pConsole, m_pStorage, g_Config.m_BrCachedBestServerinfoUrl); - } - const char *pHttpBestUrl; if(!m_pHttp->GetBestUrl(&pHttpBestUrl) && pHttpBestUrl != m_pHttpPrevBestUrl) { diff --git a/src/engine/client/serverbrowser.h b/src/engine/client/serverbrowser.h index ebc5adfb9..7a81aee38 100644 --- a/src/engine/client/serverbrowser.h +++ b/src/engine/client/serverbrowser.h @@ -136,6 +136,7 @@ public: void SetCurrentServerPing(const NETADDR &Addr, int Ping); void SetBaseInfo(class CNetClient *pClient, const char *pNetVersion); + void OnInit(); void RequestImpl64(const NETADDR &Addr, CServerEntry *pEntry) const; void QueueRequest(CServerEntry *pEntry);