mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #3876
3876: Fix crash in serverbrowser initialization r=def- a=heinrich5991 Another missing commit. Fixes #3875. CC #3772 #3855 <!-- What is the motivation for the changes of this pull request --> ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
commit
af6a3778e3
|
@ -3103,6 +3103,7 @@ void CClient::Run()
|
|||
}
|
||||
|
||||
GameClient()->OnInit();
|
||||
m_ServerBrowser.OnInit();
|
||||
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "version %s", GameClient()->NetVersion());
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue