Compare commits

...

5 commits

Author SHA1 Message Date
Robert Müller acfe26e715
Merge pull request #8112 from heinrich5991/pr_ddnet_http_age_crash
Fix crash when the serverlist request fails
2024-03-16 22:40:48 +00:00
Dennis Felsing f3c246f622
Merge branch 'master' into pr_ddnet_http_age_crash 2024-03-16 23:23:35 +01:00
Dennis Felsing b72d89b5cf
Merge pull request #8114 from furo321/tutorial-showothers
Remove `sv_show_others` from `Tutorial.map`
2024-03-16 22:22:47 +00:00
furo 28f052eaf2 Remove sv_show_others from Tutorial.map 2024-03-16 22:36:59 +01:00
heinrich5991 03aab986fe Fix crash when the serverlist request fails
We're not allowed to look at `ResultAgeSeconds` when the state is
`EHttpState::ERROR`.

Fixes #8107.
2024-03-16 21:12:47 +01:00
2 changed files with 9 additions and 6 deletions

Binary file not shown.

View file

@ -400,21 +400,24 @@ void CServerBrowserHttp::Update()
Success = Success && pJson;
Success = Success && !Parse(pJson, &m_vServers, &m_vLegacyServers);
json_value_free(pJson);
int Age = SanitizeAge(pGetServers->ResultAgeSeconds());
if(!Success)
{
log_error("serverbrowser_http", "failed getting serverlist, trying to find best URL");
m_pChooseMaster->Reset();
m_pChooseMaster->Refresh();
}
// Try to find new master if the current one returns results
// that are 5 minutes old.
else if(Age > 300)
else
{
// Try to find new master if the current one returns
// results that are 5 minutes old.
int Age = SanitizeAge(pGetServers->ResultAgeSeconds());
if(Age > 300)
{
log_info("serverbrowser_http", "got stale serverlist, age=%ds, trying to find best URL", Age);
m_pChooseMaster->Refresh();
}
}
}
}
void CServerBrowserHttp::Refresh()
{