From 395a8680c3633ca131e7481f765517311ef51710 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 13 Oct 2009 16:53:19 -0700 Subject: * Fixed a bug where clients were being added to ClientManager twice * Changed the ClientManager interface to reduce potential errors with duplicate or mismatched keys * Added IClientAPI.RemoteEndPoint, which can (hopefully) eventually replace IClientAPI.CircuitCode * Changed the order of operations during client shutdown --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 36 +++++++++------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 86d0112..aecb362 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -411,38 +411,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP "[CLIENT]: Close has been called for {0} attached to scene {1}", Name, m_scene.RegionInfo.RegionName); - // Remove ourselves from the scene - m_scene.ClientManager.Remove(m_agentId, m_udpClient.RemoteEndPoint); + // Send the STOP packet + DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); + OutPacket(disable, ThrottleOutPacketType.Unknown); + + IsActive = false; + // Shutdown the image manager if (m_imageManager != null) - { m_imageManager.Close(); - m_imageManager = null; - } - - if (m_udpServer != null) - { - m_udpServer.Flush(); - } + // Fire the callback for this connection closing if (OnConnectionClosed != null) OnConnectionClosed(this); - CloseCleanup(); - } + // Flush all of the packets out of the UDP server for this client + if (m_udpServer != null) + m_udpServer.Flush(m_udpClient); - private void CloseCleanup() - { + // 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(); //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); - // Send the STOP packet - DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); - OutPacket(disable, ThrottleOutPacketType.Unknown); - - Thread.Sleep(2000); + // FIXME: Is this still necessary? + //Thread.Sleep(2000); // Shut down timers. Thread Context of this method is murky. Lock all timers if (m_avatarTerseUpdateTimer.Enabled) @@ -459,8 +455,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // We need to do this over grid communications //m_scene.CloseAllAgents(CircuitCode); - IsActive = false; - m_avatarTerseUpdateTimer.Dispose(); m_primTerseUpdateTimer.Dispose(); m_primFullUpdateTimer.Dispose(); -- cgit v1.1