Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
ubit 2012-07-17 02:41:58 +02:00
commit 1365fe07cd
7 changed files with 13 additions and 83 deletions

View File

@ -77,8 +77,6 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="itemID">The item ID of the script.</param>
bool GetScriptState(UUID itemID);
void SetRunEnable(UUID instanceID, bool enable);
void SaveAllState();
/// <summary>

View File

@ -2298,25 +2298,11 @@ namespace OpenSim.Region.Framework.Scenes
if (part == null)
return;
IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
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)
{

View File

@ -63,16 +63,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
/// </summary>
bool Running { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this
/// <see cref="OpenSim.Region.ScriptEngine.Interfaces.IScriptInstance"/> is run.
/// For viewer script editor control
/// </summary>
/// <value>
/// <c>true</c> if run; otherwise, <c>false</c>.
/// </value>
bool Run { get; set; }
/// <summary>
/// Is the script suspended?
/// </summary>

View File

@ -122,8 +122,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public bool Running { get; set; }
public bool Run { get; set; }
public bool Suspended
{
get { return m_Suspended; }
@ -219,7 +217,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]));

View File

@ -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<string, Object> 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)

View File

@ -1632,13 +1632,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);

View File

@ -57,7 +57,12 @@ namespace OpenSim.Region.UserStatistics
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static SqliteConnection dbConn;
/// <summary>
/// User statistics sessions keyed by agent ID
/// </summary>
private Dictionary<UUID, UserSessionID> m_sessions = new Dictionary<UUID, UserSessionID>();
private List<Scene> m_scenes = new List<Scene>();
private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>();
private Dictionary<UUID, USimStatsData> m_simstatsCounters = new Dictionary<UUID, USimStatsData>();
@ -308,49 +313,41 @@ namespace OpenSim.Region.UserStatistics
scene.EventManager.OnDeregisterCaps += OnDeRegisterCaps;
scene.EventManager.OnClientClosed += OnClientClosed;
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
}
}
}
private void OnMakeRootAgent(ScenePresence agent)
{
UUID regionUUID = GetRegionUUIDFromHandle(agent.RegionHandle);
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 = regionUUID;
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 = regionUUID;
uid.session_id = agent.ControllingClient.SessionId;
m_sessions[agent.UUID] = uid;
}
}
uid = m_sessions[agent.UUID];
}
private void OnMakeChildAgent(ScenePresence agent)
{
uid.region_id = agent.Scene.RegionInfo.RegionID;
uid.session_id = agent.ControllingClient.SessionId;
}
}
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);
}
@ -395,20 +392,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;
}
/// <summary>
/// Callback for a viewerstats cap
/// </summary>