* 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

0.6.0-stable
Justin Clarke Casey 2008-06-03 20:27:52 +00:00
parent 48322cec96
commit a987840191
1 changed files with 36 additions and 22 deletions

View File

@ -688,34 +688,48 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_scene.AddNewClient(this, true); m_scene.AddNewClient(this, true);
} }
/// <summary>
/// Authorize an incoming user session. This method lies at the base of the entire client thread.
/// </summary>
protected virtual void AuthUser() 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); try
AuthenticateResponse sessionInfo =
m_authenticateSessionsHandler.AuthenticateSession(m_sessionId, m_agentId,
m_circuitCode);
if (!sessionInfo.Authorised)
{ {
//session/circuit not authorised // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(m_cirpack.m_circuitCode.m_sessionId, m_cirpack.m_circuitCode.ID, m_cirpack.m_circuitCode.Code);
m_log.Info("[CLIENT]: New user request denied to " + m_userEndPoint.ToString()); AuthenticateResponse sessionInfo =
m_packetQueue.Close(); m_authenticateSessionsHandler.AuthenticateSession(m_sessionId, m_agentId,
m_clientThread.Abort(); m_circuitCode);
} if (!sessionInfo.Authorised)
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; //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 else
InitNewClient(); {
m_log.Info("[CLIENT]: Got authenticated connection from " + m_userEndPoint.ToString());
//session is authorised
m_firstName = sessionInfo.LoginInfo.First;
m_lastName = sessionInfo.LoginInfo.Last;
ClientLoop(); if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero)
{
m_secureSessionId = sessionInfo.LoginInfo.SecureSession;
}
// This sets up all the timers
InitNewClient();
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);
} }
} }