Exemplo n.º 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>
        /// <param name="presence"></param>
        /// <param name="forceClose"></param>
        /// <returns></returns>
        public bool RemoveAgent(IScenePresence presence, bool forceClose)
        {
            AddAsyncEvent(delegate
            {
                presence.ControllingClient.Close(forceClose);
                foreach (IClientNetworkServer cns in m_clientServers)
                {
                    cns.RemoveClient(presence.ControllingClient);
                }

                if (presence.ParentID != UUID.Zero)
                {
                    presence.StandUp();
                }

                EventManager.TriggerOnClosingClient(presence.ControllingClient);
                EventManager.TriggerOnRemovePresence(presence);

                ForEachClient(
                    delegate(IClientAPI client)
                {
                    if (client.AgentId != presence.UUID)
                    {
                        //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)
                        {
                        }
                    }
                });

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

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

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

                AuthenticateHandler.RemoveCircuit(presence.UUID);
                //MainConsole.Instance.InfoFormat("[SCENE] Memory pre  GC {0}", System.GC.GetTotalMemory(false));
                //MainConsole.Instance.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true));
            });
            return(true);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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>
        /// <param name="presence"></param>
        /// <param name="forceClose"></param>
        /// <returns></returns>
        public bool RemoveAgent(IScenePresence presence, bool forceClose)
        {
            AddAsyncEvent(delegate
                              {
                                  presence.ControllingClient.Close(forceClose);
                                  foreach (IClientNetworkServer cns in m_clientServers)
                                      cns.RemoveClient(presence.ControllingClient);

                                  if (presence.ParentID != UUID.Zero)
                                      presence.StandUp();

                                  EventManager.TriggerOnClosingClient(presence.ControllingClient);
                                  EventManager.TriggerOnRemovePresence(presence);

                                  ForEachClient(
                                      delegate(IClientAPI client)
                                          {
                                              if (client.AgentId != presence.UUID)
                                              {
                                                  //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)
                                                  {
                                                  }
                                              }
                                          });

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

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

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

                                  AuthenticateHandler.RemoveCircuit(presence.UUID);
                                  //MainConsole.Instance.InfoFormat("[SCENE] Memory pre  GC {0}", System.GC.GetTotalMemory(false));
                                  //MainConsole.Instance.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true));
                              });
            return true;
        }
Exemplo n.º 4
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:Presence.Close 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;
        }