aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-09-27 19:14:21 +0100
committerJustin Clark-Casey (justincc)2013-09-27 19:14:21 +0100
commitb16bc7b01ca0691758e66f85238d657f02271082 (patch)
tree4e121ace10b7dee25e1311268a84d3e95946f6f9 /OpenSim/Region
parentminor code formatting for the sake of consistency and readability (diff)
downloadopensim-SC-b16bc7b01ca0691758e66f85238d657f02271082.zip
opensim-SC-b16bc7b01ca0691758e66f85238d657f02271082.tar.gz
opensim-SC-b16bc7b01ca0691758e66f85238d657f02271082.tar.bz2
opensim-SC-b16bc7b01ca0691758e66f85238d657f02271082.tar.xz
refactor: rename Scene.IncomingCloseAgent() to CloseAgent() in order to make it clear that all non-clientstack callers should be using this rather than RemoveClient() in order to step through the ScenePresence state machine properly.
Adds IScene.CloseAgent() to replace RemoveClient()
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
15 files changed, 36 insertions, 48 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index a7fe226..12250df 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -452,7 +452,7 @@ namespace OpenSim
452 else 452 else
453 presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n"); 453 presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n");
454 454
455 presence.Scene.IncomingCloseAgent(presence.UUID, force); 455 presence.Scene.CloseAgent(presence.UUID, force);
456 break; 456 break;
457 } 457 }
458 } 458 }
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
index b3b0b8a..9e24bce 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
@@ -96,7 +96,7 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
96 UUID spId = TestHelpers.ParseTail(0x1); 96 UUID spId = TestHelpers.ParseTail(0x1);
97 97
98 SceneHelpers.AddScenePresence(m_scene, spId); 98 SceneHelpers.AddScenePresence(m_scene, spId);
99 m_scene.IncomingCloseAgent(spId, false); 99 m_scene.CloseAgent(spId, false);
100 100
101 // TODO: Add more assertions for the other aspects of event queues 101 // TODO: Add more assertions for the other aspects of event queues
102 Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0)); 102 Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0));
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 9504f15..5296a6d 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -1893,7 +1893,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1893 client.Kick("Simulator logged you out due to connection timeout."); 1893 client.Kick("Simulator logged you out due to connection timeout.");
1894 } 1894 }
1895 1895
1896 m_scene.IncomingCloseAgent(client.AgentId, true); 1896 m_scene.CloseAgent(client.AgentId, true);
1897 } 1897 }
1898 1898
1899 private void IncomingPacketHandler() 1899 private void IncomingPacketHandler()
@@ -2234,7 +2234,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2234 if (!client.IsLoggingOut) 2234 if (!client.IsLoggingOut)
2235 { 2235 {
2236 client.IsLoggingOut = true; 2236 client.IsLoggingOut = true;
2237 m_scene.IncomingCloseAgent(client.AgentId, false); 2237 m_scene.CloseAgent(client.AgentId, false);
2238 } 2238 }
2239 } 2239 }
2240 } 2240 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
index 119a677..28b5eb7 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
@@ -59,10 +59,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
59 // FIXME 59 // FIXME
60 return null; 60 return null;
61 } 61 }
62 62
63 public override void RemoveClient(UUID agentID, bool someReason) {} 63 public override bool CloseAgent(UUID agentID, bool force) { return true; }
64// public override void CloseAllAgents(uint circuitcode) {}
65 public override bool CheckClient(UUID clientId, IPEndPoint endPoint) { return true; } 64 public override bool CheckClient(UUID clientId, IPEndPoint endPoint) { return true; }
65
66 public override void OtherRegionUp(GridRegion otherRegion) { } 66 public override void OtherRegionUp(GridRegion otherRegion) { }
67 67
68 public override bool TryGetScenePresence(UUID uuid, out ScenePresence sp) { sp = null; return false; } 68 public override bool TryGetScenePresence(UUID uuid, out ScenePresence sp) { sp = null; return false; }
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index fd493fc..4e58045 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -719,7 +719,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
719 SceneObjectGroup rezzedAtt = presence.GetAttachments()[0]; 719 SceneObjectGroup rezzedAtt = presence.GetAttachments()[0];
720 720
721 m_numberOfAttachEventsFired = 0; 721 m_numberOfAttachEventsFired = 0;
722 scene.IncomingCloseAgent(presence.UUID, false); 722 scene.CloseAgent(presence.UUID, false);
723 723
724 // Check that we can't retrieve this attachment from the scene. 724 // Check that we can't retrieve this attachment from the scene.
725 Assert.That(scene.GetSceneObjectGroup(rezzedAtt.UUID), Is.Null); 725 Assert.That(scene.GetSceneObjectGroup(rezzedAtt.UUID), Is.Null);
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index 0cd495c..3b6d970 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
@@ -272,7 +272,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
272 if (sp.IsChildAgent) 272 if (sp.IsChildAgent)
273 return; 273 return;
274 sp.ControllingClient.Kick(reason); 274 sp.ControllingClient.Kick(reason);
275 sp.Scene.IncomingCloseAgent(sp.UUID, true); 275 sp.Scene.CloseAgent(sp.UUID, true);
276 } 276 }
277 277
278 private void OnIncomingInstantMessage(GridInstantMessage msg) 278 private void OnIncomingInstantMessage(GridInstantMessage msg)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 8ae81ac..aa8a4db 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -972,7 +972,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
972 972
973 if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) 973 if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
974 { 974 {
975 if (!sp.Scene.IncomingPreCloseAgent(sp)) 975 if (!sp.Scene.IncomingPreCloseClient(sp))
976 return; 976 return;
977 977
978 // We need to delay here because Imprudence viewers, unlike v1 or v3, have a short (<200ms, <500ms) delay before 978 // We need to delay here because Imprudence viewers, unlike v1 or v3, have a short (<200ms, <500ms) delay before
@@ -983,7 +983,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
983 // an agent cannot teleport back to this region if it has teleported away. 983 // an agent cannot teleport back to this region if it has teleported away.
984 Thread.Sleep(2000); 984 Thread.Sleep(2000);
985 985
986 sp.Scene.IncomingCloseAgent(sp.UUID, false); 986 sp.Scene.CloseAgent(sp.UUID, false);
987 } 987 }
988 else 988 else
989 { 989 {
@@ -1137,7 +1137,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1137 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 1137 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
1138 if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) 1138 if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
1139 { 1139 {
1140 if (!sp.Scene.IncomingPreCloseAgent(sp)) 1140 if (!sp.Scene.IncomingPreCloseClient(sp))
1141 return; 1141 return;
1142 1142
1143 // RED ALERT!!!! 1143 // RED ALERT!!!!
@@ -1154,7 +1154,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1154 m_log.DebugFormat( 1154 m_log.DebugFormat(
1155 "[ENTITY TRANSFER MODULE]: Closing agent {0} in {1} after teleport", sp.Name, Scene.Name); 1155 "[ENTITY TRANSFER MODULE]: Closing agent {0} in {1} after teleport", sp.Name, Scene.Name);
1156 1156
1157 sp.Scene.IncomingCloseAgent(sp.UUID, false); 1157 sp.Scene.CloseAgent(sp.UUID, false);
1158 } 1158 }
1159 else 1159 else
1160 { 1160 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 5c098a8..678f3dc 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -311,7 +311,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
311// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", 311// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
312// s.RegionInfo.RegionName, destination.RegionHandle); 312// s.RegionInfo.RegionName, destination.RegionHandle);
313 313
314 m_scenes[destination.RegionID].IncomingCloseAgent(id, false, auth_token); 314 m_scenes[destination.RegionID].CloseAgent(id, false, auth_token);
315 return true; 315 return true;
316 } 316 }
317 317
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 31547a6..42db1cf 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -562,7 +562,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
562 if (!Scene.TeleportClientHome(user, s.ControllingClient)) 562 if (!Scene.TeleportClientHome(user, s.ControllingClient))
563 { 563 {
564 s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out."); 564 s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out.");
565 Scene.IncomingCloseAgent(s.UUID, false); 565 Scene.CloseAgent(s.UUID, false);
566 } 566 }
567 } 567 }
568 } 568 }
@@ -797,7 +797,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
797 if (!Scene.TeleportClientHome(prey, s.ControllingClient)) 797 if (!Scene.TeleportClientHome(prey, s.ControllingClient))
798 { 798 {
799 s.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); 799 s.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out.");
800 Scene.IncomingCloseAgent(s.UUID, false); 800 Scene.CloseAgent(s.UUID, false);
801 } 801 }
802 } 802 }
803 } 803 }
@@ -820,7 +820,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
820 if (!Scene.TeleportClientHome(p.UUID, p.ControllingClient)) 820 if (!Scene.TeleportClientHome(p.UUID, p.ControllingClient))
821 { 821 {
822 p.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); 822 p.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out.");
823 Scene.IncomingCloseAgent(p.UUID, false); 823 Scene.CloseAgent(p.UUID, false);
824 } 824 }
825 } 825 }
826 } 826 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 3dc509b..82abfe9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1313,7 +1313,7 @@ namespace OpenSim.Region.Framework.Scenes
1313 Thread.Sleep(500); 1313 Thread.Sleep(500);
1314 1314
1315 // Stop all client threads. 1315 // Stop all client threads.
1316 ForEachScenePresence(delegate(ScenePresence avatar) { IncomingCloseAgent(avatar.UUID, false); }); 1316 ForEachScenePresence(delegate(ScenePresence avatar) { CloseAgent(avatar.UUID, false); });
1317 1317
1318 m_log.Debug("[SCENE]: Persisting changed objects"); 1318 m_log.Debug("[SCENE]: Persisting changed objects");
1319 EventManager.TriggerSceneShuttingDown(this); 1319 EventManager.TriggerSceneShuttingDown(this);
@@ -2976,7 +2976,7 @@ namespace OpenSim.Region.Framework.Scenes
2976 { 2976 {
2977 PresenceService.LogoutAgent(sp.ControllingClient.SessionId); 2977 PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
2978 2978
2979 IncomingCloseAgent(sp.UUID, false); 2979 CloseAgent(sp.UUID, false);
2980 } 2980 }
2981 else 2981 else
2982 { 2982 {
@@ -3398,7 +3398,7 @@ namespace OpenSim.Region.Framework.Scenes
3398 /// <param name='closeChildAgents'> 3398 /// <param name='closeChildAgents'>
3399 /// Close the neighbour child agents associated with this client. 3399 /// Close the neighbour child agents associated with this client.
3400 /// </param> 3400 /// </param>
3401 public override void RemoveClient(UUID agentID, bool closeChildAgents) 3401 public void RemoveClient(UUID agentID, bool closeChildAgents)
3402 { 3402 {
3403 AgentCircuitData acd = m_authenticateHandler.GetAgentCircuitData(agentID); 3403 AgentCircuitData acd = m_authenticateHandler.GetAgentCircuitData(agentID);
3404 3404
@@ -3783,7 +3783,7 @@ namespace OpenSim.Region.Framework.Scenes
3783 sp.Name, sp.UUID, RegionInfo.RegionName); 3783 sp.Name, sp.UUID, RegionInfo.RegionName);
3784 3784
3785 if (sp.ControllingClient != null) 3785 if (sp.ControllingClient != null)
3786 IncomingCloseAgent(sp.UUID, true); 3786 CloseAgent(sp.UUID, true);
3787 3787
3788 sp = null; 3788 sp = null;
3789 } 3789 }
@@ -4424,7 +4424,7 @@ namespace OpenSim.Region.Framework.Scenes
4424 /// <param name="force"></param> 4424 /// <param name="force"></param>
4425 /// <param name="auth_token"></param> 4425 /// <param name="auth_token"></param>
4426 /// <returns></returns> 4426 /// <returns></returns>
4427 public bool IncomingCloseAgent(UUID agentID, bool force, string auth_token) 4427 public bool CloseAgent(UUID agentID, bool force, string auth_token)
4428 { 4428 {
4429 //m_log.DebugFormat("[SCENE]: Processing incoming close agent {0} in region {1} with auth_token {2}", agentID, RegionInfo.RegionName, auth_token); 4429 //m_log.DebugFormat("[SCENE]: Processing incoming close agent {0} in region {1} with auth_token {2}", agentID, RegionInfo.RegionName, auth_token);
4430 4430
@@ -4442,7 +4442,7 @@ namespace OpenSim.Region.Framework.Scenes
4442 4442
4443 if (acd.SessionID.ToString() == auth_token) 4443 if (acd.SessionID.ToString() == auth_token)
4444 { 4444 {
4445 return IncomingCloseAgent(agentID, force); 4445 return CloseAgent(agentID, force);
4446 } 4446 }
4447 else 4447 else
4448 { 4448 {
@@ -4455,16 +4455,16 @@ namespace OpenSim.Region.Framework.Scenes
4455 } 4455 }
4456 4456
4457 /// <summary> 4457 /// <summary>
4458 /// Tell a single agent to prepare to close. 4458 /// Tell a single client to prepare to close.
4459 /// </summary> 4459 /// </summary>
4460 /// <remarks> 4460 /// <remarks>
4461 /// This should only be called if we may close the agent but there will be some delay in so doing. Meant for 4461 /// This should only be called if we may close the client but there will be some delay in so doing. Meant for
4462 /// internal use - other callers should almost certainly called IncomingCloseAgent(). 4462 /// internal use - other callers should almost certainly called CloseClient().
4463 /// </remarks> 4463 /// </remarks>
4464 /// <param name="sp"></param> 4464 /// <param name="sp"></param>
4465 /// <returns>true if pre-close state notification was successful. false if the agent 4465 /// <returns>true if pre-close state notification was successful. false if the agent
4466 /// was not in a state where it could transition to pre-close.</returns> 4466 /// was not in a state where it could transition to pre-close.</returns>
4467 public bool IncomingPreCloseAgent(ScenePresence sp) 4467 public bool IncomingPreCloseClient(ScenePresence sp)
4468 { 4468 {
4469 lock (m_removeClientLock) 4469 lock (m_removeClientLock)
4470 { 4470 {
@@ -4506,7 +4506,7 @@ namespace OpenSim.Region.Framework.Scenes
4506 /// Force the agent to close even if it might be in the middle of some other operation. You do not want to 4506 /// Force the agent to close even if it might be in the middle of some other operation. You do not want to
4507 /// force unless you are absolutely sure that the agent is dead and a normal close is not working. 4507 /// force unless you are absolutely sure that the agent is dead and a normal close is not working.
4508 /// </param> 4508 /// </param>
4509 public bool IncomingCloseAgent(UUID agentID, bool force) 4509 public override bool CloseAgent(UUID agentID, bool force)
4510 { 4510 {
4511 ScenePresence sp; 4511 ScenePresence sp;
4512 4512
@@ -4517,7 +4517,7 @@ namespace OpenSim.Region.Framework.Scenes
4517 if (sp == null) 4517 if (sp == null)
4518 { 4518 {
4519 m_log.DebugFormat( 4519 m_log.DebugFormat(
4520 "[SCENE]: Called IncomingCloseAgent() with agent ID {0} but no such presence is in {1}", 4520 "[SCENE]: Called CloseClient() with agent ID {0} but no such presence is in {1}",
4521 agentID, Name); 4521 agentID, Name);
4522 4522
4523 return false; 4523 return false;
@@ -4526,7 +4526,7 @@ namespace OpenSim.Region.Framework.Scenes
4526 if (sp.LifecycleState != ScenePresenceState.Running && sp.LifecycleState != ScenePresenceState.PreRemove) 4526 if (sp.LifecycleState != ScenePresenceState.Running && sp.LifecycleState != ScenePresenceState.PreRemove)
4527 { 4527 {
4528 m_log.DebugFormat( 4528 m_log.DebugFormat(
4529 "[SCENE]: Called IncomingCloseAgent() for {0} in {1} but presence is already in state {2}", 4529 "[SCENE]: Called CloseClient() for {0} in {1} but presence is already in state {2}",
4530 sp.Name, Name, sp.LifecycleState); 4530 sp.Name, Name, sp.LifecycleState);
4531 4531
4532 return false; 4532 return false;
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 5252b96..4b37983 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -218,19 +218,7 @@ namespace OpenSim.Region.Framework.Scenes
218 218
219 public abstract ISceneAgent AddNewClient(IClientAPI client, PresenceType type); 219 public abstract ISceneAgent AddNewClient(IClientAPI client, PresenceType type);
220 220
221 /// <summary> 221 public abstract bool CloseAgent(UUID agentID, bool force);
222 /// Remove the given client from the scene.
223 /// </summary>
224 /// <remarks>
225 /// Only clientstack code should call this directly. All other code should call IncomingCloseAgent() instead
226 /// to properly operate the state machine and avoid race conditions with other close requests (such as directly
227 /// from viewers).
228 /// </remarks>
229 /// <param name='agentID'>ID of agent to close</param>
230 /// <param name='closeChildAgents'>
231 /// Close the neighbour child agents associated with this client.
232 /// </param>
233 public abstract void RemoveClient(UUID agentID, bool closeChildAgents);
234 222
235 public bool TryGetScenePresence(UUID agentID, out object scenePresence) 223 public bool TryGetScenePresence(UUID agentID, out object scenePresence)
236 { 224 {
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index bbe34d2..e25bcb7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
146 } 146 }
147 147
148 [Test] 148 [Test]
149 public void TestCloseAgent() 149 public void TestCloseClient()
150 { 150 {
151 TestHelpers.InMethod(); 151 TestHelpers.InMethod();
152// TestHelpers.EnableLogging(); 152// TestHelpers.EnableLogging();
@@ -154,7 +154,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
154 TestScene scene = new SceneHelpers().SetupScene(); 154 TestScene scene = new SceneHelpers().SetupScene();
155 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); 155 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
156 156
157 scene.IncomingCloseAgent(sp.UUID, false); 157 scene.CloseAgent(sp.UUID, false);
158 158
159 Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); 159 Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
160 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); 160 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
index b6fb730..4fdfc74 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
@@ -79,7 +79,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
79 79
80 // TODO: Need to add tests for other ICapabiltiesModule methods. 80 // TODO: Need to add tests for other ICapabiltiesModule methods.
81 81
82 scene.IncomingCloseAgent(sp.UUID, false); 82 scene.CloseAgent(sp.UUID, false);
83 Assert.That(capsMod.GetCapsForUser(spUuid), Is.Null); 83 Assert.That(capsMod.GetCapsForUser(spUuid), Is.Null);
84 84
85 // TODO: Need to add tests for other ICapabiltiesModule methods. 85 // TODO: Need to add tests for other ICapabiltiesModule methods.
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index b863370..740f75a 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -384,7 +384,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
384 agentID, av.Name); 384 agentID, av.Name);
385 */ 385 */
386 386
387 scene.IncomingCloseAgent(agentID, false); 387 scene.CloseAgent(agentID, false);
388 388
389 m_avatars.Remove(agentID); 389 m_avatars.Remove(agentID);
390 390
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 415166a..f4d5562 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2964,7 +2964,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2964 sp.ControllingClient.Kick(alert); 2964 sp.ControllingClient.Kick(alert);
2965 2965
2966 // ...and close on our side 2966 // ...and close on our side
2967 sp.Scene.IncomingCloseAgent(sp.UUID, false); 2967 sp.Scene.CloseAgent(sp.UUID, false);
2968 } 2968 }
2969 }); 2969 });
2970 } 2970 }