From dc11643c007adf7a640ec4fbabe25995352aaa18 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 13 Oct 2009 17:33:45 -0700 Subject: * Consolidated adding / removing ClientManager IClientAPIs to two places in Scene * Added some missing implementations of IClientAPI.RemoteEndPoint * Added a ClientManager.Remove(UUID) overload * Removed a reference to a missing project from prebuild.xml --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 61 +--------------------- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 13 ++--- 2 files changed, 5 insertions(+), 69 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index aecb362..0acf6e8 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -324,6 +324,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Properties public LLUDPClient UDPClient { get { return m_udpClient; } } + public IPEndPoint RemoteEndPoint { get { return m_udpClient.RemoteEndPoint; } } public UUID SecureSessionId { get { return m_secureSessionId; } } public IScene Scene { get { return m_scene; } } public UUID SessionId { get { return m_sessionId; } } @@ -431,7 +432,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Remove ourselves from the scene m_scene.RemoveClient(AgentId); - m_scene.ClientManager.Remove(this); //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //GC.Collect(); @@ -586,11 +586,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP # region Setup - /// - /// Starts up the timers to check the client and resend unacked packets - /// Adds the client to the OpenSim.Region.Framework.Scenes.Scene - /// - protected virtual void InitNewClient() + public virtual void Start() { m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate); m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates); @@ -609,59 +605,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP RefreshGroupMembership(); } - public virtual void Start() - { - // This sets up all the timers - InitNewClient(); - } - - /// - /// Run a user session. This method lies at the base of the entire client thread. - /// - protected void RunUserSession() - { - try - { - - } - catch (Exception e) - { - if (e is ThreadAbortException) - throw; - - if (StatsManager.SimExtraStats != null) - StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); - - // Don't let a failure in an individual client thread crash the whole sim. - m_log.ErrorFormat( - "[CLIENT]: Client thread for {0} {1} crashed. Logging them out.", Name, AgentId); - m_log.Error(e.ToString()); - - try - { - // Make an attempt to alert the user that their session has crashed - AgentAlertMessagePacket packet - = BuildAgentAlertPacket( - "Unfortunately the session for this client on the server has crashed.\n" - + "Any further actions taken will not be processed.\n" - + "Please relog", true); - - OutPacket(packet, ThrottleOutPacketType.Unknown); - - // There may be a better way to do this. Perhaps kick? Not sure this propogates notifications to - // listeners yet, though. - Logout(this); - } - catch (Exception e2) - { - if (e2 is ThreadAbortException) - throw; - - m_log.ErrorFormat("[CLIENT]: Further exception thrown on forced session logout. {0}", e2); - } - } - } - # endregion public void ActivateGesture(UUID assetId, UUID gestureId) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 22c275c..8689af3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -646,7 +646,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP client.OnConnectionClosed += ConnectionClosedHandler; // Start the IClientAPI - m_scene.ClientManager.Add(client); client.Start(); } else @@ -658,10 +657,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void RemoveClient(LLUDPClient udpClient) { - // Remove this client from the scene ClientManager + // Remove this client from the scene IClientAPI client; if (m_scene.ClientManager.TryGetValue(udpClient.AgentID, out client)) - Util.FireAndForget(delegate(object o) { client.Close(); }); + client.Close(); } private void AcknowledgePacket(LLUDPClient client, uint ack, int currentTime, bool fromResend) @@ -810,19 +809,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void LogoutHandler(IClientAPI client) { client.OnLogout -= LogoutHandler; - client.SendLogoutPacket(); - - if (client is LLClientView) - RemoveClient(((LLClientView)client).UDPClient); } private void ConnectionClosedHandler(IClientAPI client) { client.OnConnectionClosed -= ConnectionClosedHandler; - - if (client is LLClientView) - RemoveClient(((LLClientView)client).UDPClient); + RemoveClient(((LLClientView)client).UDPClient); } } } -- cgit v1.1