Merge branch 'master' of /home/opensim/var/repo/opensim

integration
BlueWall 2012-07-19 22:24:50 -04:00
commit 0b185aaf18
11 changed files with 259 additions and 201 deletions

View File

@ -1145,8 +1145,8 @@ namespace OpenSim
c => cdt.AddRow( c => cdt.AddRow(
s.Name, s.Name,
c.Name, c.Name,
c.RemoteEndPoint.ToString(),
c.CircuitCode.ToString(), c.CircuitCode.ToString(),
c.RemoteEndPoint.ToString(),
c.IsActive.ToString()))); c.IsActive.ToString())));
MainConsole.Instance.Output(cdt.ToString()); MainConsole.Instance.Output(cdt.ToString());

View File

@ -347,8 +347,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private int m_animationSequenceNumber = 1; private int m_animationSequenceNumber = 1;
private bool m_SendLogoutPacketWhenClosing = true; private bool m_SendLogoutPacketWhenClosing = true;
private AgentUpdateArgs lastarg; private AgentUpdateArgs lastarg;
private bool m_IsActive = true;
private bool m_IsLoggingOut = false;
protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>();
protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers
@ -412,16 +410,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public uint CircuitCode { get { return m_circuitCode; } } public uint CircuitCode { get { return m_circuitCode; } }
public int MoneyBalance { get { return m_moneyBalance; } } public int MoneyBalance { get { return m_moneyBalance; } }
public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } }
public bool IsActive
{ /// <summary>
get { return m_IsActive; } /// As well as it's function in IClientAPI, in LLClientView we are locking on this property in order to
set { m_IsActive = value; } /// prevent race conditions by different threads calling Close().
} /// </summary>
public bool IsLoggingOut public bool IsActive { get; set; }
{
get { return m_IsLoggingOut; } /// <summary>
set { m_IsLoggingOut = value; } /// Used to synchronise threads when client is being closed.
} /// </summary>
public Object CloseSyncLock { get; private set; }
public bool IsLoggingOut { get; set; }
public bool DisableFacelights public bool DisableFacelights
{ {
@ -446,6 +447,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
// DebugPacketLevel = 1; // DebugPacketLevel = 1;
CloseSyncLock = new Object();
RegisterInterface<IClientIM>(this); RegisterInterface<IClientIM>(this);
RegisterInterface<IClientInventory>(this); RegisterInterface<IClientInventory>(this);
RegisterInterface<IClientChat>(this); RegisterInterface<IClientChat>(this);
@ -478,17 +481,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_prioritizer = new Prioritizer(m_scene); m_prioritizer = new Prioritizer(m_scene);
RegisterLocalPacketHandlers(); RegisterLocalPacketHandlers();
IsActive = true;
} }
#region Client Methods #region Client Methods
/// <summary> /// <summary>
/// Shut down the client view /// Close down the client view
/// </summary> /// </summary>
public void Close() public void Close()
{ {
IsActive = false; // We lock here to prevent race conditions between two threads calling close simultaneously (e.g.
// a simultaneous relog just as a client is being closed out due to no packet ack from the old connection.
lock (CloseSyncLock)
{
if (!IsActive)
return;
IsActive = false;
CloseWithoutChecks();
}
}
/// <summary>
/// Closes down the client view without first checking whether it is active.
/// </summary>
/// <remarks>
/// This exists because LLUDPServer has to set IsActive = false in earlier synchronous code before calling
/// CloseWithoutIsActiveCheck asynchronously.
///
/// Callers must lock ClosingSyncLock before calling.
/// </remarks>
public void CloseWithoutChecks()
{
m_log.DebugFormat( m_log.DebugFormat(
"[CLIENT]: Close has been called for {0} attached to scene {1}", "[CLIENT]: Close has been called for {0} attached to scene {1}",
Name, m_scene.RegionInfo.RegionName); Name, m_scene.RegionInfo.RegionName);
@ -3567,7 +3593,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)
{ {
if (!IsActive) return; // We don't need to update inactive clients. // We don't need to update inactive clients.
if (!IsActive)
return;
CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate);
loc.Header.Reliable = false; loc.Header.Reliable = false;
@ -5164,7 +5192,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate); AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate);
AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply); AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply);
AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage, false); AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage);
AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship); AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship);
AddLocalPacketHandler(PacketType.DeclineFriendship, HandlerDeclineFriendship); AddLocalPacketHandler(PacketType.DeclineFriendship, HandlerDeclineFriendship);
AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFriendship); AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFriendship);

View File

@ -1123,22 +1123,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// regular client pings. /// regular client pings.
/// </remarks> /// </remarks>
/// <param name='client'></param> /// <param name='client'></param>
private void DeactivateClientDueToTimeout(IClientAPI client) private void DeactivateClientDueToTimeout(LLClientView client)
{ {
// We must set IsActive synchronously so that we can stop the packet loop reinvoking this method, even lock (client.CloseSyncLock)
// though it's set later on by LLClientView.Close() {
client.IsActive = false; m_log.WarnFormat(
"[LLUDPSERVER]: Ack timeout, disconnecting {0} agent for {1} in {2}",
m_log.WarnFormat( client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, m_scene.RegionInfo.RegionName);
"[LLUDPSERVER]: Ack timeout, disconnecting {0} agent for {1} in {2}",
client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, m_scene.RegionInfo.RegionName); StatsManager.SimExtraStats.AddAbnormalClientThreadTermination();
StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); if (!client.SceneAgent.IsChildAgent)
client.Kick("Simulator logged you out due to connection timeout");
if (!client.SceneAgent.IsChildAgent)
client.Kick("Simulator logged you out due to connection timeout"); client.CloseWithoutChecks();
}
client.Close();
} }
private void IncomingPacketHandler() private void IncomingPacketHandler()

View File

@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += OnClientClosed; scene.EventManager.OnClientClosed += OnClientClosed;
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; // scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
} }
public void PostInitialise() public void PostInitialise()
@ -133,7 +133,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
private void OnNewClient(IClientAPI client) private void OnNewClient(IClientAPI client)
{ {
// Subscribe to instant messages // Subscribe to instant messages
client.OnInstantMessage += OnInstantMessage; // client.OnInstantMessage += OnInstantMessage;
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest; client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
lock (m_ClientMap) lock (m_ClientMap)
@ -171,15 +171,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
ActiveGroupTitle); ActiveGroupTitle);
} }
private void OnInstantMessage(IClientAPI client, GridInstantMessage im) // private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{ // {
} // }
private void OnGridInstantMessage(GridInstantMessage msg) // private void OnGridInstantMessage(GridInstantMessage msg)
{ // {
// Trigger the above event handler // // Trigger the above event handler
OnInstantMessage(null, msg); // OnInstantMessage(null, msg);
} // }
private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client) private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client)
{ {

View File

@ -535,11 +535,5 @@ namespace OpenSim.Region.Framework.Scenes.Animation
SendAnimPack(animIDs, sequenceNums, objectIDs); SendAnimPack(animIDs, sequenceNums, objectIDs);
} }
public void Close()
{
m_animations = null;
m_scenePresence = null;
}
} }
} }

View File

@ -3517,8 +3517,8 @@ namespace OpenSim.Region.Framework.Scenes
// We have a zombie from a crashed session. // We have a zombie from a crashed session.
// Or the same user is trying to be root twice here, won't work. // Or the same user is trying to be root twice here, won't work.
// Kill it. // Kill it.
m_log.DebugFormat( m_log.WarnFormat(
"[SCENE]: Zombie scene presence detected for {0} {1} in {2}", "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.",
sp.Name, sp.UUID, RegionInfo.RegionName); sp.Name, sp.UUID, RegionInfo.RegionName);
sp.ControllingClient.Close(); sp.ControllingClient.Close();
@ -4469,6 +4469,23 @@ namespace OpenSim.Region.Framework.Scenes
return m_sceneGraph.GetScenePresence(localID); return m_sceneGraph.GetScenePresence(localID);
} }
/// <summary>
/// Gets all the scene presences in this scene.
/// </summary>
/// <remarks>
/// This method will return both root and child scene presences.
///
/// Consider using ForEachScenePresence() or ForEachRootScenePresence() if possible since these will not
/// involving creating a new List object.
/// </remarks>
/// <returns>
/// A list of the scene presences. Adding or removing from the list will not affect the presences in the scene.
/// </returns>
public List<ScenePresence> GetScenePresences()
{
return new List<ScenePresence>(m_sceneGraph.GetScenePresences());
}
/// <summary> /// <summary>
/// Performs action on all avatars in the scene (root scene presences) /// Performs action on all avatars in the scene (root scene presences)
/// Avatars may be an NPC or a 'real' client. /// Avatars may be an NPC or a 'real' client.

View File

@ -768,7 +768,7 @@ namespace OpenSim.Region.Framework.Scenes
/// pass a delegate to ForEachScenePresence. /// pass a delegate to ForEachScenePresence.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private List<ScenePresence> GetScenePresences() protected internal List<ScenePresence> GetScenePresences()
{ {
return m_scenePresenceArray; return m_scenePresenceArray;
} }

View File

@ -109,15 +109,10 @@ namespace OpenSim.Region.Framework.Scenes
public UUID currentParcelUUID = UUID.Zero; public UUID currentParcelUUID = UUID.Zero;
protected ScenePresenceAnimator m_animator;
/// <value> /// <value>
/// The animator for this avatar /// The animator for this avatar
/// </value> /// </value>
public ScenePresenceAnimator Animator public ScenePresenceAnimator Animator { get; private set; }
{
get { return m_animator; }
private set { m_animator = value; }
}
/// <summary> /// <summary>
/// Attachments recorded on this avatar. /// Attachments recorded on this avatar.
@ -2569,8 +2564,7 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
avatar.ControllingClient.SendAvatarDataImmediate(this); avatar.ControllingClient.SendAvatarDataImmediate(this);
if (Animator != null) Animator.SendAnimPackToClient(avatar.ControllingClient);
Animator.SendAnimPackToClient(avatar.ControllingClient);
} }
/// <summary> /// <summary>
@ -3239,14 +3233,12 @@ namespace OpenSim.Region.Framework.Scenes
//if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
// The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents(
// as of this comment the interval is set in AddToPhysicalScene // as of this comment the interval is set in AddToPhysicalScene
if (Animator != null)
{
// if (m_updateCount > 0) // if (m_updateCount > 0)
// { // {
Animator.UpdateMovementAnimations(); Animator.UpdateMovementAnimations();
// m_updateCount--; // m_updateCount--;
// } // }
}
CollisionEventUpdate collisionData = (CollisionEventUpdate)e; CollisionEventUpdate collisionData = (CollisionEventUpdate)e;
Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList;
@ -3261,7 +3253,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_lastColCount = coldata.Count; // m_lastColCount = coldata.Count;
// } // }
if (coldata.Count != 0 && Animator != null) if (coldata.Count != 0)
{ {
switch (Animator.CurrentMovementAnimation) switch (Animator.CurrentMovementAnimation)
{ {
@ -3371,7 +3363,7 @@ namespace OpenSim.Region.Framework.Scenes
ControllingClient.SendHealth(Health); ControllingClient.SendHealth(Health);
} }
public void Close() protected internal void Close()
{ {
// Clear known regions // Clear known regions
KnownRegions = new Dictionary<ulong, string>(); KnownRegions = new Dictionary<ulong, string>();
@ -3387,8 +3379,6 @@ namespace OpenSim.Region.Framework.Scenes
// m_reprioritizationTimer.Dispose(); // m_reprioritizationTimer.Dispose();
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();
Animator.Close();
Animator = null;
} }
public void AddAttachment(SceneObjectGroup gobj) public void AddAttachment(SceneObjectGroup gobj)

View File

@ -53,48 +53,83 @@ namespace OpenSim.Region.Framework.Scenes.Tests
/// Scene presence tests /// Scene presence tests
/// </summary> /// </summary>
[TestFixture] [TestFixture]
public class ScenePresenceAgentTests public class ScenePresenceAgentTests : OpenSimTestCase
{ {
public Scene scene, scene2, scene3; // public Scene scene, scene2, scene3;
public UUID agent1, agent2, agent3; // public UUID agent1, agent2, agent3;
public static Random random; // public static Random random;
public ulong region1,region2,region3; // public ulong region1, region2, region3;
public AgentCircuitData acd1; // public AgentCircuitData acd1;
public SceneObjectGroup sog1, sog2, sog3; // public TestClient testclient;
public TestClient testclient;
[TestFixtureSetUp] // [TestFixtureSetUp]
public void Init() // public void Init()
// {
//// TestHelpers.InMethod();
////
//// SceneHelpers sh = new SceneHelpers();
////
//// scene = sh.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
//// scene2 = sh.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
//// scene3 = sh.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);
////
//// ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
//// interregionComms.Initialise(new IniConfigSource());
//// interregionComms.PostInitialise();
//// SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
//// SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
//// SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);
//
//// agent1 = UUID.Random();
//// agent2 = UUID.Random();
//// agent3 = UUID.Random();
//
//// region1 = scene.RegionInfo.RegionHandle;
//// region2 = scene2.RegionInfo.RegionHandle;
//// region3 = scene3.RegionInfo.RegionHandle;
// }
[Test]
public void TestCreateRootScenePresence()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// TestHelpers.EnableLogging();
SceneHelpers sh = new SceneHelpers(); UUID spUuid = TestHelpers.ParseTail(0x1);
scene = sh.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); TestScene scene = new SceneHelpers().SetupScene();
scene2 = sh.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); SceneHelpers.AddScenePresence(scene, spUuid);
scene3 = sh.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);
ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(spUuid), Is.Not.Null);
interregionComms.Initialise(new IniConfigSource()); Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
interregionComms.PostInitialise();
SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);
agent1 = UUID.Random(); ScenePresence sp = scene.GetScenePresence(spUuid);
agent2 = UUID.Random(); Assert.That(sp, Is.Not.Null);
agent3 = UUID.Random(); Assert.That(sp.IsChildAgent, Is.False);
random = new Random(); Assert.That(sp.UUID, Is.EqualTo(spUuid));
sog1 = SceneHelpers.CreateSceneObject(1, agent1);
scene.AddSceneObject(sog1);
sog2 = SceneHelpers.CreateSceneObject(1, agent1);
scene.AddSceneObject(sog2);
sog3 = SceneHelpers.CreateSceneObject(1, agent1);
scene.AddSceneObject(sog3);
region1 = scene.RegionInfo.RegionHandle; Assert.That(scene.GetScenePresences().Count, Is.EqualTo(1));
region2 = scene2.RegionInfo.RegionHandle; }
region3 = scene3.RegionInfo.RegionHandle;
[Test]
public void TestCreateDuplicateRootScenePresence()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
UUID spUuid = TestHelpers.ParseTail(0x1);
TestScene scene = new SceneHelpers().SetupScene();
SceneHelpers.AddScenePresence(scene, spUuid);
SceneHelpers.AddScenePresence(scene, spUuid);
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(spUuid), Is.Not.Null);
Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
ScenePresence sp = scene.GetScenePresence(spUuid);
Assert.That(sp, Is.Not.Null);
Assert.That(sp.IsChildAgent, Is.False);
Assert.That(sp.UUID, Is.EqualTo(spUuid));
} }
[Test] [Test]
@ -106,9 +141,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestScene scene = new SceneHelpers().SetupScene(); TestScene scene = new SceneHelpers().SetupScene();
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null);
Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
scene.IncomingCloseAgent(sp.UUID); scene.IncomingCloseAgent(sp.UUID);
Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
@ -266,99 +298,99 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// but things are synchronous among them. So there should be // but things are synchronous among them. So there should be
// 3 threads in here. // 3 threads in here.
//[Test] //[Test]
public void T021_TestCrossToNewRegion() // public void T021_TestCrossToNewRegion()
{ // {
TestHelpers.InMethod(); // TestHelpers.InMethod();
//
scene.RegisterRegionWithGrid(); // scene.RegisterRegionWithGrid();
scene2.RegisterRegionWithGrid(); // scene2.RegisterRegionWithGrid();
//
// Adding child agent to region 1001 // // Adding child agent to region 1001
string reason; // string reason;
scene2.NewUserConnection(acd1,0, out reason); // scene2.NewUserConnection(acd1,0, out reason);
scene2.AddNewClient(testclient, PresenceType.User); // scene2.AddNewClient(testclient, PresenceType.User);
//
ScenePresence presence = scene.GetScenePresence(agent1); // ScenePresence presence = scene.GetScenePresence(agent1);
presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true); // presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);
//
ScenePresence presence2 = scene2.GetScenePresence(agent1); // ScenePresence presence2 = scene2.GetScenePresence(agent1);
//
// Adding neighbour region caps info to presence2 // // Adding neighbour region caps info to presence2
//
string cap = presence.ControllingClient.RequestClientInfo().CapsPath; // string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
presence2.AddNeighbourRegion(region1, cap); // presence2.AddNeighbourRegion(region1, cap);
//
Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region."); // Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region.");
Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region."); // Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region.");
//
// Cross to x+1 // // Cross to x+1
presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100); // presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100);
presence.Update(); // presence.Update();
//
EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing"); // EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
//
// Mimicking communication between client and server, by waiting OK from client // // Mimicking communication between client and server, by waiting OK from client
// sent by TestClient.CrossRegion call. Originally, this is network comm. // // sent by TestClient.CrossRegion call. Originally, this is network comm.
if (!wh.WaitOne(5000,false)) // if (!wh.WaitOne(5000,false))
{ // {
presence.Update(); // presence.Update();
if (!wh.WaitOne(8000,false)) // if (!wh.WaitOne(8000,false))
throw new ArgumentException("1 - Timeout waiting for signal/variable."); // throw new ArgumentException("1 - Timeout waiting for signal/variable.");
} // }
//
// This is a TestClient specific method that fires OnCompleteMovementToRegion event, which // // This is a TestClient specific method that fires OnCompleteMovementToRegion event, which
// would normally be fired after receiving the reply packet from comm. done on the last line. // // would normally be fired after receiving the reply packet from comm. done on the last line.
testclient.CompleteMovement(); // testclient.CompleteMovement();
//
// Crossings are asynchronous // // Crossings are asynchronous
int timer = 10; // int timer = 10;
//
// Make sure cross hasn't already finished // // Make sure cross hasn't already finished
if (!presence.IsInTransit && !presence.IsChildAgent) // if (!presence.IsInTransit && !presence.IsChildAgent)
{ // {
// If not and not in transit yet, give it some more time // // If not and not in transit yet, give it some more time
Thread.Sleep(5000); // Thread.Sleep(5000);
} // }
//
// Enough time, should at least be in transit by now. // // Enough time, should at least be in transit by now.
while (presence.IsInTransit && timer > 0) // while (presence.IsInTransit && timer > 0)
{ // {
Thread.Sleep(1000); // Thread.Sleep(1000);
timer-=1; // timer-=1;
} // }
//
Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1."); // Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1.");
Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected."); // Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected.");
Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent."); // Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent.");
//
// Cross Back // // Cross Back
presence2.AbsolutePosition = new Vector3(-10, 3, 100); // presence2.AbsolutePosition = new Vector3(-10, 3, 100);
presence2.Update(); // presence2.Update();
//
if (!wh.WaitOne(5000,false)) // if (!wh.WaitOne(5000,false))
{ // {
presence2.Update(); // presence2.Update();
if (!wh.WaitOne(8000,false)) // if (!wh.WaitOne(8000,false))
throw new ArgumentException("2 - Timeout waiting for signal/variable."); // throw new ArgumentException("2 - Timeout waiting for signal/variable.");
} // }
testclient.CompleteMovement(); // testclient.CompleteMovement();
//
if (!presence2.IsInTransit && !presence2.IsChildAgent) // if (!presence2.IsInTransit && !presence2.IsChildAgent)
{ // {
// If not and not in transit yet, give it some more time // // If not and not in transit yet, give it some more time
Thread.Sleep(5000); // Thread.Sleep(5000);
} // }
//
// Enough time, should at least be in transit by now. // // Enough time, should at least be in transit by now.
while (presence2.IsInTransit && timer > 0) // while (presence2.IsInTransit && timer > 0)
{ // {
Thread.Sleep(1000); // Thread.Sleep(1000);
timer-=1; // timer-=1;
} // }
//
Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2."); // Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2.");
Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); // Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); // Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
} // }
} }
} }

View File

@ -47,7 +47,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PhysicsParameters")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PhysicsParameters")]
public class PhysicsParameters : ISharedRegionModule public class PhysicsParameters : ISharedRegionModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static string LogHeader = "[PHYSICS PARAMETERS]"; // private static string LogHeader = "[PHYSICS PARAMETERS]";
private List<Scene> m_scenes = new List<Scene>(); private List<Scene> m_scenes = new List<Scene>();

View File

@ -48,7 +48,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IConfig m_config = null; private IConfig m_config = null;
private bool m_ScriptRez;
private bool m_firstEmptyCompileQueue; private bool m_firstEmptyCompileQueue;
private bool m_oarFileLoading; private bool m_oarFileLoading;
private bool m_lastOarLoadedOk; private bool m_lastOarLoadedOk;
@ -91,7 +90,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.RegisterModuleInterface<IRegionReadyModule>(this); m_scene.RegisterModuleInterface<IRegionReadyModule>(this);
m_ScriptRez = false;
m_firstEmptyCompileQueue = true; m_firstEmptyCompileQueue = true;
m_oarFileLoading = false; m_oarFileLoading = false;
m_lastOarLoadedOk = true; m_lastOarLoadedOk = true;