From ed14dac0a38defa64d36e691b12ba6a2e2b8642d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 16 Jul 2012 23:03:23 +0100
Subject: Stop warning about no session from ViewerStats if user teleports to
another region in the same simulator that was not next to the source region.
This was because teleporting to the new region invoked the new session setup code before the agent was removed from the old region, which then invoked the session teardown code.
Now, we only invoke the teardown code if the region ID occupied by the agent being removed is the same as the one registered for the current session.
---
OpenSim/Region/UserStatistics/WebStatsModule.cs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index faf746f..d1a7217 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -57,7 +57,12 @@ namespace OpenSim.Region.UserStatistics
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static SqliteConnection dbConn;
+
+ ///
+ /// User statistics sessions keyed by agent ID
+ ///
private Dictionary m_sessions = new Dictionary();
+
private List m_scenes = new List();
private Dictionary reports = new Dictionary();
private Dictionary m_simstatsCounters = new Dictionary();
@@ -308,7 +313,6 @@ namespace OpenSim.Region.UserStatistics
scene.EventManager.OnDeregisterCaps += OnDeRegisterCaps;
scene.EventManager.OnClientClosed += OnClientClosed;
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
- scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
}
}
}
@@ -342,15 +346,11 @@ namespace OpenSim.Region.UserStatistics
}
}
- private void OnMakeChildAgent(ScenePresence agent)
- {
- }
-
private void OnClientClosed(UUID agentID, Scene scene)
{
lock (m_sessions)
{
- if (m_sessions.ContainsKey(agentID))
+ if (m_sessions.ContainsKey(agentID) && m_sessions[agentID].region_id == scene.RegionInfo.RegionID)
{
m_sessions.Remove(agentID);
}
--
cgit v1.1
From 217f47b0d5b2382a93f3947e0840056a3ba1abfd Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 16 Jul 2012 23:09:48 +0100
Subject: In WebStatsModule.OnMakeRootAgent(), get region ID directly from
SP.Scene.RegionInfo.RegionID instead of manually looking it up from the
stored scene list.
---
OpenSim/Region/UserStatistics/WebStatsModule.cs | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index d1a7217..ed424ab 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -319,8 +319,6 @@ namespace OpenSim.Region.UserStatistics
private void OnMakeRootAgent(ScenePresence agent)
{
- UUID regionUUID = GetRegionUUIDFromHandle(agent.RegionHandle);
-
lock (m_sessions)
{
if (!m_sessions.ContainsKey(agent.UUID))
@@ -330,7 +328,7 @@ namespace OpenSim.Region.UserStatistics
UserSessionID uid = new UserSessionID();
uid.name_f = agent.Firstname;
uid.name_l = agent.Lastname;
- uid.region_id = regionUUID;
+ uid.region_id = agent.Scene.RegionInfo.RegionID;
uid.session_id = agent.ControllingClient.SessionId;
uid.session_data = usd;
@@ -339,7 +337,7 @@ namespace OpenSim.Region.UserStatistics
else
{
UserSessionID uid = m_sessions[agent.UUID];
- uid.region_id = regionUUID;
+ uid.region_id = agent.Scene.RegionInfo.RegionID;
uid.session_id = agent.ControllingClient.SessionId;
m_sessions[agent.UUID] = uid;
}
@@ -395,20 +393,6 @@ namespace OpenSim.Region.UserStatistics
return encoding.GetString(buffer);
}
- private UUID GetRegionUUIDFromHandle(ulong regionhandle)
- {
- lock (m_scenes)
- {
- foreach (Scene scene in m_scenes)
- {
- if (scene.RegionInfo.RegionHandle == regionhandle)
- return scene.RegionInfo.RegionID;
- }
- }
-
- return UUID.Zero;
- }
-
///
/// Callback for a viewerstats cap
///
--
cgit v1.1
From c1667d39a610488e80e9d7c939ee7b449f02410d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 16 Jul 2012 23:15:02 +0100
Subject: refactor: factor out common code in WebStatsModule.OnMakeRootAgent()
---
OpenSim/Region/UserStatistics/WebStatsModule.cs | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index ed424ab..c11ea02 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -321,26 +321,25 @@ namespace OpenSim.Region.UserStatistics
{
lock (m_sessions)
{
+ UserSessionID uid;
+
if (!m_sessions.ContainsKey(agent.UUID))
{
UserSessionData usd = UserSessionUtil.newUserSessionData();
-
- UserSessionID uid = new UserSessionID();
+ uid = new UserSessionID();
uid.name_f = agent.Firstname;
uid.name_l = agent.Lastname;
- uid.region_id = agent.Scene.RegionInfo.RegionID;
- uid.session_id = agent.ControllingClient.SessionId;
uid.session_data = usd;
m_sessions.Add(agent.UUID, uid);
}
else
{
- UserSessionID uid = m_sessions[agent.UUID];
- uid.region_id = agent.Scene.RegionInfo.RegionID;
- uid.session_id = agent.ControllingClient.SessionId;
- m_sessions[agent.UUID] = uid;
+ uid = m_sessions[agent.UUID];
}
+
+ uid.region_id = agent.Scene.RegionInfo.RegionID;
+ uid.session_id = agent.ControllingClient.SessionId;
}
}
--
cgit v1.1
From 1c3b0da74a6e662ceebad53c82d38ba8a42795b3 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Mon, 16 Jul 2012 23:31:55 +0100
Subject: Revert "Fix script "Running" behavior"
A better solution using the already present flags must be found.
This reverts commit 6d3ee8bb39d47ed7b32e8905fa0b2fc31c5a9f80.
---
OpenSim/Region/Framework/Interfaces/IScriptModule.cs | 2 --
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 14 --------------
OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | 10 ----------
.../Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 9 ---------
.../ScriptEngine/Shared/Instance/ScriptSerializer.cs | 11 -----------
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 7 -------
6 files changed, 53 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index 42dbedc..143af48 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -77,8 +77,6 @@ namespace OpenSim.Region.Framework.Interfaces
/// The item ID of the script.
bool GetScriptState(UUID itemID);
- void SetRunEnable(UUID instanceID, bool enable);
-
void SaveAllState();
///
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 9ff8467..e413281 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2143,24 +2143,10 @@ namespace OpenSim.Region.Framework.Scenes
if (part == null)
return;
- IScriptModule[] engines = RequestModuleInterfaces();
-
if (running)
- {
- foreach (IScriptModule engine in engines)
- {
- engine.SetRunEnable(itemID, true);
- }
EventManager.TriggerStartScript(part.LocalId, itemID);
- }
else
- {
- foreach (IScriptModule engine in engines)
- {
- engine.SetRunEnable(itemID, false);
- }
EventManager.TriggerStopScript(part.LocalId, itemID);
- }
}
public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index ec13b6c..b04f6b6 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -64,16 +64,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
bool Running { get; set; }
///
- /// Gets or sets a value indicating whether this
- /// is run.
- /// For viewer script editor control
- ///
- ///
- /// true if run; otherwise, false.
- ///
- bool Run { get; set; }
-
- ///
/// Is the script suspended?
///
bool Suspended { get; set; }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index f1abd4b..d570ef7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -121,8 +121,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public bool Running { get; set; }
- public bool Run { get; set; }
-
public bool Suspended
{
get { return m_Suspended; }
@@ -218,7 +216,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_postOnRez = postOnRez;
m_AttachedAvatar = part.ParentGroup.AttachedAvatar;
m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
- Run = true;
if (part != null)
{
@@ -360,9 +357,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (m_startedFromSavedState)
{
- if (!Run)
- return;
-
Start();
if (m_postOnRez)
{
@@ -395,9 +389,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
else
{
- if (!Run)
- return;
-
Start();
PostEvent(new EventParams("state_entry",
new Object[0], new DetectParams[0]));
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs
index 797bce3..bcdc7bf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs
@@ -55,7 +55,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public static string Serialize(ScriptInstance instance)
{
bool running = instance.Running;
- bool enabled = instance.Run;
XmlDocument xmldoc = new XmlDocument();
@@ -78,12 +77,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
rootElement.AppendChild(run);
- XmlElement run_enable = xmldoc.CreateElement("", "Run", "");
- run_enable.AppendChild(xmldoc.CreateTextNode(
- enabled.ToString()));
-
- rootElement.AppendChild(run_enable);
-
Dictionary vars = instance.GetVars();
XmlElement variables = xmldoc.CreateElement("", "Variables", "");
@@ -232,7 +225,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
object varValue;
XmlNodeList partL = rootNode.ChildNodes;
- instance.Run = true;
foreach (XmlNode part in partL)
{
@@ -244,9 +236,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
case "Running":
instance.Running=bool.Parse(part.InnerText);
break;
- case "Run":
- instance.Run = bool.Parse(part.InnerText);
- break;
case "Variables":
XmlNodeList varL = part.ChildNodes;
foreach (XmlNode var in varL)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 20fad05..01aebb6 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1541,13 +1541,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
}
}
- public void SetRunEnable(UUID instanceID, bool enable)
- {
- IScriptInstance instance = GetInstance(instanceID);
- if (instance != null)
- instance.Run = enable;
- }
-
public bool GetScriptState(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
--
cgit v1.1