mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Only start registering once the server is fully started
This works around, i.e. fixes #5858 for curl versions < 7.77.0, as long
as the servers are only registered via IPv4 **OR** IPv6.
The bug that's being worked around is this:
84d2839740
.
The bug makes curl reuse IPv6 connections when it is being requested to
connect via IPv4, making the registering fail. This commit works around
that by letting the server only register after having completely read
the config, so any `sv_register ipv4` should already be in effect.
This commit is contained in:
parent
bc8ec8c1d7
commit
4f2f3f4bba
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue