mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
cancel connection process when server is unreachable. closes #1975
This commit is contained in:
parent
fbc61d22fc
commit
9d08f62558
|
@ -196,6 +196,7 @@ int CNetConnection::Connect(NETADDR *pAddr)
|
|||
|
||||
// init connection
|
||||
Reset();
|
||||
m_LastRecvTime = time_get();
|
||||
m_PeerAddr = *pAddr;
|
||||
m_PeerToken = NET_TOKEN_NONE;
|
||||
SetToken(GenerateToken(pAddr));
|
||||
|
@ -378,6 +379,11 @@ int CNetConnection::Update()
|
|||
m_State = NET_CONNSTATE_ERROR;
|
||||
SetError("Timeout");
|
||||
}
|
||||
else if(State() == NET_CONNSTATE_TOKEN && (Now - m_LastRecvTime) > time_freq() * 5)
|
||||
{
|
||||
m_State = NET_CONNSTATE_ERROR;
|
||||
SetError("Unable to connect to the server");
|
||||
}
|
||||
|
||||
// fix resends
|
||||
if(m_Buffer.First())
|
||||
|
|
Loading…
Reference in a new issue