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;
/// <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 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();
//RegionInfo OtherRegionUp(RegionInfo thisRegion);

View File

@ -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

View File

@ -3091,11 +3091,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
/// Remove the given client from the scene.
/// </summary>
/// <param name="agentID"></param>
public override void RemoveClient(UUID agentID)
public override void RemoveClient(UUID agentID, bool closeChildAgents)
{
CheckHeartbeat();
bool childagentYN = false;
@ -3117,14 +3113,16 @@ namespace OpenSim.Region.Framework.Scenes
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<ulong> childknownRegions = new List<ulong>();
//List<ulong> 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)

View File

@ -175,18 +175,8 @@ namespace OpenSim.Region.Framework.Scenes
#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);
/// <summary>
/// Remove a client from the scene
/// </summary>
/// <param name="agentID"></param>
public abstract void RemoveClient(UUID agentID);
public abstract void RemoveClient(UUID agentID, bool closeChildAgents);
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.
/// </summary>
/// <param name="client"></param>
/// <param name="enableNeighbourChildAgents">
/// <param name="openChildAgents">
/// 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
/// </param>
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<IEntityTransferModule>();
if (m_agentTransfer != null)

View File

@ -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;

View File

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