From 719f178f70aa628be65713105df65fa23fd4784b Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 25 Oct 2020 01:55:35 +0800 Subject: [PATCH] Disconnect if UDP Login fails, ryzom/ryzomcore#622 --- code/ryzom/client/src/network_connection.cpp | 12 ++++++++++++ code/ryzom/client/src/network_connection.h | 1 + 2 files changed, 13 insertions(+) diff --git a/code/ryzom/client/src/network_connection.cpp b/code/ryzom/client/src/network_connection.cpp index 731677043..c1e9d8975 100644 --- a/code/ryzom/client/src/network_connection.cpp +++ b/code/ryzom/client/src/network_connection.cpp @@ -680,6 +680,7 @@ bool CNetworkConnection::connect(string &result) _LatestLoginTime = ryzomGetLocalTime (); _LatestSyncTime = _LatestLoginTime; _LatestProbeTime = _LatestLoginTime; + m_LoginAttempts = 0; nlinfo("CNET[%p]: Client connected to shard, attempting login", this); return true; @@ -1091,6 +1092,17 @@ bool CNetworkConnection::stateLogin() { sendSystemLogin(); _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; diff --git a/code/ryzom/client/src/network_connection.h b/code/ryzom/client/src/network_connection.h index d11702682..84bb26d43 100644 --- a/code/ryzom/client/src/network_connection.h +++ b/code/ryzom/client/src/network_connection.h @@ -822,6 +822,7 @@ private: void sendSystemLogin(); bool stateLogin(); NLMISC::TTime _LatestLoginTime; + int m_LoginAttempts; // void receiveSystemSync(NLMISC::CBitMemStream &msgin);