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/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 +-
5 files changed, 13 insertions(+), 24 deletions(-)
(limited to 'OpenSim/Region')
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;
--
cgit v1.1