Merge pull request #8589 from Learath2/pr_antibot_empty_addr

Reset and regenerate m_aPeerAddrStr appropriately
This commit is contained in:
Dennis Felsing 2024-07-14 12:30:04 +00:00 committed by GitHub
commit 91c2e6ef80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,6 +8,7 @@ void CNetConnection::ResetStats()
{
mem_zero(&m_Stats, sizeof(m_Stats));
mem_zero(&m_PeerAddr, sizeof(m_PeerAddr));
m_aPeerAddrStr[0] = '\0';
m_LastUpdateTime = 0;
}
@ -41,7 +42,6 @@ void CNetConnection::Reset(bool Rejoin)
m_Buffer.Init();
mem_zero(&m_Construct, sizeof(m_Construct));
m_aPeerAddrStr[0] = '\0';
}
const char *CNetConnection::ErrorString()
@ -197,6 +197,8 @@ int CNetConnection::Connect(const NETADDR *pAddr, int NumAddrs)
// init connection
Reset();
mem_zero(&m_PeerAddr, sizeof(m_PeerAddr));
m_aPeerAddrStr[0] = '\0';
for(int i = 0; i < NumAddrs; i++)
{
m_aConnectAddrs[i] = pAddr[i];
@ -509,6 +511,7 @@ void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SE
m_State = NET_CONNSTATE_ONLINE;
m_PeerAddr = *pAddr;
net_addr_str(pAddr, m_aPeerAddrStr, sizeof(m_aPeerAddrStr), true);
mem_zero(m_aErrorString, sizeof(m_aErrorString));
m_LastSendTime = Now;
m_LastRecvTime = Now;