Disconnect if UDP Login fails, ryzom/ryzomcore#622

fixes
kaetemi 4 years ago committed by Nimetu
parent 4bcf9270eb
commit 719f178f70

@ -680,6 +680,7 @@ bool CNetworkConnection::connect(string &result)
_LatestLoginTime = ryzomGetLocalTime (); _LatestLoginTime = ryzomGetLocalTime ();
_LatestSyncTime = _LatestLoginTime; _LatestSyncTime = _LatestLoginTime;
_LatestProbeTime = _LatestLoginTime; _LatestProbeTime = _LatestLoginTime;
m_LoginAttempts = 0;
nlinfo("CNET[%p]: Client connected to shard, attempting login", this); nlinfo("CNET[%p]: Client connected to shard, attempting login", this);
return true; return true;
@ -1091,6 +1092,17 @@ bool CNetworkConnection::stateLogin()
{ {
sendSystemLogin(); sendSystemLogin();
_LatestLoginTime = _UpdateTime; _LatestLoginTime = _UpdateTime;
if (m_LoginAttempts > 24)
{
m_LoginAttempts = 0;
disconnect(); // will send disconnection message
nlwarning("CNET[%p]: Too many LOGIN attempts, connection problem", this);
return false; // exit now from loop, don't expect a new state
}
else
{
++m_LoginAttempts;
}
} }
return false; return false;

@ -822,6 +822,7 @@ private:
void sendSystemLogin(); void sendSystemLogin();
bool stateLogin(); bool stateLogin();
NLMISC::TTime _LatestLoginTime; NLMISC::TTime _LatestLoginTime;
int m_LoginAttempts;
// //
void receiveSystemSync(NLMISC::CBitMemStream &msgin); void receiveSystemSync(NLMISC::CBitMemStream &msgin);

Loading…
Cancel
Save