mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
Initialize HTTP later on client launch, show message box on error
Initialize the HTTP client (start the HTTP thread) after initializing the network client instead of during the client interface construction. This ensures that config variables have been loaded already and the log output level is set correctly. This also means all library initialization log messages appear together in one block when starting the client. Show an error message box and stop launching when the HTTP client could not be initialized, instead of launching but not being able to perform any HTTP requests, which causes bug reports about the serverlist being empty.
This commit is contained in:
parent
d6a20f271b
commit
535400d8a8
|
@ -2685,8 +2685,6 @@ void CClient::InitInterfaces()
|
|||
|
||||
m_DemoEditor.Init(m_pGameClient->NetVersion(), &m_SnapshotDelta, m_pConsole, m_pStorage);
|
||||
|
||||
m_Http.Init(std::chrono::seconds{1});
|
||||
|
||||
m_ServerBrowser.SetBaseInfo(&m_aNetClient[CONN_CONTACT], m_pGameClient->NetVersion());
|
||||
|
||||
#if defined(CONF_AUTOUPDATE)
|
||||
|
@ -2757,6 +2755,14 @@ void CClient::Run()
|
|||
}
|
||||
#endif
|
||||
|
||||
if(!m_Http.Init(std::chrono::seconds{1}))
|
||||
{
|
||||
const char *pErrorMessage = "Failed to initialize the HTTP client.";
|
||||
log_error("client", "%s", pErrorMessage);
|
||||
ShowMessageBox("HTTP Error", pErrorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
// init text render
|
||||
m_pTextRender = Kernel()->RequestInterface<IEngineTextRender>();
|
||||
m_pTextRender->Init();
|
||||
|
|
Loading…
Reference in a new issue