aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-07-20 09:31:06 +0100
committerMelanie2012-07-20 09:31:06 +0100
commit7da744566d491a30c1baf99af39478518d75a6a9 (patch)
tree3f69ee9d45475fd4e8d09a85b0ab78150f3d9943 /OpenSim
parentMerge branch 'master' into careminster (diff)
parentminor: switch around mixed up circuit code and endpoint data in "show connect... (diff)
downloadopensim-SC-7da744566d491a30c1baf99af39478518d75a6a9.zip
opensim-SC-7da744566d491a30c1baf99af39478518d75a6a9.tar.gz
opensim-SC-7da744566d491a30c1baf99af39478518d75a6a9.tar.bz2
opensim-SC-7da744566d491a30c1baf99af39478518d75a6a9.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs59
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs29
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs27
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs302
-rwxr-xr-xOpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs2
11 files changed, 272 insertions, 202 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index e6b57c2..8a0b4ab 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -1145,8 +1145,8 @@ namespace OpenSim
1145 c => cdt.AddRow( 1145 c => cdt.AddRow(
1146 s.Name, 1146 s.Name,
1147 c.Name, 1147 c.Name,
1148 c.RemoteEndPoint.ToString(),
1149 c.CircuitCode.ToString(), 1148 c.CircuitCode.ToString(),
1149 c.RemoteEndPoint.ToString(),
1150 c.IsActive.ToString()))); 1150 c.IsActive.ToString())));
1151 1151
1152 MainConsole.Instance.Output(cdt.ToString()); 1152 MainConsole.Instance.Output(cdt.ToString());
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index e6289bd..4be83f3 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -355,8 +355,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
355 private int m_animationSequenceNumber = 1; 355 private int m_animationSequenceNumber = 1;
356 private bool m_SendLogoutPacketWhenClosing = true; 356 private bool m_SendLogoutPacketWhenClosing = true;
357 private AgentUpdateArgs lastarg; 357 private AgentUpdateArgs lastarg;
358 private bool m_IsActive = true;
359 private bool m_IsLoggingOut = false;
360 358
361 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); 359 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>();
362 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers 360 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers
@@ -428,16 +426,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
428 public uint CircuitCode { get { return m_circuitCode; } } 426 public uint CircuitCode { get { return m_circuitCode; } }
429 public int MoneyBalance { get { return m_moneyBalance; } } 427 public int MoneyBalance { get { return m_moneyBalance; } }
430 public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } 428 public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } }
431 public bool IsActive 429
432 { 430 /// <summary>
433 get { return m_IsActive; } 431 /// As well as it's function in IClientAPI, in LLClientView we are locking on this property in order to
434 set { m_IsActive = value; } 432 /// prevent race conditions by different threads calling Close().
435 } 433 /// </summary>
436 public bool IsLoggingOut 434 public bool IsActive { get; set; }
437 { 435
438 get { return m_IsLoggingOut; } 436 /// <summary>
439 set { m_IsLoggingOut = value; } 437 /// Used to synchronise threads when client is being closed.
440 } 438 /// </summary>
439 public Object CloseSyncLock { get; private set; }
440
441 public bool IsLoggingOut { get; set; }
441 442
442 public bool DisableFacelights 443 public bool DisableFacelights
443 { 444 {
@@ -462,6 +463,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
462 { 463 {
463// DebugPacketLevel = 1; 464// DebugPacketLevel = 1;
464 465
466 CloseSyncLock = new Object();
467
465 RegisterInterface<IClientIM>(this); 468 RegisterInterface<IClientIM>(this);
466 RegisterInterface<IClientInventory>(this); 469 RegisterInterface<IClientInventory>(this);
467 RegisterInterface<IClientChat>(this); 470 RegisterInterface<IClientChat>(this);
@@ -494,13 +497,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
494 m_prioritizer = new Prioritizer(m_scene); 497 m_prioritizer = new Prioritizer(m_scene);
495 498
496 RegisterLocalPacketHandlers(); 499 RegisterLocalPacketHandlers();
500
501 IsActive = true;
497 } 502 }
498 503
499 #region Client Methods 504 #region Client Methods
500 505
501 506
502 /// <summary> 507 /// <summary>
503 /// Shut down the client view 508 /// Close down the client view
504 /// </summary> 509 /// </summary>
505 public void Close() 510 public void Close()
506 { 511 {
@@ -513,7 +518,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
513 public void Close(bool sendStop) 518 public void Close(bool sendStop)
514 { 519 {
515 IsActive = false; 520 IsActive = false;
521 // We lock here to prevent race conditions between two threads calling close simultaneously (e.g.
522 // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection.
523 lock (CloseSyncLock)
524 {
525 if (!IsActive)
526 return;
527
528 IsActive = false;
529 CloseWithoutChecks(sendStop);
530 }
531 }
516 532
533 /// <summary>
534 /// Closes down the client view without first checking whether it is active.
535 /// </summary>
536 /// <remarks>
537 /// This exists because LLUDPServer has to set IsActive = false in earlier synchronous code before calling
538 /// CloseWithoutIsActiveCheck asynchronously.
539 ///
540 /// Callers must lock ClosingSyncLock before calling.
541 /// </remarks>
542 public void CloseWithoutChecks(bool sendStop)
543 {
517 m_log.DebugFormat( 544 m_log.DebugFormat(
518 "[CLIENT]: Close has been called for {0} attached to scene {1}", 545 "[CLIENT]: Close has been called for {0} attached to scene {1}",
519 Name, m_scene.RegionInfo.RegionName); 546 Name, m_scene.RegionInfo.RegionName);
@@ -3630,7 +3657,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3630 3657
3631 public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) 3658 public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)
3632 { 3659 {
3633 if (!IsActive) return; // We don't need to update inactive clients. 3660 // We don't need to update inactive clients.
3661 if (!IsActive)
3662 return;
3634 3663
3635 CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); 3664 CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate);
3636 loc.Header.Reliable = false; 3665 loc.Header.Reliable = false;
@@ -5263,7 +5292,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5263 AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 5292 AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
5264 AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate); 5293 AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate);
5265 AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply); 5294 AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply);
5266 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage, false); 5295 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage);
5267 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship); 5296 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship);
5268 AddLocalPacketHandler(PacketType.DeclineFriendship, HandlerDeclineFriendship); 5297 AddLocalPacketHandler(PacketType.DeclineFriendship, HandlerDeclineFriendship);
5269 AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFriendship); 5298 AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFriendship);
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 79e35f4..140a953 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -1181,22 +1181,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1181 /// regular client pings. 1181 /// regular client pings.
1182 /// </remarks> 1182 /// </remarks>
1183 /// <param name='client'></param> 1183 /// <param name='client'></param>
1184 private void DeactivateClientDueToTimeout(IClientAPI client) 1184 private void DeactivateClientDueToTimeout(LLClientView client)
1185 { 1185 {
1186 // We must set IsActive synchronously so that we can stop the packet loop reinvoking this method, even 1186 lock (client.CloseSyncLock)
1187 // though it's set later on by LLClientView.Close() 1187 {
1188 client.IsActive = false; 1188 m_log.WarnFormat(
1189 1189 "[LLUDPSERVER]: Ack timeout, disconnecting {0} agent for {1} in {2}",
1190 m_log.WarnFormat( 1190 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, m_scene.RegionInfo.RegionName);
1191 "[LLUDPSERVER]: Ack timeout, disconnecting {0} agent for {1} in {2}", 1191
1192 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, m_scene.RegionInfo.RegionName); 1192 StatsManager.SimExtraStats.AddAbnormalClientThreadTermination();
1193 1193
1194 StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); 1194 if (!client.SceneAgent.IsChildAgent)
1195 1195 client.Kick("Simulator logged you out due to connection timeout");
1196 if (!client.SceneAgent.IsChildAgent) 1196
1197 client.Kick("Simulator logged you out due to connection timeout"); 1197 client.CloseWithoutChecks(true);
1198 1198 }
1199 Util.FireAndForget(o => client.Close());
1200 } 1199 }
1201 1200
1202 private void IncomingPacketHandler() 1201 private void IncomingPacketHandler()
diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
index 31363e5..b258e13 100644
--- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
@@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
96 96
97 scene.EventManager.OnNewClient += OnNewClient; 97 scene.EventManager.OnNewClient += OnNewClient;
98 scene.EventManager.OnClientClosed += OnClientClosed; 98 scene.EventManager.OnClientClosed += OnClientClosed;
99 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 99// scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
100 } 100 }
101 101
102 public void PostInitialise() 102 public void PostInitialise()
@@ -133,7 +133,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
133 private void OnNewClient(IClientAPI client) 133 private void OnNewClient(IClientAPI client)
134 { 134 {
135 // Subscribe to instant messages 135 // Subscribe to instant messages
136 client.OnInstantMessage += OnInstantMessage; 136// client.OnInstantMessage += OnInstantMessage;
137 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; 137 client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
138 client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; 138 client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
139 lock (m_ClientMap) 139 lock (m_ClientMap)
@@ -171,15 +171,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
171 ActiveGroupTitle); 171 ActiveGroupTitle);
172 } 172 }
173 173
174 private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 174// private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
175 { 175// {
176 } 176// }
177 177
178 private void OnGridInstantMessage(GridInstantMessage msg) 178// private void OnGridInstantMessage(GridInstantMessage msg)
179 { 179// {
180 // Trigger the above event handler 180// // Trigger the above event handler
181 OnInstantMessage(null, msg); 181// OnInstantMessage(null, msg);
182 } 182// }
183 183
184 private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client) 184 private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client)
185 { 185 {
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 9ddac19..50a176b 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -551,11 +551,5 @@ namespace OpenSim.Region.Framework.Scenes.Animation
551 551
552 SendAnimPack(animIDs, sequenceNums, objectIDs); 552 SendAnimPack(animIDs, sequenceNums, objectIDs);
553 } 553 }
554
555 public void Close()
556 {
557 m_animations = null;
558 m_scenePresence = null;
559 }
560 } 554 }
561} 555} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 645b3d5..56c58b7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3688,8 +3688,8 @@ namespace OpenSim.Region.Framework.Scenes
3688 // We have a zombie from a crashed session. 3688 // We have a zombie from a crashed session.
3689 // Or the same user is trying to be root twice here, won't work. 3689 // Or the same user is trying to be root twice here, won't work.
3690 // Kill it. 3690 // Kill it.
3691 m_log.DebugFormat( 3691 m_log.WarnFormat(
3692 "[SCENE]: Zombie scene presence detected for {0} {1} in {2}", 3692 "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.",
3693 sp.Name, sp.UUID, RegionInfo.RegionName); 3693 sp.Name, sp.UUID, RegionInfo.RegionName);
3694 3694
3695 sp.ControllingClient.Close(); 3695 sp.ControllingClient.Close();
@@ -4680,6 +4680,23 @@ namespace OpenSim.Region.Framework.Scenes
4680 } 4680 }
4681 4681
4682 /// <summary> 4682 /// <summary>
4683 /// Gets all the scene presences in this scene.
4684 /// </summary>
4685 /// <remarks>
4686 /// This method will return both root and child scene presences.
4687 ///
4688 /// Consider using ForEachScenePresence() or ForEachRootScenePresence() if possible since these will not
4689 /// involving creating a new List object.
4690 /// </remarks>
4691 /// <returns>
4692 /// A list of the scene presences. Adding or removing from the list will not affect the presences in the scene.
4693 /// </returns>
4694 public List<ScenePresence> GetScenePresences()
4695 {
4696 return new List<ScenePresence>(m_sceneGraph.GetScenePresences());
4697 }
4698
4699 /// <summary>
4683 /// Performs action on all avatars in the scene (root scene presences) 4700 /// Performs action on all avatars in the scene (root scene presences)
4684 /// Avatars may be an NPC or a 'real' client. 4701 /// Avatars may be an NPC or a 'real' client.
4685 /// </summary> 4702 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index c3d66eb..e0260e2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -848,7 +848,7 @@ namespace OpenSim.Region.Framework.Scenes
848 /// pass a delegate to ForEachScenePresence. 848 /// pass a delegate to ForEachScenePresence.
849 /// </summary> 849 /// </summary>
850 /// <returns></returns> 850 /// <returns></returns>
851 private List<ScenePresence> GetScenePresences() 851 protected internal List<ScenePresence> GetScenePresences()
852 { 852 {
853 return m_scenePresenceArray; 853 return m_scenePresenceArray;
854 } 854 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e27d309..5cff3f0 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -110,15 +110,10 @@ namespace OpenSim.Region.Framework.Scenes
110 110
111 public UUID currentParcelUUID = UUID.Zero; 111 public UUID currentParcelUUID = UUID.Zero;
112 112
113 protected ScenePresenceAnimator m_animator;
114 /// <value> 113 /// <value>
115 /// The animator for this avatar 114 /// The animator for this avatar
116 /// </value> 115 /// </value>
117 public ScenePresenceAnimator Animator 116 public ScenePresenceAnimator Animator { get; private set; }
118 {
119 get { return m_animator; }
120 private set { m_animator = value; }
121 }
122 117
123 /// <summary> 118 /// <summary>
124 /// Attachments recorded on this avatar. 119 /// Attachments recorded on this avatar.
@@ -2761,8 +2756,7 @@ namespace OpenSim.Region.Framework.Scenes
2761 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); 2756 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
2762 2757
2763 avatar.ControllingClient.SendAvatarDataImmediate(this); 2758 avatar.ControllingClient.SendAvatarDataImmediate(this);
2764 if (Animator != null) 2759 Animator.SendAnimPackToClient(avatar.ControllingClient);
2765 Animator.SendAnimPackToClient(avatar.ControllingClient);
2766 } 2760 }
2767 2761
2768 /// <summary> 2762 /// <summary>
@@ -3438,6 +3432,16 @@ namespace OpenSim.Region.Framework.Scenes
3438 if (IsChildAgent) 3432 if (IsChildAgent)
3439 return; 3433 return;
3440 3434
3435 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
3436 // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents(
3437 // as of this comment the interval is set in AddToPhysicalScene
3438
3439// if (m_updateCount > 0)
3440// {
3441 Animator.UpdateMovementAnimations();
3442// m_updateCount--;
3443// }
3444
3441 CollisionEventUpdate collisionData = (CollisionEventUpdate)e; 3445 CollisionEventUpdate collisionData = (CollisionEventUpdate)e;
3442 Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; 3446 Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList;
3443 3447
@@ -3451,7 +3455,7 @@ namespace OpenSim.Region.Framework.Scenes
3451// m_lastColCount = coldata.Count; 3455// m_lastColCount = coldata.Count;
3452// } 3456// }
3453 3457
3454 if (coldata.Count != 0 && Animator != null) 3458 if (coldata.Count != 0)
3455 { 3459 {
3456 switch (Animator.CurrentMovementAnimation) 3460 switch (Animator.CurrentMovementAnimation)
3457 { 3461 {
@@ -3563,7 +3567,7 @@ namespace OpenSim.Region.Framework.Scenes
3563 ControllingClient.SendHealth(Health); 3567 ControllingClient.SendHealth(Health);
3564 } 3568 }
3565 3569
3566 public void Close() 3570 protected internal void Close()
3567 { 3571 {
3568 // Clear known regions 3572 // Clear known regions
3569 KnownRegions = new Dictionary<ulong, string>(); 3573 KnownRegions = new Dictionary<ulong, string>();
@@ -3579,9 +3583,6 @@ namespace OpenSim.Region.Framework.Scenes
3579 // m_reprioritizationTimer.Dispose(); 3583 // m_reprioritizationTimer.Dispose();
3580 3584
3581 RemoveFromPhysicalScene(); 3585 RemoveFromPhysicalScene();
3582 if(Animator != null)
3583 Animator.Close();
3584 Animator = null;
3585 } 3586 }
3586 3587
3587 public void AddAttachment(SceneObjectGroup gobj) 3588 public void AddAttachment(SceneObjectGroup gobj)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 02c45ef..5758869 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -53,62 +53,94 @@ namespace OpenSim.Region.Framework.Scenes.Tests
53 /// Scene presence tests 53 /// Scene presence tests
54 /// </summary> 54 /// </summary>
55 [TestFixture] 55 [TestFixture]
56 public class ScenePresenceAgentTests 56 public class ScenePresenceAgentTests : OpenSimTestCase
57 { 57 {
58 public Scene scene, scene2, scene3; 58// public Scene scene, scene2, scene3;
59 public UUID agent1, agent2, agent3; 59// public UUID agent1, agent2, agent3;
60 public static Random random; 60// public static Random random;
61 public ulong region1,region2,region3; 61// public ulong region1, region2, region3;
62 public AgentCircuitData acd1; 62// public AgentCircuitData acd1;
63 public SceneObjectGroup sog1, sog2, sog3; 63// public TestClient testclient;
64 public TestClient testclient; 64
65 65// [TestFixtureSetUp]
66 [TestFixtureSetUp] 66// public void Init()
67 public void Init() 67// {
68//// TestHelpers.InMethod();
69////
70//// SceneHelpers sh = new SceneHelpers();
71////
72//// scene = sh.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
73//// scene2 = sh.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
74//// scene3 = sh.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);
75////
76//// ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
77//// interregionComms.Initialise(new IniConfigSource());
78//// interregionComms.PostInitialise();
79//// SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
80//// SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
81//// SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);
82//
83//// agent1 = UUID.Random();
84//// agent2 = UUID.Random();
85//// agent3 = UUID.Random();
86//
87//// region1 = scene.RegionInfo.RegionHandle;
88//// region2 = scene2.RegionInfo.RegionHandle;
89//// region3 = scene3.RegionInfo.RegionHandle;
90// }
91
92 [Test]
93 public void TestCreateRootScenePresence()
68 { 94 {
69 TestHelpers.InMethod(); 95 TestHelpers.InMethod();
96// TestHelpers.EnableLogging();
97
98 UUID spUuid = TestHelpers.ParseTail(0x1);
70 99
71 SceneHelpers sh = new SceneHelpers(); 100 TestScene scene = new SceneHelpers().SetupScene();
72 101 SceneHelpers.AddScenePresence(scene, spUuid);
73 scene = sh.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); 102
74 scene2 = sh.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); 103 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(spUuid), Is.Not.Null);
75 scene3 = sh.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); 104 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
76 105
77 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); 106 ScenePresence sp = scene.GetScenePresence(spUuid);
78 interregionComms.Initialise(new IniConfigSource()); 107 Assert.That(sp, Is.Not.Null);
79 interregionComms.PostInitialise(); 108 Assert.That(sp.IsChildAgent, Is.False);
80 SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); 109 Assert.That(sp.UUID, Is.EqualTo(spUuid));
81 SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); 110
82 SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); 111 Assert.That(scene.GetScenePresences().Count, Is.EqualTo(1));
83
84 agent1 = UUID.Random();
85 agent2 = UUID.Random();
86 agent3 = UUID.Random();
87 random = new Random();
88 sog1 = SceneHelpers.CreateSceneObject(1, agent1);
89 scene.AddSceneObject(sog1);
90 sog2 = SceneHelpers.CreateSceneObject(1, agent1);
91 scene.AddSceneObject(sog2);
92 sog3 = SceneHelpers.CreateSceneObject(1, agent1);
93 scene.AddSceneObject(sog3);
94
95 region1 = scene.RegionInfo.RegionHandle;
96 region2 = scene2.RegionInfo.RegionHandle;
97 region3 = scene3.RegionInfo.RegionHandle;
98 } 112 }
99 113
100 [Test] 114 [Test]
101 public void TestCloseAgent() 115 public void TestCreateDuplicateRootScenePresence()
102 { 116 {
103 TestHelpers.InMethod(); 117 TestHelpers.InMethod();
104// TestHelpers.EnableLogging(); 118// TestHelpers.EnableLogging();
105 119
120 UUID spUuid = TestHelpers.ParseTail(0x1);
121
106 TestScene scene = new SceneHelpers().SetupScene(); 122 TestScene scene = new SceneHelpers().SetupScene();
107 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); 123 SceneHelpers.AddScenePresence(scene, spUuid);
124 SceneHelpers.AddScenePresence(scene, spUuid);
108 125
109 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); 126 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(spUuid), Is.Not.Null);
110 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); 127 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
111 128
129 ScenePresence sp = scene.GetScenePresence(spUuid);
130 Assert.That(sp, Is.Not.Null);
131 Assert.That(sp.IsChildAgent, Is.False);
132 Assert.That(sp.UUID, Is.EqualTo(spUuid));
133 }
134
135 [Test]
136 public void TestCloseAgent()
137 {
138 TestHelpers.InMethod();
139// TestHelpers.EnableLogging();
140
141 TestScene scene = new SceneHelpers().SetupScene();
142 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
143
112 scene.IncomingCloseAgent(sp.UUID); 144 scene.IncomingCloseAgent(sp.UUID);
113 145
114 Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); 146 Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
@@ -266,99 +298,99 @@ namespace OpenSim.Region.Framework.Scenes.Tests
266 // but things are synchronous among them. So there should be 298 // but things are synchronous among them. So there should be
267 // 3 threads in here. 299 // 3 threads in here.
268 //[Test] 300 //[Test]
269 public void T021_TestCrossToNewRegion() 301// public void T021_TestCrossToNewRegion()
270 { 302// {
271 TestHelpers.InMethod(); 303// TestHelpers.InMethod();
272 304//
273 scene.RegisterRegionWithGrid(); 305// scene.RegisterRegionWithGrid();
274 scene2.RegisterRegionWithGrid(); 306// scene2.RegisterRegionWithGrid();
275 307//
276 // Adding child agent to region 1001 308// // Adding child agent to region 1001
277 string reason; 309// string reason;
278 scene2.NewUserConnection(acd1,0, out reason); 310// scene2.NewUserConnection(acd1,0, out reason);
279 scene2.AddNewClient(testclient, PresenceType.User); 311// scene2.AddNewClient(testclient, PresenceType.User);
280 312//
281 ScenePresence presence = scene.GetScenePresence(agent1); 313// ScenePresence presence = scene.GetScenePresence(agent1);
282 presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true); 314// presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);
283 315//
284 ScenePresence presence2 = scene2.GetScenePresence(agent1); 316// ScenePresence presence2 = scene2.GetScenePresence(agent1);
285 317//
286 // Adding neighbour region caps info to presence2 318// // Adding neighbour region caps info to presence2
287 319//
288 string cap = presence.ControllingClient.RequestClientInfo().CapsPath; 320// string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
289 presence2.AddNeighbourRegion(region1, cap); 321// presence2.AddNeighbourRegion(region1, cap);
290 322//
291 Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region."); 323// Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region.");
292 Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region."); 324// Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region.");
293 325//
294 // Cross to x+1 326// // Cross to x+1
295 presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100); 327// presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100);
296 presence.Update(); 328// presence.Update();
297 329//
298 EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing"); 330// EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
299 331//
300 // Mimicking communication between client and server, by waiting OK from client 332// // Mimicking communication between client and server, by waiting OK from client
301 // sent by TestClient.CrossRegion call. Originally, this is network comm. 333// // sent by TestClient.CrossRegion call. Originally, this is network comm.
302 if (!wh.WaitOne(5000,false)) 334// if (!wh.WaitOne(5000,false))
303 { 335// {
304 presence.Update(); 336// presence.Update();
305 if (!wh.WaitOne(8000,false)) 337// if (!wh.WaitOne(8000,false))
306 throw new ArgumentException("1 - Timeout waiting for signal/variable."); 338// throw new ArgumentException("1 - Timeout waiting for signal/variable.");
307 } 339// }
308 340//
309 // This is a TestClient specific method that fires OnCompleteMovementToRegion event, which 341// // This is a TestClient specific method that fires OnCompleteMovementToRegion event, which
310 // would normally be fired after receiving the reply packet from comm. done on the last line. 342// // would normally be fired after receiving the reply packet from comm. done on the last line.
311 testclient.CompleteMovement(); 343// testclient.CompleteMovement();
312 344//
313 // Crossings are asynchronous 345// // Crossings are asynchronous
314 int timer = 10; 346// int timer = 10;
315 347//
316 // Make sure cross hasn't already finished 348// // Make sure cross hasn't already finished
317 if (!presence.IsInTransit && !presence.IsChildAgent) 349// if (!presence.IsInTransit && !presence.IsChildAgent)
318 { 350// {
319 // If not and not in transit yet, give it some more time 351// // If not and not in transit yet, give it some more time
320 Thread.Sleep(5000); 352// Thread.Sleep(5000);
321 } 353// }
322 354//
323 // Enough time, should at least be in transit by now. 355// // Enough time, should at least be in transit by now.
324 while (presence.IsInTransit && timer > 0) 356// while (presence.IsInTransit && timer > 0)
325 { 357// {
326 Thread.Sleep(1000); 358// Thread.Sleep(1000);
327 timer-=1; 359// timer-=1;
328 } 360// }
329 361//
330 Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1."); 362// Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1.");
331 Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected."); 363// Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected.");
332 Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent."); 364// Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent.");
333 365//
334 // Cross Back 366// // Cross Back
335 presence2.AbsolutePosition = new Vector3(-10, 3, 100); 367// presence2.AbsolutePosition = new Vector3(-10, 3, 100);
336 presence2.Update(); 368// presence2.Update();
337 369//
338 if (!wh.WaitOne(5000,false)) 370// if (!wh.WaitOne(5000,false))
339 { 371// {
340 presence2.Update(); 372// presence2.Update();
341 if (!wh.WaitOne(8000,false)) 373// if (!wh.WaitOne(8000,false))
342 throw new ArgumentException("2 - Timeout waiting for signal/variable."); 374// throw new ArgumentException("2 - Timeout waiting for signal/variable.");
343 } 375// }
344 testclient.CompleteMovement(); 376// testclient.CompleteMovement();
345 377//
346 if (!presence2.IsInTransit && !presence2.IsChildAgent) 378// if (!presence2.IsInTransit && !presence2.IsChildAgent)
347 { 379// {
348 // If not and not in transit yet, give it some more time 380// // If not and not in transit yet, give it some more time
349 Thread.Sleep(5000); 381// Thread.Sleep(5000);
350 } 382// }
351 383//
352 // Enough time, should at least be in transit by now. 384// // Enough time, should at least be in transit by now.
353 while (presence2.IsInTransit && timer > 0) 385// while (presence2.IsInTransit && timer > 0)
354 { 386// {
355 Thread.Sleep(1000); 387// Thread.Sleep(1000);
356 timer-=1; 388// timer-=1;
357 } 389// }
358 390//
359 Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2."); 391// Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2.");
360 Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); 392// Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
361 Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); 393// Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
362 } 394// }
363 } 395 }
364} \ No newline at end of file 396} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs
index e452124..40f7fbc 100755
--- a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs
+++ b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PhysicsParameters")] 47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PhysicsParameters")]
48 public class PhysicsParameters : ISharedRegionModule 48 public class PhysicsParameters : ISharedRegionModule
49 { 49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51// private static string LogHeader = "[PHYSICS PARAMETERS]"; 51// private static string LogHeader = "[PHYSICS PARAMETERS]";
52 52
53 private List<Scene> m_scenes = new List<Scene>(); 53 private List<Scene> m_scenes = new List<Scene>();
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index e49ad2a..f459b8c 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -48,7 +48,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
48 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 private IConfig m_config = null; 50 private IConfig m_config = null;
51 private bool m_ScriptRez;
52 private bool m_firstEmptyCompileQueue; 51 private bool m_firstEmptyCompileQueue;
53 private bool m_oarFileLoading; 52 private bool m_oarFileLoading;
54 private bool m_lastOarLoadedOk; 53 private bool m_lastOarLoadedOk;
@@ -91,7 +90,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
91 90
92 m_scene.RegisterModuleInterface<IRegionReadyModule>(this); 91 m_scene.RegisterModuleInterface<IRegionReadyModule>(this);
93 92
94 m_ScriptRez = false;
95 m_firstEmptyCompileQueue = true; 93 m_firstEmptyCompileQueue = true;
96 m_oarFileLoading = false; 94 m_oarFileLoading = false;
97 m_lastOarLoadedOk = true; 95 m_lastOarLoadedOk = true;