TriggerClientClosed() 공개 메소드

public TriggerClientClosed ( UUID ClientID, Scene scene ) : void
ClientID UUID
scene Scene
리턴 void
예제 #1
0
        /// <summary>
        /// Tell a single agent to disconnect from the region.
        /// Does not send the DisableSimulator EQM or close child agents
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public bool RemoveAgent(IScenePresence presence)
        {
            presence.ControllingClient.Close();
            if (presence.ParentID != UUID.Zero)
            {
                presence.StandUp();
            }

            EventManager.TriggerClientClosed(presence.UUID, this);
            EventManager.TriggerOnClosingClient(presence.ControllingClient);
            EventManager.TriggerOnRemovePresence(presence);

            ForEachClient(
                delegate(IClientAPI client)
            {
                //We can safely ignore null reference exceptions.  It means the avatar is dead and cleaned up anyway
                try { client.SendKillObject(presence.Scene.RegionInfo.RegionHandle, new IEntity[] { presence }); }
                catch (NullReferenceException) { }
            });

            try
            {
                presence.Close();
            }
            catch (Exception e)
            {
                m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString());
            }

            //Remove any interfaces it might have stored
            presence.RemoveAllInterfaces();

            // Remove the avatar from the scene
            m_sceneGraph.RemoveScenePresence(presence);
            m_clientManager.Remove(presence.UUID);

            AuthenticateHandler.RemoveCircuit(presence.ControllingClient.CircuitCode);
            //m_log.InfoFormat("[SCENE] Memory pre  GC {0}", System.GC.GetTotalMemory(false));
            //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true));
            return(true);
        }