From e99a7d879ecf59737e9916a9eb229698ef866627 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 16 Jan 2014 00:05:04 +0000
Subject: Remove old IInterRegionComms and references. This hasn't been used
since 2009 and was superseded by ISimulationService
---
.../Simulation/LocalSimulationConnector.cs | 4 +-
.../Simulation/RemoteSimulationConnector.cs | 4 +-
.../Framework/Interfaces/IInterregionComms.cs | 111 ---------------------
OpenSim/Region/Framework/Scenes/Scene.cs | 12 ---
4 files changed, 4 insertions(+), 127 deletions(-)
delete mode 100644 OpenSim/Region/Framework/Interfaces/IInterregionComms.cs
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 678f3dc..4dcb99f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
#endregion
- #region ISimulation
+ #region ISimulationService
public IScene GetScene(UUID regionId)
{
@@ -353,7 +353,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return false;
}
- #endregion /* IInterregionComms */
+ #endregion
#region Misc
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index f45f560..cc01430 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
#endregion
- #region IInterregionComms
+ #region ISimulationService
public IScene GetScene(UUID regionId)
{
@@ -279,6 +279,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
return false;
}
- #endregion /* IInterregionComms */
+ #endregion
}
}
diff --git a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs
deleted file mode 100644
index 2d6287f..0000000
--- a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Region.Framework.Interfaces
-{
- public delegate bool ChildAgentUpdateReceived(AgentData data);
-
- public interface IInterregionCommsOut
- {
- #region Agents
-
- bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, uint teleportFlags, out string reason);
-
- ///
- /// Full child agent update.
- ///
- ///
- ///
- ///
- bool SendChildAgentUpdate(ulong regionHandle, AgentData data);
-
- ///
- /// Short child agent update, mostly for position.
- ///
- ///
- ///
- ///
- bool SendChildAgentUpdate(ulong regionHandle, AgentPosition data);
-
- bool SendRetrieveRootAgent(ulong regionHandle, UUID id, out IAgentData agent);
-
- ///
- /// Message from receiving region to departing region, telling it got contacted by the client.
- /// When sent over REST, it invokes the opaque uri.
- ///
- ///
- ///
- ///
- ///
- bool SendReleaseAgent(ulong regionHandle, UUID id, string uri);
-
- ///
- /// Close agent.
- ///
- ///
- ///
- ///
- bool SendCloseAgent(ulong regionHandle, UUID id);
-
- #endregion Agents
-
- #region Objects
-
- ///
- /// Create an object in the destination region. This message is used primarily for prim crossing.
- ///
- ///
- ///
- ///
- ///
- bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall);
-
- ///
- /// Create an object from the user's inventory in the destination region.
- /// This message is used primarily by clients.
- ///
- ///
- ///
- ///
- ///
- bool SendCreateObject(ulong regionHandle, UUID userID, UUID itemID);
-
- #endregion Objects
-
- }
-
- // This may not be needed, but having it here for now.
- public interface IInterregionCommsIn
- {
- event ChildAgentUpdateReceived OnChildAgentUpdate;
- }
-
-}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7772f94..567ce2a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4405,18 +4405,6 @@ namespace OpenSim.Region.Framework.Scenes
return sp;
}
- public virtual bool IncomingRetrieveRootAgent(UUID id, out IAgentData agent)
- {
- agent = null;
- ScenePresence sp = GetScenePresence(id);
- if ((sp != null) && (!sp.IsChildAgent))
- {
- sp.IsChildAgent = true;
- return sp.CopyAgent(out agent);
- }
-
- return false;
- }
///
/// Authenticated close (via network)
///
--
cgit v1.1
From 21bc799a17f6f0315256d901f3ec226a39f93a51 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Thu, 9 Jan 2014 18:34:10 +0200
Subject: Fixed offline IM
---
OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
index 6731923..d36f9a4 100644
--- a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
+++ b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@@ -100,7 +100,7 @@ namespace OpenSim.OfflineIM
return false;
}
- string imXml = string.Empty;
+ string imXml;
using (MemoryStream mstream = new MemoryStream())
{
XmlWriterSettings settings = new XmlWriterSettings();
@@ -110,13 +110,9 @@ namespace OpenSim.OfflineIM
{
m_serializer.Serialize(writer, im);
writer.Flush();
-
- mstream.Position = 0;
- using (StreamReader sreader = new StreamReader(mstream))
- {
- imXml = sreader.ReadToEnd();
- }
}
+
+ imXml = Util.UTF8.GetString(mstream.ToArray());
}
OfflineIMData data = new OfflineIMData();
--
cgit v1.1
From 46c2791fe2f9ea92535d3933602e24dcba8f96f9 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Tue, 29 Oct 2013 16:03:58 +0200
Subject: In the offline message table, store the sender.
This data is useful for preventing abuse (e.g., someone who sends too many messages), or for deleting message if their sender has been deleted.
---
.../OfflineIM/Remote/OfflineIMServiceRobustConnector.cs | 3 +--
OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs | 3 ++-
OpenSim/Data/IOfflineIMData.cs | 3 ++-
OpenSim/Data/MySQL/Resources/IM_Store.migrations | 12 +++++++++++-
4 files changed, 16 insertions(+), 5 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs
index 32c24db..6158abc 100644
--- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs
+++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@@ -96,7 +96,6 @@ namespace OpenSim.OfflineIM
string method = request["METHOD"].ToString();
request.Remove("METHOD");
- m_log.DebugFormat("[OfflineIM.V2.Handler]: {0}", method);
switch (method)
{
case "GET":
diff --git a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
index d36f9a4..df0c53f 100644
--- a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
+++ b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
@@ -91,7 +91,7 @@ namespace OpenSim.OfflineIM
{
reason = string.Empty;
- // TODO Check limits
+ // Check limits
UUID principalID = new UUID(im.toAgentID);
long count = m_Database.GetCount("PrincipalID", principalID.ToString());
if (count >= MAX_IM)
@@ -117,6 +117,7 @@ namespace OpenSim.OfflineIM
OfflineIMData data = new OfflineIMData();
data.PrincipalID = principalID;
+ data.FromID = new UUID(im.fromAgentID);
data.Data = new Dictionary();
data.Data["Message"] = imXml;
diff --git a/OpenSim/Data/IOfflineIMData.cs b/OpenSim/Data/IOfflineIMData.cs
index e780304..58501a3 100644
--- a/OpenSim/Data/IOfflineIMData.cs
+++ b/OpenSim/Data/IOfflineIMData.cs
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@@ -34,6 +34,7 @@ namespace OpenSim.Data
public class OfflineIMData
{
public UUID PrincipalID;
+ public UUID FromID;
public Dictionary Data;
}
diff --git a/OpenSim/Data/MySQL/Resources/IM_Store.migrations b/OpenSim/Data/MySQL/Resources/IM_Store.migrations
index 7cfcd43..f73475e 100644
--- a/OpenSim/Data/MySQL/Resources/IM_Store.migrations
+++ b/OpenSim/Data/MySQL/Resources/IM_Store.migrations
@@ -21,4 +21,14 @@ INSERT INTO `im_offline` SELECT * from `diva_im_offline`;
DROP TABLE `diva_im_offline`;
DELETE FROM `migrations` WHERE name='diva_im_Store';
-COMMIT;
\ No newline at end of file
+COMMIT;
+
+:VERSION 3 # --------------------------
+
+BEGIN;
+
+ALTER TABLE `im_offline`
+ ADD `FromID` char(36) NOT NULL default '' AFTER `PrincipalID`,
+ ADD KEY `FromID` (`FromID`);
+
+COMMIT;
--
cgit v1.1
From 2d9d6fe922c99e79489b19b18ac33338012137ff Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Tue, 29 Oct 2013 16:38:03 +0200
Subject: Can delete the Offline Messages sent to/from a user.
This is useful if the user is deleted.
---
OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs | 5 +++++
.../OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs | 8 ++++++++
.../OfflineIM/Remote/OfflineIMServiceRobustConnector.cs | 17 +++++++++++++++++
OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs | 7 +++++++
OpenSim/Services/Interfaces/IOfflineIMService.cs | 7 +++++++
5 files changed, 44 insertions(+)
(limited to 'OpenSim')
diff --git a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs
index 050ebd2..5ef068a 100644
--- a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs
+++ b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs
@@ -261,6 +261,11 @@ namespace OpenSim.OfflineIM
return m_OfflineIMService.StoreMessage(im, out reason);
}
+ public void DeleteMessages(UUID userID)
+ {
+ m_OfflineIMService.DeleteMessages(userID);
+ }
+
#endregion
}
}
diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs
index 69feb76..f6b17e5 100644
--- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs
+++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs
@@ -117,6 +117,14 @@ namespace OpenSim.OfflineIM
return true;
}
+ public void DeleteMessages(UUID userID)
+ {
+ Dictionary sendData = new Dictionary();
+ sendData["UserID"] = userID;
+
+ MakeRequest("DELETE", sendData);
+ }
+
#endregion
diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs
index 6158abc..13b0e7e 100644
--- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs
+++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs
@@ -102,6 +102,8 @@ namespace OpenSim.OfflineIM
return HandleGet(request);
case "STORE":
return HandleStore(request);
+ case "DELETE":
+ return HandleDelete(request);
}
m_log.DebugFormat("[OFFLINE IM HANDLER]: unknown method request: {0}", method);
}
@@ -158,6 +160,21 @@ namespace OpenSim.OfflineIM
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
}
+ byte[] HandleDelete(Dictionary request)
+ {
+ if (!request.ContainsKey("UserID"))
+ {
+ return FailureResult();
+ }
+ else
+ {
+ UUID userID = new UUID(request["UserID"].ToString());
+ m_OfflineIMService.DeleteMessages(userID);
+
+ return SuccessResult();
+ }
+ }
+
#region Helpers
private void NullResult(Dictionary result, string reason)
diff --git a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
index df0c53f..690c955 100644
--- a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
+++ b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
@@ -124,5 +124,12 @@ namespace OpenSim.OfflineIM
return m_Database.Store(data);
}
+
+ public void DeleteMessages(UUID userID)
+ {
+ m_Database.Delete("PrincipalID", userID.ToString());
+ m_Database.Delete("FromID", userID.ToString());
+ }
+
}
}
diff --git a/OpenSim/Services/Interfaces/IOfflineIMService.cs b/OpenSim/Services/Interfaces/IOfflineIMService.cs
index 2848967..588aaaf 100644
--- a/OpenSim/Services/Interfaces/IOfflineIMService.cs
+++ b/OpenSim/Services/Interfaces/IOfflineIMService.cs
@@ -35,7 +35,14 @@ namespace OpenSim.Services.Interfaces
public interface IOfflineIMService
{
List GetMessages(UUID principalID);
+
bool StoreMessage(GridInstantMessage im, out string reason);
+
+ ///
+ /// Delete messages to or from this user (or group).
+ ///
+ /// A user or group ID
+ void DeleteMessages(UUID userID);
}
public class OfflineIMDataUtils
--
cgit v1.1
From 3ffd90496a366f2b64eb8daadf63a2b6ee05ad7a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 16 Jan 2014 20:23:31 +0000
Subject: Prevent duplicate invocations or race dontision in
SP.CompleteMovement()
This can happen under poor network conditions if a viewer repeats the message send
If this happens, physics actors can get orphaned, which unecessarily raises physics frame times
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 29 ++++++-
.../Scenes/Tests/ScenePresenceAgentTests.cs | 92 +++++++++-------------
2 files changed, 65 insertions(+), 56 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 49f70c4..63cca56 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -108,6 +108,16 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ ///
+ /// This exists to prevent race conditions between two CompleteMovement threads if the simulator is slow and
+ /// the viewer fires these in quick succession.
+ ///
+ ///
+ /// TODO: The child -> agent transition should be folded into LifecycleState and the CompleteMovement
+ /// regulation done there.
+ ///
+ private object m_completeMovementLock = new object();
+
// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags));
private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f);
@@ -905,6 +915,7 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Turns a child agent into a root agent.
///
+ ///
/// Child agents are logged into neighbouring sims largely to observe changes. Root agents exist when the
/// avatar is actual in the sim. They can perform all actions.
/// This change is made whenever an avatar enters a region, whether by crossing over from a neighbouring sim,
@@ -912,8 +923,8 @@ namespace OpenSim.Region.Framework.Scenes
///
/// This method is on the critical path for transferring an avatar from one region to another. Delay here
/// delays that crossing.
- ///
- private void MakeRootAgent(Vector3 pos, bool isFlying)
+ ///
+ private bool MakeRootAgent(Vector3 pos, bool isFlying)
{
// m_log.InfoFormat(
// "[SCENE]: Upgrading child to root agent for {0} in {1}",
@@ -921,6 +932,10 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
+ lock (m_completeMovementLock)
+ if (!IsChildAgent)
+ return false;
+
IsChildAgent = false;
// Must reset this here so that a teleport to a region next to an existing region does not keep the flag
@@ -1070,6 +1085,7 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.EventManager.TriggerOnMakeRootAgent(this);
+ return true;
}
public int GetStateSource()
@@ -1443,7 +1459,14 @@ namespace OpenSim.Region.Framework.Scenes
}
bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
- MakeRootAgent(AbsolutePosition, flying);
+ if (!MakeRootAgent(AbsolutePosition, flying))
+ {
+ m_log.DebugFormat(
+ "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root",
+ Name, Scene.Name);
+
+ return;
+ }
// Tell the client that we're totally ready
ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index d1aeaee..1ff1329 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -111,6 +111,45 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(scene.GetScenePresences().Count, Is.EqualTo(1));
}
+ ///
+ /// Test that duplicate complete movement calls are ignored.
+ ///
+ ///
+ /// If duplicate calls are not ignored then there is a risk of race conditions or other unexpected effects.
+ ///
+ [Test]
+ public void TestDupeCompleteMovementCalls()
+ {
+ TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
+ UUID spUuid = TestHelpers.ParseTail(0x1);
+
+ TestScene scene = new SceneHelpers().SetupScene();
+
+ int makeRootAgentEvents = 0;
+ scene.EventManager.OnMakeRootAgent += spi => makeRootAgentEvents++;
+
+ ScenePresence sp = SceneHelpers.AddScenePresence(scene, spUuid);
+
+ Assert.That(makeRootAgentEvents, Is.EqualTo(1));
+
+ // Normally these would be invoked by a CompleteMovement message coming in to the UDP stack. But for
+ // convenience, here we will invoke it manually.
+ sp.CompleteMovement(sp.ControllingClient, true);
+
+ Assert.That(makeRootAgentEvents, Is.EqualTo(1));
+
+ // Check rest of exepcted parameters.
+ Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(spUuid), Is.Not.Null);
+ Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
+
+ Assert.That(sp.IsChildAgent, Is.False);
+ Assert.That(sp.UUID, Is.EqualTo(spUuid));
+
+ Assert.That(scene.GetScenePresences().Count, Is.EqualTo(1));
+ }
+
[Test]
public void TestCreateDuplicateRootScenePresence()
{
@@ -249,58 +288,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// Assert.That(childPresence, Is.Not.Null);
// Assert.That(childPresence.IsChildAgent, Is.True);
}
-
-// ///
-// /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
-// ///
-// [Test]
-// public void T010_TestAddRootAgent()
-// {
-// TestHelpers.InMethod();
-//
-// string firstName = "testfirstname";
-//
-// AgentCircuitData agent = new AgentCircuitData();
-// agent.AgentID = agent1;
-// agent.firstname = firstName;
-// agent.lastname = "testlastname";
-// agent.SessionID = UUID.Random();
-// agent.SecureSessionID = UUID.Random();
-// agent.circuitcode = 123;
-// agent.BaseFolder = UUID.Zero;
-// agent.InventoryFolder = UUID.Zero;
-// agent.startpos = Vector3.Zero;
-// agent.CapsPath = GetRandomCapsObjectPath();
-// agent.ChildrenCapSeeds = new Dictionary();
-// agent.child = true;
-//
-// scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
-//
-// string reason;
-// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
-// testclient = new TestClient(agent, scene);
-// scene.AddNewAgent(testclient);
-//
-// ScenePresence presence = scene.GetScenePresence(agent1);
-//
-// Assert.That(presence, Is.Not.Null, "presence is null");
-// Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same");
-// acd1 = agent;
-// }
-//
-// ///
-// /// Test removing an uncrossed root agent from a scene.
-// ///
-// [Test]
-// public void T011_TestRemoveRootAgent()
-// {
-// TestHelpers.InMethod();
-//
-// scene.RemoveClient(agent1);
-//
-// ScenePresence presence = scene.GetScenePresence(agent1);
-//
-// Assert.That(presence, Is.Null, "presence is not null");
-// }
}
}
\ No newline at end of file
--
cgit v1.1
From 3bc669ffc7638b56d5ab5aac038c33106ba9a95b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 16 Jan 2014 23:31:50 +0000
Subject: Actually put IsChildAgent = true inside the lock, otherwise there is
still a small window for race conditions on duplicate CompleteMovement calls
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 63cca56..3290da1 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -933,10 +933,12 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
lock (m_completeMovementLock)
+ {
if (!IsChildAgent)
return false;
- IsChildAgent = false;
+ IsChildAgent = false;
+ }
// Must reset this here so that a teleport to a region next to an existing region does not keep the flag
// set and prevent the close of the connection on a subsequent re-teleport.
--
cgit v1.1
From 4fa843ff19441c9daa4e7dae0a4d705f912fca54 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 16 Jan 2014 23:44:17 +0000
Subject: Reorder checks in SP.CompleteMovement() to fix test failures
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 69 ++++++++++++------------
1 file changed, 33 insertions(+), 36 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 18d84a2..85a20e9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1003,48 +1003,45 @@ namespace OpenSim.Region.Framework.Scenes
///
private bool MakeRootAgent(Vector3 pos, bool isFlying)
{
-// m_log.InfoFormat(
-// "[SCENE]: Upgrading child to root agent for {0} in {1}",
-// Name, m_scene.RegionInfo.RegionName);
-
- if (ParentUUID != UUID.Zero)
+ lock (m_completeMovementLock)
{
- m_log.DebugFormat("[SCENE PRESENCE]: Sitting avatar back on prim {0}", ParentUUID);
- SceneObjectPart part = m_scene.GetSceneObjectPart(ParentUUID);
- if (part == null)
+ if (!IsChildAgent)
+ return false;
+
+ //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
+
+ // m_log.InfoFormat(
+ // "[SCENE]: Upgrading child to root agent for {0} in {1}",
+ // Name, m_scene.RegionInfo.RegionName);
+
+ if (ParentUUID != UUID.Zero)
{
- m_log.ErrorFormat("[SCENE PRESENCE]: Can't find prim {0} to sit on", ParentUUID);
+ m_log.DebugFormat("[SCENE PRESENCE]: Sitting avatar back on prim {0}", ParentUUID);
+ SceneObjectPart part = m_scene.GetSceneObjectPart(ParentUUID);
+ if (part == null)
+ {
+ m_log.ErrorFormat("[SCENE PRESENCE]: Can't find prim {0} to sit on", ParentUUID);
+ }
+ else
+ {
+ part.ParentGroup.AddAvatar(UUID);
+ if (part.SitTargetPosition != Vector3.Zero)
+ part.SitTargetAvatar = UUID;
+ // ParentPosition = part.GetWorldPosition();
+ ParentID = part.LocalId;
+ ParentPart = part;
+ m_pos = PrevSitOffset;
+ // pos = ParentPosition;
+ pos = part.GetWorldPosition();
+ }
+ ParentUUID = UUID.Zero;
+
+ // Animator.TrySetMovementAnimation("SIT");
}
else
{
- part.ParentGroup.AddAvatar(UUID);
- if (part.SitTargetPosition != Vector3.Zero)
- part.SitTargetAvatar = UUID;
-// ParentPosition = part.GetWorldPosition();
- ParentID = part.LocalId;
- ParentPart = part;
- m_pos = PrevSitOffset;
-// pos = ParentPosition;
- pos = part.GetWorldPosition();
+ IsLoggingIn = false;
}
- ParentUUID = UUID.Zero;
-
- IsChildAgent = false;
-
-// Animator.TrySetMovementAnimation("SIT");
- }
- else
- {
- IsChildAgent = false;
- IsLoggingIn = false;
- }
-
- //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
-
- lock (m_completeMovementLock)
- {
- if (!IsChildAgent)
- return false;
IsChildAgent = false;
}
--
cgit v1.1
From 39e5785c0f5bfa9fce2549757ac895920c88825a Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Thu, 31 Oct 2013 12:50:17 +0200
Subject: Fixed: Windlight functions caused an error if called when the
script's owner isn't in the scene
---
.../Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index 1d6cb6d..30eed40 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -446,7 +446,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return 0;
}
- if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+
+ ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
+ if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
{
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return 0;
@@ -474,7 +476,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return;
}
- if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+
+ ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
+ if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
{
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return;
@@ -497,7 +501,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return 0;
}
- if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+
+ ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
+ if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
{
LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
return 0;
--
cgit v1.1
From 14c72d4a5bba73c10bd4a5d93d53cd4fc0398570 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 17 Jan 2014 01:58:10 +0000
Subject: Revert "Fixed: Windlight functions caused an error if called when the
script's owner isn't in the scene"
This reverts commit 39e5785c0f5bfa9fce2549757ac895920c88825a.
Did not mean to apply this yet.
---
.../Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index 30eed40..1d6cb6d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -446,9 +446,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return 0;
}
-
- ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
- if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
+ if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
{
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return 0;
@@ -476,9 +474,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return;
}
-
- ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
- if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
+ if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
{
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return;
@@ -501,9 +497,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return 0;
}
-
- ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
- if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
+ if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
{
LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
return 0;
--
cgit v1.1
From 9fefbcf7fc5e8767030757da7ab077fa96cc0904 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 17 Jan 2014 23:32:37 +0000
Subject: minor: since structs are values, assigning them to another variable
copies it. Instantiation is unnecessary.
---
.../Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 246b253..5fea0cf 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1385,7 +1385,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos)
{
version = String.Empty;
- newpos = new Vector3(pos.X, pos.Y, pos.Z);
+ newpos = pos;
// m_log.DebugFormat(
// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name);
--
cgit v1.1
From b52b50ee56f3461d7f2dc47a905a0b10d07d3346 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 17 Jan 2014 23:36:23 +0000
Subject: minor: reinsert some method doc back into IEntityTransferModule
---
.../Framework/Interfaces/IEntityTransferModule.cs | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
index 1949a90..214b07a 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
@@ -47,13 +47,33 @@ namespace OpenSim.Region.Framework.Interfaces
/// The handle of the destination region. If it's the same as the region currently
/// occupied by the agent then the teleport will be within that region.
///
+ ///
+ ///
///
///
///
void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags);
+ ///
+ /// Teleports the agent for the given client to their home destination.
+ ///
+ ///
+ ///
bool TeleportHome(UUID id, IClientAPI client);
+ ///
+ /// Teleport an agent directly to a given region without checking whether the region should be substituted.
+ ///
+ ///
+ /// Please use Teleport() instead unless you know exactly what you're doing.
+ /// Do not use for same region teleports.
+ ///
+ ///
+ ///
+ /// /param>
+ ///
+ ///
+ ///
void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination,
Vector3 position, Vector3 lookAt, uint teleportFlags);
--
cgit v1.1
From 12bfce7b9f1356893e351d13ddd947810c352727 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 18 Jan 2014 00:06:12 +0000
Subject: elminate unnecessary asset != null check in
FlotsamAssetCache.UpdateFileCache()
Passed in asset is always not null
---
.../Region/CoreModules/Asset/FlotsamAssetCache.cs | 97 +++++++++++-----------
1 file changed, 47 insertions(+), 50 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index f1fee63..e1aa460 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -248,70 +248,67 @@ namespace OpenSim.Region.CoreModules.Asset
private void UpdateFileCache(string key, AssetBase asset)
{
- // TODO: Spawn this off to some seperate thread to do the actual writing
- if (asset != null)
- {
- string filename = GetFileName(key);
+ string filename = GetFileName(key);
- try
+ try
+ {
+ // If the file is already cached, don't cache it, just touch it so access time is updated
+ if (File.Exists(filename))
{
- // If the file is already cached, don't cache it, just touch it so access time is updated
- if (File.Exists(filename))
+ // We don't really want to know about sharing
+ // violations here. If the file is locked, then
+ // the other thread has updated the time for us.
+ try
{
- // We don't really want to know about sharing
- // violations here. If the file is locked, then
- // the other thread has updated the time for us.
- try
+ lock (m_CurrentlyWriting)
{
- lock (m_CurrentlyWriting)
- {
- if (!m_CurrentlyWriting.Contains(filename))
- File.SetLastAccessTime(filename, DateTime.Now);
- }
+ if (!m_CurrentlyWriting.Contains(filename))
+ File.SetLastAccessTime(filename, DateTime.Now);
}
- catch
+ }
+ catch
+ {
+ }
+ }
+ else
+ {
+ // Once we start writing, make sure we flag that we're writing
+ // that object to the cache so that we don't try to write the
+ // same file multiple times.
+ lock (m_CurrentlyWriting)
+ {
+#if WAIT_ON_INPROGRESS_REQUESTS
+ if (m_CurrentlyWriting.ContainsKey(filename))
{
+ return;
}
- } else {
-
- // Once we start writing, make sure we flag that we're writing
- // that object to the cache so that we don't try to write the
- // same file multiple times.
- lock (m_CurrentlyWriting)
+ else
{
-#if WAIT_ON_INPROGRESS_REQUESTS
- if (m_CurrentlyWriting.ContainsKey(filename))
- {
- return;
- }
- else
- {
- m_CurrentlyWriting.Add(filename, new ManualResetEvent(false));
- }
+ m_CurrentlyWriting.Add(filename, new ManualResetEvent(false));
+ }
#else
- if (m_CurrentlyWriting.Contains(filename))
- {
- return;
- }
- else
- {
- m_CurrentlyWriting.Add(filename);
- }
-#endif
-
+ if (m_CurrentlyWriting.Contains(filename))
+ {
+ return;
}
+ else
+ {
+ m_CurrentlyWriting.Add(filename);
+ }
+#endif
- Util.FireAndForget(
- delegate { WriteFileCache(filename, asset); });
}
+
+ Util.FireAndForget(
+ delegate { WriteFileCache(filename, asset); });
}
- catch (Exception e)
- {
- m_log.ErrorFormat(
- "[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}",
- asset.ID, e.Message, e.StackTrace);
- }
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat(
+ "[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}",
+ asset.ID, e.Message, e.StackTrace);
}
}
--
cgit v1.1
From 97fbb8ed45e4827ea7473bac2b792499a9284c3e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 18 Jan 2014 00:12:12 +0000
Subject: Elminate some copy/paste in FlotsamAssetCache.CheckFromFileCache()
and use using() construct to ensure filestream is always closed
---
.../Region/CoreModules/Asset/FlotsamAssetCache.cs | 43 +++++-----------------
1 file changed, 10 insertions(+), 33 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index e1aa460..169412e 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -352,7 +352,6 @@ namespace OpenSim.Region.CoreModules.Asset
return false;
}
-
///
/// Try to get an asset from the file cache.
///
@@ -390,15 +389,16 @@ namespace OpenSim.Region.CoreModules.Asset
if (File.Exists(filename))
{
- FileStream stream = null;
try
{
- stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
- BinaryFormatter bformatter = new BinaryFormatter();
+ using (FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
+ {
+ BinaryFormatter bformatter = new BinaryFormatter();
- asset = (AssetBase)bformatter.Deserialize(stream);
+ asset = (AssetBase)bformatter.Deserialize(stream);
- m_DiskHits++;
+ m_DiskHits++;
+ }
}
catch (System.Runtime.Serialization.SerializationException e)
{
@@ -417,12 +417,6 @@ namespace OpenSim.Region.CoreModules.Asset
m_log.WarnFormat(
"[FLOTSAM ASSET CACHE]: Failed to get file {0} for asset {1}. Exception {2} {3}",
filename, id, e.Message, e.StackTrace);
-
- }
- finally
- {
- if (stream != null)
- stream.Close();
}
}
@@ -434,36 +428,19 @@ namespace OpenSim.Region.CoreModules.Asset
bool found = false;
string filename = GetFileName(id);
+
if (File.Exists(filename))
{
- // actually check if we can open it, and so update expire
- FileStream stream = null;
try
{
- stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
- if (stream != null)
+ using (FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
{
- found = true;
- stream.Close();
+ if (stream != null)
+ found = true;
}
-
- }
- catch (System.Runtime.Serialization.SerializationException e)
- {
- found = false;
- m_log.ErrorFormat(
- "[FLOTSAM ASSET CACHE]: Failed to check file {0} for asset {1}. Exception {2} {3}",
- filename, id, e.Message, e.StackTrace);
-
- // If there was a problem deserializing the asset, the asset may
- // either be corrupted OR was serialized under an old format
- // {different version of AssetBase} -- we should attempt to
- // delete it and re-cache
- File.Delete(filename);
}
catch (Exception e)
{
- found = false;
m_log.ErrorFormat(
"[FLOTSAM ASSET CACHE]: Failed to check file {0} for asset {1}. Exception {2} {3}",
filename, id, e.Message, e.StackTrace);
--
cgit v1.1
From d381da81d6bf57f05dd3f3430de6c8c936932292 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 18 Jan 2014 00:15:38 +0000
Subject: minor: Add method doc to IImproveAssetCache
---
OpenSim/Framework/IImprovedAssetCache.cs | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/IImprovedAssetCache.cs b/OpenSim/Framework/IImprovedAssetCache.cs
index a0b8b55..a853e90 100644
--- a/OpenSim/Framework/IImprovedAssetCache.cs
+++ b/OpenSim/Framework/IImprovedAssetCache.cs
@@ -31,10 +31,34 @@ namespace OpenSim.Framework
{
public interface IImprovedAssetCache
{
+ ///
+ /// Cache the specified asset.
+ ///
+ ///
void Cache(AssetBase asset);
+
+ ///
+ /// Get an asset by its id.
+ ///
+ ///
+ /// null if the asset does not exist.
AssetBase Get(string id);
+
+ ///
+ /// Check whether an asset with the specified id exists in the cache.
+ ///
+ ///
bool Check(string id);
+
+ ///
+ /// Expire an asset from the cache.
+ ///
+ ///
void Expire(string id);
+
+ ///
+ /// Clear the cache.
+ ///
void Clear();
}
-}
+}
\ No newline at end of file
--
cgit v1.1
From ee8ba1ab9a30cf397c390b161a5d03e8c7b86290 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 18 Jan 2014 00:21:53 +0000
Subject: Simplify FlotsamAssetCache.CheckFromMemoryCache()
---
OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 169412e..a1803c1 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -344,12 +344,7 @@ namespace OpenSim.Region.CoreModules.Asset
private bool CheckFromMemoryCache(string id)
{
- AssetBase asset = null;
-
- if (m_MemoryCache.TryGetValue(id, out asset))
- return true;
-
- return false;
+ return m_MemoryCache.Contains(id);
}
///
--
cgit v1.1
From fc7ccfdafae7b8e9acd130b9f70e99241e0d33fa Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 18 Jan 2014 00:30:23 +0000
Subject: Properly implement CenomeAssetCache.Check()
---
OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index f43305f..9b0e1f4 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -194,10 +194,12 @@ namespace OpenSim.Region.CoreModules.Asset
#region IImprovedAssetCache Members
-
public bool Check(string id)
{
- return false;
+ AssetBase asset;
+
+ // XXX:This is probably not an efficient implementation.
+ return m_cache.TryGetValue(id, out asset);
}
///
--
cgit v1.1
From 427ffd3387c13daf7babc08c13a9acac1fe405c5 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 18 Jan 2014 00:48:20 +0000
Subject: implement GlynnTuckerAssetCache.Check()
---
OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
index ce9b546..5f76ac2 100644
--- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Asset
public bool Check(string id)
{
- return false;
+ return m_Cache.Contains(id);
}
public void Cache(AssetBase asset)
--
cgit v1.1
From b9453a8f6f68cff86c261d245c41955ec8f8af84 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 18 Jan 2014 00:52:36 +0000
Subject: implement CoreAssetCache.Check()
---
OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
index 58ce61a..f720748 100644
--- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
@@ -114,7 +114,8 @@ namespace OpenSim.Region.CoreModules.Asset
//
public bool Check(string id)
{
- return false;
+ // XXX This is probably not an efficient implementation.
+ return Get(id) != null;
}
public void Cache(AssetBase asset)
--
cgit v1.1
From 0cbe5f842419040dcfee688664d605a03d2f420b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 18 Jan 2014 00:55:49 +0000
Subject: Remove redundant methods in FlotsamAssetCache
---
OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 10 ----------
1 file changed, 10 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index a1803c1..6a5f8f3 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -487,11 +487,6 @@ namespace OpenSim.Region.CoreModules.Asset
return Get(id);
}
- public AssetBase CheckCached(string id)
- {
- return Get(id);
- }
-
public void Expire(string id)
{
if (m_LogLevel >= 2)
@@ -1036,11 +1031,6 @@ namespace OpenSim.Region.CoreModules.Asset
return asset.Data;
}
- public bool CheckData(string id)
- {
- return Check(id); ;
- }
-
public bool Get(string id, object sender, AssetRetrieved handler)
{
AssetBase asset = Get(id);
--
cgit v1.1
From 50ea2e0d67a9edee86d76b2fa8d4561710326461 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Thu, 31 Oct 2013 12:50:17 +0200
Subject: Fixed: Windlight functions caused an error if called when the
script's owner isn't in the scene
---
.../Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index 1d6cb6d..30eed40 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -446,7 +446,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return 0;
}
- if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+
+ ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
+ if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
{
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return 0;
@@ -474,7 +476,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return;
}
- if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+
+ ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
+ if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
{
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return;
@@ -497,7 +501,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return 0;
}
- if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+
+ ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
+ if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
{
LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
return 0;
--
cgit v1.1
From e9454d4672782647247db36e0d5e18b82cad58f0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 18 Jan 2014 01:36:40 +0000
Subject: Following on from 50ea2e0, only fetch scene presence for check if
lightscript function has failed initial IsEstateManagerOrOwner() check
---
.../Shared/Api/Implementation/LS_Api.cs | 55 +++++++++++++++-------
1 file changed, 38 insertions(+), 17 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index 30eed40..b13a5ae 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -434,6 +434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
return wl;
}
+
///
/// Set the current Windlight scene
///
@@ -447,14 +448,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return 0;
}
- ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
- if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
+ if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
{
- LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
- return 0;
+ ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
+
+ if (sp == null || sp.GodLevel < 200)
+ {
+ LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
+ return 0;
+ }
}
+
int success = 0;
m_host.AddScriptLPS(1);
+
if (LightShareModule.EnableWindlight)
{
RegionLightShareData wl = getWindlightProfileFromRules(rules);
@@ -467,8 +474,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("Windlight module is disabled");
return 0;
}
+
return success;
}
+
public void lsClearWindlightScene()
{
if (!m_LSFunctionsEnabled)
@@ -476,19 +485,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return;
}
-
- ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
- if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
+
+ if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
{
- LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
- return;
+ ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
+
+ if (sp == null || sp.GodLevel < 200)
+ {
+ LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
+ return;
+ }
}
m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false;
if (m_host.ParentGroup.Scene.SimulationDataService != null)
m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID);
+
m_host.ParentGroup.Scene.EventManager.TriggerOnSaveNewWindlightProfile();
}
+
///
/// Set the current Windlight scene to a target avatar
///
@@ -501,15 +516,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return 0;
}
-
- ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
- if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && (sp == null || sp.GodLevel < 200))
+
+ if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
{
- LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
- return 0;
+ ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
+
+ if (sp == null || sp.GodLevel < 200)
+ {
+ LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
+ return 0;
+ }
}
+
int success = 0;
m_host.AddScriptLPS(1);
+
if (LightShareModule.EnableWindlight)
{
RegionLightShareData wl = getWindlightProfileFromRules(rules);
@@ -521,8 +542,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("Windlight module is disabled");
return 0;
}
+
return success;
- }
-
+ }
}
-}
+}
\ No newline at end of file
--
cgit v1.1
From 4fb3d314b85019af0e30cf0c2e7c24e9bf32ab66 Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Sun, 19 Jan 2014 07:26:55 -0800
Subject: Fix casting error for float type INI file parameter parsing.
---
OpenSim/Framework/Util.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index cebba46..7bc8176 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1031,7 +1031,7 @@ namespace OpenSim.Framework
else if (typeof(T) == typeof(Int32))
val = cnf.GetInt(varname, (int)val);
else if (typeof(T) == typeof(float))
- val = cnf.GetFloat(varname, (int)val);
+ val = cnf.GetFloat(varname, (float)val);
else
m_log.ErrorFormat("[UTIL]: Unhandled type {0}", typeof(T));
}
--
cgit v1.1