From 4cb8d6379ddb39cfb8b30a63475e154a00a78110 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Aug 2011 00:59:31 +0100 Subject: Stop trying to deregister caps or close child agents when an NPC is removed --- OpenSim/Framework/IScene.cs | 13 ++++++++++++- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 15 +++++++-------- OpenSim/Region/Framework/Scenes/SceneBase.cs | 12 +----------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 +++--- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 2 +- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index 1298f26..b5f975b 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -70,8 +70,19 @@ namespace OpenSim.Framework event restart OnRestart; + /// + /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing + /// will promote it to a root agent during login. + /// + /// + /// Remove the given client from the scene. + /// + /// + /// Close the neighbour child agents associated with this client. + void RemoveClient(UUID agentID, bool closeChildAgents); void Restart(); //RegionInfo OtherRegionUp(RegionInfo thisRegion); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 46d7f78..977918a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -512,7 +512,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpServer.Flush(m_udpClient); // Remove ourselves from the scene - m_scene.RemoveClient(AgentId); + m_scene.RemoveClient(AgentId, true); // We can't reach into other scenes and close the connection // We need to do this over grid communications diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b3b6cbc..9aa9bf5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3091,11 +3091,7 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// Remove the given client from the scene. - /// - /// - public override void RemoveClient(UUID agentID) + public override void RemoveClient(UUID agentID, bool closeChildAgents) { CheckHeartbeat(); bool childagentYN = false; @@ -3116,15 +3112,17 @@ namespace OpenSim.Region.Framework.Scenes (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); m_sceneGraph.removeUserCount(!childagentYN); - - if (CapsModule != null) + + // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop + // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI + if (closeChildAgents && CapsModule != null) CapsModule.RemoveCaps(agentID); // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever // this method is doing is HORRIBLE!!! avatar.Scene.NeedSceneCacheClear(avatar.UUID); - if (!avatar.IsChildAgent) + if (closeChildAgents && !avatar.IsChildAgent) { //List childknownRegions = new List(); //List ckn = avatar.KnownChildRegionHandles; @@ -3136,6 +3134,7 @@ namespace OpenSim.Region.Framework.Scenes regions.Remove(RegionInfo.RegionHandle); m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); } + m_eventManager.TriggerClientClosed(agentID, this); } catch (NullReferenceException) diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index c4547f2..2f1cdc1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -175,18 +175,8 @@ namespace OpenSim.Region.Framework.Scenes #region Add/Remove Agent/Avatar - /// - /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing - /// will promote it to a root agent during login. - /// - /// - /// Remove a client from the scene - /// - /// - public abstract void RemoveClient(UUID agentID); + public abstract void RemoveClient(UUID agentID, bool closeChildAgents); public bool TryGetScenePresence(UUID agentID, out object scenePresence) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index af28dd9..2db83eb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1146,12 +1146,12 @@ namespace OpenSim.Region.Framework.Scenes /// Complete Avatar's movement into the region. /// /// - /// + /// /// If true, send notification to neighbour regions to expect /// a child agent from the client. These neighbours can be some distance away, depending right now on the /// configuration of DefaultDrawDistance in the [Startup] section of config /// - public void CompleteMovement(IClientAPI client, bool enableNeighbourChildAgents) + public void CompleteMovement(IClientAPI client, bool openChildAgents) { // DateTime startTime = DateTime.Now; @@ -1192,7 +1192,7 @@ namespace OpenSim.Region.Framework.Scenes SendInitialData(); // Create child agents in neighbouring regions - if (enableNeighbourChildAgents && !m_isChildAgent) + if (openChildAgents && !m_isChildAgent) { IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 87cb322..7b9457a 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -278,7 +278,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { if (m_avatars.ContainsKey(agentID)) { - scene.RemoveClient(agentID); + scene.RemoveClient(agentID, false); m_avatars.Remove(agentID); return true; diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 7ec6e10..dd5f6fe 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -887,7 +887,7 @@ namespace OpenSim.Tests.Common.Mock public void Close() { - m_scene.RemoveClient(AgentId); + m_scene.RemoveClient(AgentId, true); } public void Start() -- cgit v1.1