Stop trying to deregister caps or close child agents when an NPC is removed

bulletsim
Justin Clark-Casey (justincc) 2011-08-10 00:59:31 +01:00
parent 195c1dc9b8
commit 4cb8d6379d
7 changed files with 26 additions and 26 deletions

View File

@ -70,8 +70,19 @@ namespace OpenSim.Framework
event restart OnRestart; event restart OnRestart;
/// <summary>
/// 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.
/// </summary>
/// <param name="client"></param
void AddNewClient(IClientAPI client); void AddNewClient(IClientAPI client);
void RemoveClient(UUID agentID);
/// <summary>
/// Remove the given client from the scene.
/// </summary>
/// <param name="agentID"></param>
/// <param name="closeChildAgents">Close the neighbour child agents associated with this client.</param>
void RemoveClient(UUID agentID, bool closeChildAgents);
void Restart(); void Restart();
//RegionInfo OtherRegionUp(RegionInfo thisRegion); //RegionInfo OtherRegionUp(RegionInfo thisRegion);

View File

@ -512,7 +512,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_udpServer.Flush(m_udpClient); m_udpServer.Flush(m_udpClient);
// Remove ourselves from the scene // 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 can't reach into other scenes and close the connection
// We need to do this over grid communications // We need to do this over grid communications

View File

@ -3091,11 +3091,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary> public override void RemoveClient(UUID agentID, bool closeChildAgents)
/// Remove the given client from the scene.
/// </summary>
/// <param name="agentID"></param>
public override void RemoveClient(UUID agentID)
{ {
CheckHeartbeat(); CheckHeartbeat();
bool childagentYN = false; bool childagentYN = false;
@ -3117,14 +3113,16 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.removeUserCount(!childagentYN); 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); CapsModule.RemoveCaps(agentID);
// REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
// this method is doing is HORRIBLE!!! // this method is doing is HORRIBLE!!!
avatar.Scene.NeedSceneCacheClear(avatar.UUID); avatar.Scene.NeedSceneCacheClear(avatar.UUID);
if (!avatar.IsChildAgent) if (closeChildAgents && !avatar.IsChildAgent)
{ {
//List<ulong> childknownRegions = new List<ulong>(); //List<ulong> childknownRegions = new List<ulong>();
//List<ulong> ckn = avatar.KnownChildRegionHandles; //List<ulong> ckn = avatar.KnownChildRegionHandles;
@ -3136,6 +3134,7 @@ namespace OpenSim.Region.Framework.Scenes
regions.Remove(RegionInfo.RegionHandle); regions.Remove(RegionInfo.RegionHandle);
m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); m_sceneGridService.SendCloseChildAgentConnections(agentID, regions);
} }
m_eventManager.TriggerClientClosed(agentID, this); m_eventManager.TriggerClientClosed(agentID, this);
} }
catch (NullReferenceException) catch (NullReferenceException)

View File

@ -175,18 +175,8 @@ namespace OpenSim.Region.Framework.Scenes
#region Add/Remove Agent/Avatar #region Add/Remove Agent/Avatar
/// <summary>
/// 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.
/// </summary>
/// <param name="client"></param
public abstract void AddNewClient(IClientAPI client); public abstract void AddNewClient(IClientAPI client);
public abstract void RemoveClient(UUID agentID, bool closeChildAgents);
/// <summary>
/// Remove a client from the scene
/// </summary>
/// <param name="agentID"></param>
public abstract void RemoveClient(UUID agentID);
public bool TryGetScenePresence(UUID agentID, out object scenePresence) public bool TryGetScenePresence(UUID agentID, out object scenePresence)
{ {

View File

@ -1146,12 +1146,12 @@ namespace OpenSim.Region.Framework.Scenes
/// Complete Avatar's movement into the region. /// Complete Avatar's movement into the region.
/// </summary> /// </summary>
/// <param name="client"></param> /// <param name="client"></param>
/// <param name="enableNeighbourChildAgents"> /// <param name="openChildAgents">
/// If true, send notification to neighbour regions to expect /// 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 /// 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 /// configuration of DefaultDrawDistance in the [Startup] section of config
/// </param> /// </param>
public void CompleteMovement(IClientAPI client, bool enableNeighbourChildAgents) public void CompleteMovement(IClientAPI client, bool openChildAgents)
{ {
// DateTime startTime = DateTime.Now; // DateTime startTime = DateTime.Now;
@ -1192,7 +1192,7 @@ namespace OpenSim.Region.Framework.Scenes
SendInitialData(); SendInitialData();
// Create child agents in neighbouring regions // Create child agents in neighbouring regions
if (enableNeighbourChildAgents && !m_isChildAgent) if (openChildAgents && !m_isChildAgent)
{ {
IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
if (m_agentTransfer != null) if (m_agentTransfer != null)

View File

@ -278,7 +278,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
if (m_avatars.ContainsKey(agentID)) if (m_avatars.ContainsKey(agentID))
{ {
scene.RemoveClient(agentID); scene.RemoveClient(agentID, false);
m_avatars.Remove(agentID); m_avatars.Remove(agentID);
return true; return true;

View File

@ -887,7 +887,7 @@ namespace OpenSim.Tests.Common.Mock
public void Close() public void Close()
{ {
m_scene.RemoveClient(AgentId); m_scene.RemoveClient(AgentId, true);
} }
public void Start() public void Start()