From a9878401919a9946e0b2d679a8590ae13539b11d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 3 Jun 2008 20:27:52 +0000 Subject: * Stop the crash to bash of the entire region server when a client thread fails by catching the exception in AuthUser() instead of letting it propogate out of the thread --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 58 ++++++++++++++-------- 1 file changed, 36 insertions(+), 22 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 0ef7f26..d9fefb4 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -688,34 +688,48 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_scene.AddNewClient(this, true); } + /// + /// Authorize an incoming user session. This method lies at the base of the entire client thread. + /// protected virtual void AuthUser() { - // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(m_cirpack.m_circuitCode.m_sessionId, m_cirpack.m_circuitCode.ID, m_cirpack.m_circuitCode.Code); - AuthenticateResponse sessionInfo = - m_authenticateSessionsHandler.AuthenticateSession(m_sessionId, m_agentId, - m_circuitCode); - if (!sessionInfo.Authorised) - { - //session/circuit not authorised - m_log.Info("[CLIENT]: New user request denied to " + m_userEndPoint.ToString()); - m_packetQueue.Close(); - m_clientThread.Abort(); - } - else + try { - m_log.Info("[CLIENT]: Got authenticated connection from " + m_userEndPoint.ToString()); - //session is authorised - m_firstName = sessionInfo.LoginInfo.First; - m_lastName = sessionInfo.LoginInfo.Last; - - if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) + // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(m_cirpack.m_circuitCode.m_sessionId, m_cirpack.m_circuitCode.ID, m_cirpack.m_circuitCode.Code); + AuthenticateResponse sessionInfo = + m_authenticateSessionsHandler.AuthenticateSession(m_sessionId, m_agentId, + m_circuitCode); + if (!sessionInfo.Authorised) { - m_secureSessionId = sessionInfo.LoginInfo.SecureSession; + //session/circuit not authorised + m_log.Info("[CLIENT]: New user request denied to " + m_userEndPoint.ToString()); + m_packetQueue.Close(); + m_clientThread.Abort(); } - // This sets up all the timers - InitNewClient(); + else + { + m_log.Info("[CLIENT]: Got authenticated connection from " + m_userEndPoint.ToString()); + //session is authorised + m_firstName = sessionInfo.LoginInfo.First; + m_lastName = sessionInfo.LoginInfo.Last; + + if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero) + { + m_secureSessionId = sessionInfo.LoginInfo.SecureSession; + } + // This sets up all the timers + InitNewClient(); - ClientLoop(); + ClientLoop(); + } + } + catch (Exception e) + { + // Don't let a failure in an individual client thread crash the whole sim. + // FIXME: possibly more sophisticated cleanup since leaving client resources around will + // probably cause long term instability. I think this is still better than bring down the whole + // region + m_log.ErrorFormat("[CLIENT]: Client thread for {0} {1} crashed. Exception {2}", Name, AgentId, e); } } -- cgit v1.1