aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs2
6 files changed, 30 insertions, 42 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 39d7512..37b5776 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes
144 /// Triggered when a new presence is added to the scene 144 /// Triggered when a new presence is added to the scene
145 /// </summary> 145 /// </summary>
146 /// <remarks> 146 /// <remarks>
147 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> which is used by both 147 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewAgent"/> which is used by both
148 /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see> 148 /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see>
149 /// </remarks> 149 /// </remarks>
150 public event OnNewPresenceDelegate OnNewPresence; 150 public event OnNewPresenceDelegate OnNewPresence;
@@ -155,7 +155,7 @@ namespace OpenSim.Region.Framework.Scenes
155 /// Triggered when a presence is removed from the scene 155 /// Triggered when a presence is removed from the scene
156 /// </summary> 156 /// </summary>
157 /// <remarks> 157 /// <remarks>
158 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> which is used by both 158 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewAgent"/> which is used by both
159 /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see> 159 /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see>
160 /// 160 ///
161 /// Triggered under per-agent lock. So if you want to perform any long-running operations, please 161 /// Triggered under per-agent lock. So if you want to perform any long-running operations, please
@@ -1102,7 +1102,7 @@ namespace OpenSim.Region.Framework.Scenes
1102 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessMoneyTransferRequest"/> 1102 /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessMoneyTransferRequest"/>
1103 /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientGridEvents"/> 1103 /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientGridEvents"/>
1104 /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientEvents"/> 1104 /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientEvents"/>
1105 /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> 1105 /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewAgent"/>
1106 /// </remarks> 1106 /// </remarks>
1107 public event MoneyTransferEvent OnMoneyTransfer; 1107 public event MoneyTransferEvent OnMoneyTransfer;
1108 1108
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b714c7f..49e32c6 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);
@@ -2802,7 +2802,7 @@ namespace OpenSim.Region.Framework.Scenes
2802 2802
2803 #region Add/Remove Avatar Methods 2803 #region Add/Remove Avatar Methods
2804 2804
2805 public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) 2805 public override ISceneAgent AddNewAgent(IClientAPI client, PresenceType type)
2806 { 2806 {
2807 ScenePresence sp; 2807 ScenePresence sp;
2808 bool vialogin; 2808 bool vialogin;
@@ -2810,7 +2810,7 @@ namespace OpenSim.Region.Framework.Scenes
2810 2810
2811 // Validation occurs in LLUDPServer 2811 // Validation occurs in LLUDPServer
2812 // 2812 //
2813 // XXX: A race condition exists here where two simultaneous calls to AddNewClient can interfere with 2813 // XXX: A race condition exists here where two simultaneous calls to AddNewAgent can interfere with
2814 // each other. In practice, this does not currently occur in the code. 2814 // each other. In practice, this does not currently occur in the code.
2815 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2815 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2816 2816
@@ -2818,9 +2818,9 @@ namespace OpenSim.Region.Framework.Scenes
2818 // and a simultaneous one that removes it (as can happen if the client is closed at a particular point 2818 // and a simultaneous one that removes it (as can happen if the client is closed at a particular point
2819 // whilst connecting). 2819 // whilst connecting).
2820 // 2820 //
2821 // It would be easier to lock across all NewUserConnection(), AddNewClient() and 2821 // It would be easier to lock across all NewUserConnection(), AddNewAgent() and
2822 // RemoveClient() calls for all agents, but this would allow a slow call (e.g. because of slow service 2822 // RemoveClient() calls for all agents, but this would allow a slow call (e.g. because of slow service
2823 // response in some module listening to AddNewClient()) from holding up unrelated agent calls. 2823 // response in some module listening to AddNewAgent()) from holding up unrelated agent calls.
2824 // 2824 //
2825 // In practice, the lock (this) in LLUDPServer.AddNewClient() currently lock across all 2825 // In practice, the lock (this) in LLUDPServer.AddNewClient() currently lock across all
2826 // AddNewClient() operations (though not other ops). 2826 // AddNewClient() operations (though not other ops).
@@ -2837,7 +2837,7 @@ namespace OpenSim.Region.Framework.Scenes
2837 2837
2838 // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this 2838 // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this
2839 // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause 2839 // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause
2840 // other problems, and possible the code calling AddNewClient() should ensure that no client is already 2840 // other problems, and possibly the code calling AddNewAgent() should ensure that no client is already
2841 // connected. 2841 // connected.
2842 if (sp == null) 2842 if (sp == null)
2843 { 2843 {
@@ -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 }
@@ -4306,7 +4306,7 @@ namespace OpenSim.Region.Framework.Scenes
4306 // We have to wait until the viewer contacts this region 4306 // We have to wait until the viewer contacts this region
4307 // after receiving the EnableSimulator HTTP Event Queue message (for the v1 teleport protocol) 4307 // after receiving the EnableSimulator HTTP Event Queue message (for the v1 teleport protocol)
4308 // or TeleportFinish (for the v2 teleport protocol). This triggers the viewer to send 4308 // or TeleportFinish (for the v2 teleport protocol). This triggers the viewer to send
4309 // a UseCircuitCode packet which in turn calls AddNewClient which finally creates the ScenePresence. 4309 // a UseCircuitCode packet which in turn calls AddNewAgent which finally creates the ScenePresence.
4310 ScenePresence sp = WaitGetScenePresence(cAgentData.AgentID); 4310 ScenePresence sp = WaitGetScenePresence(cAgentData.AgentID);
4311 4311
4312 if (sp != null) 4312 if (sp != null)
@@ -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..4f04706 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -216,21 +216,9 @@ namespace OpenSim.Region.Framework.Scenes
216 216
217 #region Add/Remove Agent/Avatar 217 #region Add/Remove Agent/Avatar
218 218
219 public abstract ISceneAgent AddNewClient(IClientAPI client, PresenceType type); 219 public abstract ISceneAgent AddNewAgent(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..d1aeaee 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);
@@ -200,7 +200,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
200 // *** This is the second stage, where the client established a child agent/scene presence using the 200 // *** This is the second stage, where the client established a child agent/scene presence using the
201 // circuit code given to the scene in stage 1 *** 201 // circuit code given to the scene in stage 1 ***
202 TestClient client = new TestClient(acd, scene); 202 TestClient client = new TestClient(acd, scene);
203 scene.AddNewClient(client, PresenceType.User); 203 scene.AddNewAgent(client, PresenceType.User);
204 204
205 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); 205 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null);
206 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); 206 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
@@ -279,7 +279,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
279// string reason; 279// string reason;
280// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); 280// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
281// testclient = new TestClient(agent, scene); 281// testclient = new TestClient(agent, scene);
282// scene.AddNewClient(testclient); 282// scene.AddNewAgent(testclient);
283// 283//
284// ScenePresence presence = scene.GetScenePresence(agent1); 284// ScenePresence presence = scene.GetScenePresence(agent1);
285// 285//
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/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 3ba34dd..8c25dbc 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -185,7 +185,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
185 public void TestSameSimulatorIsolatedRegionsV2() 185 public void TestSameSimulatorIsolatedRegionsV2()
186 { 186 {
187 TestHelpers.InMethod(); 187 TestHelpers.InMethod();
188 TestHelpers.EnableLogging(); 188// TestHelpers.EnableLogging();
189 189
190 UUID userId = TestHelpers.ParseTail(0x1); 190 UUID userId = TestHelpers.ParseTail(0x1);
191 191