Merge branch 'master' of git://opensimulator.org/git/opensim
commit
dd85d7d981
|
@ -567,10 +567,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
|
|
||||||
m_scene.InventoryService.UpdateItem(item);
|
m_scene.InventoryService.UpdateItem(item);
|
||||||
|
|
||||||
// this gets called when the agent logs off!
|
// If the name of the object has been changed whilst attached then we want to update the inventory
|
||||||
|
// item in the viewer.
|
||||||
if (sp.ControllingClient != null)
|
if (sp.ControllingClient != null)
|
||||||
sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
|
sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
grp.HasGroupChanged = false; // Prevent it being saved over and over
|
grp.HasGroupChanged = false; // Prevent it being saved over and over
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
|
|
|
@ -139,11 +139,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
|
// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
|
||||||
// toAgentID.ToString(), scene.RegionInfo.RegionName);
|
// toAgentID.ToString(), scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
ScenePresence sp = scene.GetScenePresence(toAgentID);
|
ScenePresence sp = scene.GetScenePresence(toAgentID);
|
||||||
if (sp != null && !sp.IsChildAgent)
|
if (sp != null && !sp.IsChildAgent)
|
||||||
{
|
{
|
||||||
// Local message
|
// Local message
|
||||||
// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID);
|
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", sp.Name, toAgentID);
|
||||||
|
|
||||||
sp.ControllingClient.SendInstantMessage(im);
|
sp.ControllingClient.SendInstantMessage(im);
|
||||||
|
|
||||||
// Message sent
|
// Message sent
|
||||||
|
@ -155,13 +157,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
// try child avatar second
|
// try child avatar second
|
||||||
foreach (Scene scene in m_Scenes)
|
foreach (Scene scene in m_Scenes)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
// "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName);
|
"[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
ScenePresence sp = scene.GetScenePresence(toAgentID);
|
ScenePresence sp = scene.GetScenePresence(toAgentID);
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
{
|
{
|
||||||
// Local message
|
// Local message
|
||||||
// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID);
|
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", sp.Name, toAgentID);
|
||||||
|
|
||||||
sp.ControllingClient.SendInstantMessage(im);
|
sp.ControllingClient.SendInstantMessage(im);
|
||||||
|
|
||||||
// Message sent
|
// Message sent
|
||||||
|
@ -170,10 +174,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
|
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
|
||||||
SendGridInstantMessageViaXMLRPC(im, result);
|
|
||||||
|
|
||||||
return;
|
SendGridInstantMessageViaXMLRPC(im, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result)
|
private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result)
|
||||||
|
|
|
@ -297,7 +297,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined)
|
else if (
|
||||||
|
im.dialog == (byte)InstantMessageDialog.InventoryDeclined
|
||||||
|
|| im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined)
|
||||||
{
|
{
|
||||||
// Here, the recipient is local and we can assume that the
|
// Here, the recipient is local and we can assume that the
|
||||||
// inventory is loaded. Courtesy of the above bulk update,
|
// inventory is loaded. Courtesy of the above bulk update,
|
||||||
|
|
|
@ -77,8 +77,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="itemID">The item ID of the script.</param>
|
/// <param name="itemID">The item ID of the script.</param>
|
||||||
bool GetScriptState(UUID itemID);
|
bool GetScriptState(UUID itemID);
|
||||||
|
|
||||||
void SetRunEnable(UUID instanceID, bool enable);
|
|
||||||
|
|
||||||
void SaveAllState();
|
void SaveAllState();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2143,24 +2143,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (part == null)
|
if (part == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
|
|
||||||
|
|
||||||
if (running)
|
if (running)
|
||||||
{
|
|
||||||
foreach (IScriptModule engine in engines)
|
|
||||||
{
|
|
||||||
engine.SetRunEnable(itemID, true);
|
|
||||||
}
|
|
||||||
EventManager.TriggerStartScript(part.LocalId, itemID);
|
EventManager.TriggerStartScript(part.LocalId, itemID);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
foreach (IScriptModule engine in engines)
|
|
||||||
{
|
|
||||||
engine.SetRunEnable(itemID, false);
|
|
||||||
}
|
|
||||||
EventManager.TriggerStopScript(part.LocalId, itemID);
|
EventManager.TriggerStopScript(part.LocalId, itemID);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
|
public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
|
||||||
|
|
|
@ -3317,24 +3317,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (AgentTransactionsModule != null)
|
if (AgentTransactionsModule != null)
|
||||||
AgentTransactionsModule.RemoveAgentAssetTransactions(agentID);
|
AgentTransactionsModule.RemoveAgentAssetTransactions(agentID);
|
||||||
|
|
||||||
avatar.Close();
|
|
||||||
|
|
||||||
m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
|
m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error(
|
m_log.Error(
|
||||||
string.Format("[SCENE]: Exception removing {0} from {1}, ", avatar.Name, RegionInfo.RegionName), e);
|
string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// Always clean these structures up so that any failure above doesn't cause them to remain in the
|
try
|
||||||
// scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering
|
{
|
||||||
// the same cleanup exception continually.
|
// Always clean these structures up so that any failure above doesn't cause them to remain in the
|
||||||
// TODO: This should probably extend to the whole method, but we don't want to also catch the NRE
|
// scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering
|
||||||
// since this would hide the underlying failure and other associated problems.
|
// the same cleanup exception continually.
|
||||||
m_sceneGraph.RemoveScenePresence(agentID);
|
m_sceneGraph.RemoveScenePresence(agentID);
|
||||||
m_clientManager.Remove(agentID);
|
m_clientManager.Remove(agentID);
|
||||||
|
|
||||||
|
avatar.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error(
|
||||||
|
string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
|
//m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
|
||||||
|
|
|
@ -63,16 +63,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool Running { get; set; }
|
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>
|
/// <summary>
|
||||||
/// Is the script suspended?
|
/// Is the script suspended?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -3973,23 +3973,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (agentItem == null)
|
if (agentItem == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
byte[] bucket = new byte[17];
|
|
||||||
bucket[0] = (byte)item.Type;
|
|
||||||
byte[] objBytes = agentItem.ID.GetBytes();
|
|
||||||
Array.Copy(objBytes, 0, bucket, 1, 16);
|
|
||||||
|
|
||||||
GridInstantMessage msg = new GridInstantMessage(World,
|
|
||||||
m_host.UUID, m_host.Name + ", an object owned by " +
|
|
||||||
resolveName(m_host.OwnerID) + ",", destId,
|
|
||||||
(byte)InstantMessageDialog.TaskInventoryOffered,
|
|
||||||
false, item.Name + "\n" + m_host.Name + " is located at " +
|
|
||||||
World.RegionInfo.RegionName+" "+
|
|
||||||
m_host.AbsolutePosition.ToString(),
|
|
||||||
agentItem.ID, true, m_host.AbsolutePosition,
|
|
||||||
bucket);
|
|
||||||
|
|
||||||
if (m_TransferModule != null)
|
if (m_TransferModule != null)
|
||||||
|
{
|
||||||
|
byte[] bucket = new byte[] { (byte)item.Type };
|
||||||
|
|
||||||
|
GridInstantMessage msg = new GridInstantMessage(World,
|
||||||
|
m_host.UUID, m_host.Name + ", an object owned by " +
|
||||||
|
resolveName(m_host.OwnerID) + ",", destId,
|
||||||
|
(byte)InstantMessageDialog.TaskInventoryOffered,
|
||||||
|
false, item.Name + "\n" + m_host.Name + " is located at " +
|
||||||
|
World.RegionInfo.RegionName+" "+
|
||||||
|
m_host.AbsolutePosition.ToString(),
|
||||||
|
agentItem.ID, true, m_host.AbsolutePosition,
|
||||||
|
bucket);
|
||||||
|
|
||||||
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
|
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
|
||||||
|
}
|
||||||
|
|
||||||
ScriptSleep(3000);
|
ScriptSleep(3000);
|
||||||
}
|
}
|
||||||
|
@ -6397,23 +6396,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (folderID == UUID.Zero)
|
if (folderID == UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
byte[] bucket = new byte[17];
|
|
||||||
bucket[0] = (byte)AssetType.Folder;
|
|
||||||
byte[] objBytes = folderID.GetBytes();
|
|
||||||
Array.Copy(objBytes, 0, bucket, 1, 16);
|
|
||||||
|
|
||||||
GridInstantMessage msg = new GridInstantMessage(World,
|
|
||||||
m_host.UUID, m_host.Name + ", an object owned by " +
|
|
||||||
resolveName(m_host.OwnerID) + ",", destID,
|
|
||||||
(byte)InstantMessageDialog.InventoryOffered,
|
|
||||||
false, category + "\n" + m_host.Name + " is located at " +
|
|
||||||
World.RegionInfo.RegionName + " " +
|
|
||||||
m_host.AbsolutePosition.ToString(),
|
|
||||||
folderID, true, m_host.AbsolutePosition,
|
|
||||||
bucket);
|
|
||||||
|
|
||||||
if (m_TransferModule != null)
|
if (m_TransferModule != null)
|
||||||
|
{
|
||||||
|
byte[] bucket = new byte[] { (byte)AssetType.Folder };
|
||||||
|
|
||||||
|
GridInstantMessage msg = new GridInstantMessage(World,
|
||||||
|
m_host.UUID, m_host.Name + ", an object owned by " +
|
||||||
|
resolveName(m_host.OwnerID) + ",", destID,
|
||||||
|
(byte)InstantMessageDialog.TaskInventoryOffered,
|
||||||
|
false, category + "\n" + m_host.Name + " is located at " +
|
||||||
|
World.RegionInfo.RegionName + " " +
|
||||||
|
m_host.AbsolutePosition.ToString(),
|
||||||
|
folderID, true, m_host.AbsolutePosition,
|
||||||
|
bucket);
|
||||||
|
|
||||||
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
|
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSetVehicleType(int type)
|
public void llSetVehicleType(int type)
|
||||||
|
|
|
@ -1664,9 +1664,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
CheckThreatLevel(ThreatLevel.Low, "osMessageObject");
|
CheckThreatLevel(ThreatLevel.Low, "osMessageObject");
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
UUID objUUID;
|
||||||
|
if (!UUID.TryParse(objectUUID, out objUUID)) // prior to patching, a thrown exception regarding invalid GUID format would be shouted instead.
|
||||||
|
{
|
||||||
|
OSSLShoutError("osMessageObject() cannot send messages to objects with invalid UUIDs");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) };
|
object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) };
|
||||||
|
|
||||||
SceneObjectPart sceneOP = World.GetSceneObjectPart(new UUID(objectUUID));
|
SceneObjectPart sceneOP = World.GetSceneObjectPart(objUUID);
|
||||||
|
|
||||||
|
if (sceneOP == null) // prior to patching, PostObjectEvent() would cause a throw exception to be shouted instead.
|
||||||
|
{
|
||||||
|
OSSLShoutError("osMessageObject() cannot send message to " + objUUID.ToString() + ", object was not found in scene.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_ScriptEngine.PostObjectEvent(
|
m_ScriptEngine.PostObjectEvent(
|
||||||
sceneOP.LocalId, new EventParams(
|
sceneOP.LocalId, new EventParams(
|
||||||
|
|
|
@ -121,8 +121,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
public bool Running { get; set; }
|
public bool Running { get; set; }
|
||||||
|
|
||||||
public bool Run { get; set; }
|
|
||||||
|
|
||||||
public bool Suspended
|
public bool Suspended
|
||||||
{
|
{
|
||||||
get { return m_Suspended; }
|
get { return m_Suspended; }
|
||||||
|
@ -218,7 +216,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
m_postOnRez = postOnRez;
|
m_postOnRez = postOnRez;
|
||||||
m_AttachedAvatar = part.ParentGroup.AttachedAvatar;
|
m_AttachedAvatar = part.ParentGroup.AttachedAvatar;
|
||||||
m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
|
m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
|
||||||
Run = true;
|
|
||||||
|
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
|
@ -315,11 +312,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
part.SetScriptEvents(ItemID,
|
part.SetScriptEvents(ItemID,
|
||||||
(int)m_Script.GetStateEventFlags(State));
|
(int)m_Script.GetStateEventFlags(State));
|
||||||
|
|
||||||
Running = false;
|
if (!Running)
|
||||||
|
|
||||||
if (ShuttingDown)
|
|
||||||
m_startOnInit = false;
|
m_startOnInit = false;
|
||||||
|
|
||||||
|
Running = false;
|
||||||
|
|
||||||
// we get new rez events on sim restart, too
|
// we get new rez events on sim restart, too
|
||||||
// but if there is state, then we fire the change
|
// but if there is state, then we fire the change
|
||||||
// event
|
// event
|
||||||
|
@ -355,15 +352,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
if (!m_startOnInit)
|
if (ShuttingDown)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_startedFromSavedState)
|
if (m_startedFromSavedState)
|
||||||
{
|
{
|
||||||
if (!Run)
|
if (m_startOnInit)
|
||||||
return;
|
Start();
|
||||||
|
|
||||||
Start();
|
|
||||||
if (m_postOnRez)
|
if (m_postOnRez)
|
||||||
{
|
{
|
||||||
PostEvent(new EventParams("on_rez",
|
PostEvent(new EventParams("on_rez",
|
||||||
|
@ -395,10 +390,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!Run)
|
if (m_startOnInit)
|
||||||
return;
|
Start();
|
||||||
|
|
||||||
Start();
|
|
||||||
PostEvent(new EventParams("state_entry",
|
PostEvent(new EventParams("state_entry",
|
||||||
new Object[0], new DetectParams[0]));
|
new Object[0], new DetectParams[0]));
|
||||||
if (m_postOnRez)
|
if (m_postOnRez)
|
||||||
|
|
|
@ -55,7 +55,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
public static string Serialize(ScriptInstance instance)
|
public static string Serialize(ScriptInstance instance)
|
||||||
{
|
{
|
||||||
bool running = instance.Running;
|
bool running = instance.Running;
|
||||||
bool enabled = instance.Run;
|
|
||||||
|
|
||||||
XmlDocument xmldoc = new XmlDocument();
|
XmlDocument xmldoc = new XmlDocument();
|
||||||
|
|
||||||
|
@ -78,12 +77,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
rootElement.AppendChild(run);
|
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();
|
Dictionary<string, Object> vars = instance.GetVars();
|
||||||
|
|
||||||
XmlElement variables = xmldoc.CreateElement("", "Variables", "");
|
XmlElement variables = xmldoc.CreateElement("", "Variables", "");
|
||||||
|
@ -232,7 +225,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
{
|
{
|
||||||
object varValue;
|
object varValue;
|
||||||
XmlNodeList partL = rootNode.ChildNodes;
|
XmlNodeList partL = rootNode.ChildNodes;
|
||||||
instance.Run = true;
|
|
||||||
|
|
||||||
foreach (XmlNode part in partL)
|
foreach (XmlNode part in partL)
|
||||||
{
|
{
|
||||||
|
@ -244,9 +236,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
case "Running":
|
case "Running":
|
||||||
instance.Running=bool.Parse(part.InnerText);
|
instance.Running=bool.Parse(part.InnerText);
|
||||||
break;
|
break;
|
||||||
case "Run":
|
|
||||||
instance.Run = bool.Parse(part.InnerText);
|
|
||||||
break;
|
|
||||||
case "Variables":
|
case "Variables":
|
||||||
XmlNodeList varL = part.ChildNodes;
|
XmlNodeList varL = part.ChildNodes;
|
||||||
foreach (XmlNode var in varL)
|
foreach (XmlNode var in varL)
|
||||||
|
|
|
@ -108,6 +108,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
private bool m_KillTimedOutScripts;
|
private bool m_KillTimedOutScripts;
|
||||||
private string m_ScriptEnginesPath = null;
|
private string m_ScriptEnginesPath = null;
|
||||||
|
|
||||||
|
private ExpiringCache<UUID, bool> m_runFlags = new ExpiringCache<UUID, bool>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is the entire simulator in the process of shutting down?
|
/// Is the entire simulator in the process of shutting down?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1196,6 +1198,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
if (instance != null)
|
if (instance != null)
|
||||||
instance.Init();
|
instance.Init();
|
||||||
|
|
||||||
|
bool runIt;
|
||||||
|
if (m_runFlags.TryGetValue(itemID, out runIt))
|
||||||
|
{
|
||||||
|
if (!runIt)
|
||||||
|
StopScript(itemID);
|
||||||
|
m_runFlags.Remove(itemID);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1541,13 +1551,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)
|
public bool GetScriptState(UUID itemID)
|
||||||
{
|
{
|
||||||
IScriptInstance instance = GetInstance(itemID);
|
IScriptInstance instance = GetInstance(itemID);
|
||||||
|
@ -1575,6 +1578,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
IScriptInstance instance = GetInstance(itemID);
|
IScriptInstance instance = GetInstance(itemID);
|
||||||
if (instance != null)
|
if (instance != null)
|
||||||
instance.Start();
|
instance.Start();
|
||||||
|
else
|
||||||
|
m_runFlags.AddOrUpdate(itemID, true, 240);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StopScript(UUID itemID)
|
public void StopScript(UUID itemID)
|
||||||
|
@ -1586,6 +1591,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
// cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort.
|
// cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort.
|
||||||
instance.Stop(1000);
|
instance.Stop(1000);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_runFlags.AddOrUpdate(itemID, false, 240);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DetectParams GetDetectParams(UUID itemID, int idx)
|
public DetectParams GetDetectParams(UUID itemID, int idx)
|
||||||
|
|
|
@ -57,7 +57,12 @@ namespace OpenSim.Region.UserStatistics
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private static SqliteConnection dbConn;
|
private static SqliteConnection dbConn;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// User statistics sessions keyed by agent ID
|
||||||
|
/// </summary>
|
||||||
private Dictionary<UUID, UserSessionID> m_sessions = new Dictionary<UUID, UserSessionID>();
|
private Dictionary<UUID, UserSessionID> m_sessions = new Dictionary<UUID, UserSessionID>();
|
||||||
|
|
||||||
private List<Scene> m_scenes = new List<Scene>();
|
private List<Scene> m_scenes = new List<Scene>();
|
||||||
private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>();
|
private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>();
|
||||||
private Dictionary<UUID, USimStatsData> m_simstatsCounters = new Dictionary<UUID, USimStatsData>();
|
private Dictionary<UUID, USimStatsData> m_simstatsCounters = new Dictionary<UUID, USimStatsData>();
|
||||||
|
@ -308,49 +313,41 @@ namespace OpenSim.Region.UserStatistics
|
||||||
scene.EventManager.OnDeregisterCaps += OnDeRegisterCaps;
|
scene.EventManager.OnDeregisterCaps += OnDeRegisterCaps;
|
||||||
scene.EventManager.OnClientClosed += OnClientClosed;
|
scene.EventManager.OnClientClosed += OnClientClosed;
|
||||||
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
|
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
|
||||||
scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMakeRootAgent(ScenePresence agent)
|
private void OnMakeRootAgent(ScenePresence agent)
|
||||||
{
|
{
|
||||||
UUID regionUUID = GetRegionUUIDFromHandle(agent.RegionHandle);
|
|
||||||
|
|
||||||
lock (m_sessions)
|
lock (m_sessions)
|
||||||
{
|
{
|
||||||
|
UserSessionID uid;
|
||||||
|
|
||||||
if (!m_sessions.ContainsKey(agent.UUID))
|
if (!m_sessions.ContainsKey(agent.UUID))
|
||||||
{
|
{
|
||||||
UserSessionData usd = UserSessionUtil.newUserSessionData();
|
UserSessionData usd = UserSessionUtil.newUserSessionData();
|
||||||
|
uid = new UserSessionID();
|
||||||
UserSessionID uid = new UserSessionID();
|
|
||||||
uid.name_f = agent.Firstname;
|
uid.name_f = agent.Firstname;
|
||||||
uid.name_l = agent.Lastname;
|
uid.name_l = agent.Lastname;
|
||||||
uid.region_id = regionUUID;
|
|
||||||
uid.session_id = agent.ControllingClient.SessionId;
|
|
||||||
uid.session_data = usd;
|
uid.session_data = usd;
|
||||||
|
|
||||||
m_sessions.Add(agent.UUID, uid);
|
m_sessions.Add(agent.UUID, uid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UserSessionID uid = m_sessions[agent.UUID];
|
uid = m_sessions[agent.UUID];
|
||||||
uid.region_id = regionUUID;
|
|
||||||
uid.session_id = agent.ControllingClient.SessionId;
|
|
||||||
m_sessions[agent.UUID] = uid;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
private void OnClientClosed(UUID agentID, Scene scene)
|
||||||
{
|
{
|
||||||
lock (m_sessions)
|
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);
|
m_sessions.Remove(agentID);
|
||||||
}
|
}
|
||||||
|
@ -395,20 +392,6 @@ namespace OpenSim.Region.UserStatistics
|
||||||
return encoding.GetString(buffer);
|
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>
|
/// <summary>
|
||||||
/// Callback for a viewerstats cap
|
/// Callback for a viewerstats cap
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue