aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs19
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs26
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs56
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs23
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs23
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs43
13 files changed, 111 insertions, 139 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 64ee7e4..d34a8f6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -567,10 +567,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
567 567
568 m_scene.InventoryService.UpdateItem(item); 568 m_scene.InventoryService.UpdateItem(item);
569 569
570 // this gets called when the agent logs off! 570 // If the name of the object has been changed whilst attached then we want to update the inventory
571 // item in the viewer.
571 if (sp.ControllingClient != null) 572 if (sp.ControllingClient != null)
572 sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0); 573 sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
573 } 574 }
575
574 grp.HasGroupChanged = false; // Prevent it being saved over and over 576 grp.HasGroupChanged = false; // Prevent it being saved over and over
575 } 577 }
576// else 578// else
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 0dad3c4..596174b 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -137,13 +137,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
137 foreach (Scene scene in m_Scenes) 137 foreach (Scene scene in m_Scenes)
138 { 138 {
139// m_log.DebugFormat( 139// m_log.DebugFormat(
140// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", 140// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
141// toAgentID.ToString(), scene.RegionInfo.RegionName); 141// toAgentID.ToString(), scene.RegionInfo.RegionName);
142
142 ScenePresence sp = scene.GetScenePresence(toAgentID); 143 ScenePresence sp = scene.GetScenePresence(toAgentID);
143 if (sp != null && !sp.IsChildAgent) 144 if (sp != null && !sp.IsChildAgent)
144 { 145 {
145 // Local message 146 // Local message
146// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); 147 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", sp.Name, toAgentID);
148
147 sp.ControllingClient.SendInstantMessage(im); 149 sp.ControllingClient.SendInstantMessage(im);
148 150
149 // Message sent 151 // Message sent
@@ -155,13 +157,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
155 // try child avatar second 157 // try child avatar second
156 foreach (Scene scene in m_Scenes) 158 foreach (Scene scene in m_Scenes)
157 { 159 {
158// m_log.DebugFormat( 160 m_log.DebugFormat(
159// "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); 161 "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName);
162
160 ScenePresence sp = scene.GetScenePresence(toAgentID); 163 ScenePresence sp = scene.GetScenePresence(toAgentID);
161 if (sp != null) 164 if (sp != null)
162 { 165 {
163 // Local message 166 // Local message
164// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); 167 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", sp.Name, toAgentID);
168
165 sp.ControllingClient.SendInstantMessage(im); 169 sp.ControllingClient.SendInstantMessage(im);
166 170
167 // Message sent 171 // Message sent
@@ -170,10 +174,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
170 } 174 }
171 } 175 }
172 176
173// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); 177 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
174 SendGridInstantMessageViaXMLRPC(im, result);
175 178
176 return; 179 SendGridInstantMessageViaXMLRPC(im, result);
177 } 180 }
178 181
179 private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result) 182 private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result)
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 19c774f..f3af59a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -297,7 +297,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
297 }); 297 });
298 } 298 }
299 } 299 }
300 else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) 300 else if (
301 im.dialog == (byte)InstantMessageDialog.InventoryDeclined
302 || im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined)
301 { 303 {
302 // Here, the recipient is local and we can assume that the 304 // Here, the recipient is local and we can assume that the
303 // inventory is loaded. Courtesy of the above bulk update, 305 // inventory is loaded. Courtesy of the above bulk update,
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
77 /// <param name="itemID">The item ID of the script.</param> 77 /// <param name="itemID">The item ID of the script.</param>
78 bool GetScriptState(UUID itemID); 78 bool GetScriptState(UUID itemID);
79 79
80 void SetRunEnable(UUID instanceID, bool enable);
81
82 void SaveAllState(); 80 void SaveAllState();
83 81
84 /// <summary> 82 /// <summary>
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
2143 if (part == null) 2143 if (part == null)
2144 return; 2144 return;
2145 2145
2146 IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
2147
2148 if (running) 2146 if (running)
2149 {
2150 foreach (IScriptModule engine in engines)
2151 {
2152 engine.SetRunEnable(itemID, true);
2153 }
2154 EventManager.TriggerStartScript(part.LocalId, itemID); 2147 EventManager.TriggerStartScript(part.LocalId, itemID);
2155 }
2156 else 2148 else
2157 {
2158 foreach (IScriptModule engine in engines)
2159 {
2160 engine.SetRunEnable(itemID, false);
2161 }
2162 EventManager.TriggerStopScript(part.LocalId, itemID); 2149 EventManager.TriggerStopScript(part.LocalId, itemID);
2163 }
2164 } 2150 }
2165 2151
2166 public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) 2152 public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 3e9583c..de2b192 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3317,24 +3317,30 @@ namespace OpenSim.Region.Framework.Scenes
3317 if (AgentTransactionsModule != null) 3317 if (AgentTransactionsModule != null)
3318 AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); 3318 AgentTransactionsModule.RemoveAgentAssetTransactions(agentID);
3319 3319
3320 avatar.Close();
3321
3322 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); 3320 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
3323 } 3321 }
3324 catch (Exception e) 3322 catch (Exception e)
3325 { 3323 {
3326 m_log.Error( 3324 m_log.Error(
3327 string.Format("[SCENE]: Exception removing {0} from {1}, ", avatar.Name, RegionInfo.RegionName), e); 3325 string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e);
3328 } 3326 }
3329 finally 3327 finally
3330 { 3328 {
3331 // Always clean these structures up so that any failure above doesn't cause them to remain in the 3329 try
3332 // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering 3330 {
3333 // the same cleanup exception continually. 3331 // Always clean these structures up so that any failure above doesn't cause them to remain in the
3334 // TODO: This should probably extend to the whole method, but we don't want to also catch the NRE 3332 // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering
3335 // since this would hide the underlying failure and other associated problems. 3333 // the same cleanup exception continually.
3336 m_sceneGraph.RemoveScenePresence(agentID); 3334 m_sceneGraph.RemoveScenePresence(agentID);
3337 m_clientManager.Remove(agentID); 3335 m_clientManager.Remove(agentID);
3336
3337 avatar.Close();
3338 }
3339 catch (Exception e)
3340 {
3341 m_log.Error(
3342 string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e);
3343 }
3338 } 3344 }
3339 3345
3340 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 3346 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
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
64 bool Running { get; set; } 64 bool Running { get; set; }
65 65
66 /// <summary> 66 /// <summary>
67 /// Gets or sets a value indicating whether this
68 /// <see cref="OpenSim.Region.ScriptEngine.Interfaces.IScriptInstance"/> is run.
69 /// For viewer script editor control
70 /// </summary>
71 /// <value>
72 /// <c>true</c> if run; otherwise, <c>false</c>.
73 /// </value>
74 bool Run { get; set; }
75
76 /// <summary>
77 /// Is the script suspended? 67 /// Is the script suspended?
78 /// </summary> 68 /// </summary>
79 bool Suspended { get; set; } 69 bool Suspended { get; set; }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index f88338d..084bd41 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3973,23 +3973,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3973 if (agentItem == null) 3973 if (agentItem == null)
3974 return; 3974 return;
3975 3975
3976 byte[] bucket = new byte[17]; 3976 if (m_TransferModule != null)
3977 bucket[0] = (byte)item.Type; 3977 {
3978 byte[] objBytes = agentItem.ID.GetBytes(); 3978 byte[] bucket = new byte[] { (byte)item.Type };
3979 Array.Copy(objBytes, 0, bucket, 1, 16);
3980 3979
3981 GridInstantMessage msg = new GridInstantMessage(World, 3980 GridInstantMessage msg = new GridInstantMessage(World,
3982 m_host.UUID, m_host.Name + ", an object owned by " + 3981 m_host.UUID, m_host.Name + ", an object owned by " +
3983 resolveName(m_host.OwnerID) + ",", destId, 3982 resolveName(m_host.OwnerID) + ",", destId,
3984 (byte)InstantMessageDialog.TaskInventoryOffered, 3983 (byte)InstantMessageDialog.TaskInventoryOffered,
3985 false, item.Name + "\n" + m_host.Name + " is located at " + 3984 false, item.Name + "\n" + m_host.Name + " is located at " +
3986 World.RegionInfo.RegionName+" "+ 3985 World.RegionInfo.RegionName+" "+
3987 m_host.AbsolutePosition.ToString(), 3986 m_host.AbsolutePosition.ToString(),
3988 agentItem.ID, true, m_host.AbsolutePosition, 3987 agentItem.ID, true, m_host.AbsolutePosition,
3989 bucket); 3988 bucket);
3990 3989
3991 if (m_TransferModule != null)
3992 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); 3990 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
3991 }
3993 3992
3994 ScriptSleep(3000); 3993 ScriptSleep(3000);
3995 } 3994 }
@@ -6397,23 +6396,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6397 if (folderID == UUID.Zero) 6396 if (folderID == UUID.Zero)
6398 return; 6397 return;
6399 6398
6400 byte[] bucket = new byte[17];
6401 bucket[0] = (byte)AssetType.Folder;
6402 byte[] objBytes = folderID.GetBytes();
6403 Array.Copy(objBytes, 0, bucket, 1, 16);
6404
6405 GridInstantMessage msg = new GridInstantMessage(World,
6406 m_host.UUID, m_host.Name + ", an object owned by " +
6407 resolveName(m_host.OwnerID) + ",", destID,
6408 (byte)InstantMessageDialog.InventoryOffered,
6409 false, category + "\n" + m_host.Name + " is located at " +
6410 World.RegionInfo.RegionName + " " +
6411 m_host.AbsolutePosition.ToString(),
6412 folderID, true, m_host.AbsolutePosition,
6413 bucket);
6414
6415 if (m_TransferModule != null) 6399 if (m_TransferModule != null)
6400 {
6401 byte[] bucket = new byte[] { (byte)AssetType.Folder };
6402
6403 GridInstantMessage msg = new GridInstantMessage(World,
6404 m_host.UUID, m_host.Name + ", an object owned by " +
6405 resolveName(m_host.OwnerID) + ",", destID,
6406 (byte)InstantMessageDialog.TaskInventoryOffered,
6407 false, category + "\n" + m_host.Name + " is located at " +
6408 World.RegionInfo.RegionName + " " +
6409 m_host.AbsolutePosition.ToString(),
6410 folderID, true, m_host.AbsolutePosition,
6411 bucket);
6412
6416 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); 6413 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
6414 }
6417 } 6415 }
6418 6416
6419 public void llSetVehicleType(int type) 6417 public void llSetVehicleType(int type)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 3654106..4137397 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1664,9 +1664,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1664 CheckThreatLevel(ThreatLevel.Low, "osMessageObject"); 1664 CheckThreatLevel(ThreatLevel.Low, "osMessageObject");
1665 m_host.AddScriptLPS(1); 1665 m_host.AddScriptLPS(1);
1666 1666
1667 UUID objUUID;
1668 if (!UUID.TryParse(objectUUID, out objUUID)) // prior to patching, a thrown exception regarding invalid GUID format would be shouted instead.
1669 {
1670 OSSLShoutError("osMessageObject() cannot send messages to objects with invalid UUIDs");
1671 return;
1672 }
1673
1667 object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) }; 1674 object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) };
1668 1675
1669 SceneObjectPart sceneOP = World.GetSceneObjectPart(new UUID(objectUUID)); 1676 SceneObjectPart sceneOP = World.GetSceneObjectPart(objUUID);
1677
1678 if (sceneOP == null) // prior to patching, PostObjectEvent() would cause a throw exception to be shouted instead.
1679 {
1680 OSSLShoutError("osMessageObject() cannot send message to " + objUUID.ToString() + ", object was not found in scene.");
1681 return;
1682 }
1670 1683
1671 m_ScriptEngine.PostObjectEvent( 1684 m_ScriptEngine.PostObjectEvent(
1672 sceneOP.LocalId, new EventParams( 1685 sceneOP.LocalId, new EventParams(
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index f1abd4b..5793cc9 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
121 121
122 public bool Running { get; set; } 122 public bool Running { get; set; }
123 123
124 public bool Run { get; set; }
125
126 public bool Suspended 124 public bool Suspended
127 { 125 {
128 get { return m_Suspended; } 126 get { return m_Suspended; }
@@ -218,7 +216,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
218 m_postOnRez = postOnRez; 216 m_postOnRez = postOnRez;
219 m_AttachedAvatar = part.ParentGroup.AttachedAvatar; 217 m_AttachedAvatar = part.ParentGroup.AttachedAvatar;
220 m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; 218 m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
221 Run = true;
222 219
223 if (part != null) 220 if (part != null)
224 { 221 {
@@ -315,11 +312,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
315 part.SetScriptEvents(ItemID, 312 part.SetScriptEvents(ItemID,
316 (int)m_Script.GetStateEventFlags(State)); 313 (int)m_Script.GetStateEventFlags(State));
317 314
318 Running = false; 315 if (!Running)
319
320 if (ShuttingDown)
321 m_startOnInit = false; 316 m_startOnInit = false;
322 317
318 Running = false;
319
323 // we get new rez events on sim restart, too 320 // we get new rez events on sim restart, too
324 // but if there is state, then we fire the change 321 // but if there is state, then we fire the change
325 // event 322 // event
@@ -355,15 +352,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
355 352
356 public void Init() 353 public void Init()
357 { 354 {
358 if (!m_startOnInit) 355 if (ShuttingDown)
359 return; 356 return;
360 357
361 if (m_startedFromSavedState) 358 if (m_startedFromSavedState)
362 { 359 {
363 if (!Run) 360 if (m_startOnInit)
364 return; 361 Start();
365
366 Start();
367 if (m_postOnRez) 362 if (m_postOnRez)
368 { 363 {
369 PostEvent(new EventParams("on_rez", 364 PostEvent(new EventParams("on_rez",
@@ -395,10 +390,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
395 } 390 }
396 else 391 else
397 { 392 {
398 if (!Run) 393 if (m_startOnInit)
399 return; 394 Start();
400
401 Start();
402 PostEvent(new EventParams("state_entry", 395 PostEvent(new EventParams("state_entry",
403 new Object[0], new DetectParams[0])); 396 new Object[0], new DetectParams[0]));
404 if (m_postOnRez) 397 if (m_postOnRez)
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
55 public static string Serialize(ScriptInstance instance) 55 public static string Serialize(ScriptInstance instance)
56 { 56 {
57 bool running = instance.Running; 57 bool running = instance.Running;
58 bool enabled = instance.Run;
59 58
60 XmlDocument xmldoc = new XmlDocument(); 59 XmlDocument xmldoc = new XmlDocument();
61 60
@@ -78,12 +77,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
78 77
79 rootElement.AppendChild(run); 78 rootElement.AppendChild(run);
80 79
81 XmlElement run_enable = xmldoc.CreateElement("", "Run", "");
82 run_enable.AppendChild(xmldoc.CreateTextNode(
83 enabled.ToString()));
84
85 rootElement.AppendChild(run_enable);
86
87 Dictionary<string, Object> vars = instance.GetVars(); 80 Dictionary<string, Object> vars = instance.GetVars();
88 81
89 XmlElement variables = xmldoc.CreateElement("", "Variables", ""); 82 XmlElement variables = xmldoc.CreateElement("", "Variables", "");
@@ -232,7 +225,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
232 { 225 {
233 object varValue; 226 object varValue;
234 XmlNodeList partL = rootNode.ChildNodes; 227 XmlNodeList partL = rootNode.ChildNodes;
235 instance.Run = true;
236 228
237 foreach (XmlNode part in partL) 229 foreach (XmlNode part in partL)
238 { 230 {
@@ -244,9 +236,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
244 case "Running": 236 case "Running":
245 instance.Running=bool.Parse(part.InnerText); 237 instance.Running=bool.Parse(part.InnerText);
246 break; 238 break;
247 case "Run":
248 instance.Run = bool.Parse(part.InnerText);
249 break;
250 case "Variables": 239 case "Variables":
251 XmlNodeList varL = part.ChildNodes; 240 XmlNodeList varL = part.ChildNodes;
252 foreach (XmlNode var in varL) 241 foreach (XmlNode var in varL)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 20fad05..7a9c80c 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -108,6 +108,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
108 private bool m_KillTimedOutScripts; 108 private bool m_KillTimedOutScripts;
109 private string m_ScriptEnginesPath = null; 109 private string m_ScriptEnginesPath = null;
110 110
111 private ExpiringCache<UUID, bool> m_runFlags = new ExpiringCache<UUID, bool>();
112
111 /// <summary> 113 /// <summary>
112 /// Is the entire simulator in the process of shutting down? 114 /// Is the entire simulator in the process of shutting down?
113 /// </summary> 115 /// </summary>
@@ -1196,6 +1198,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1196 if (instance != null) 1198 if (instance != null)
1197 instance.Init(); 1199 instance.Init();
1198 1200
1201 bool runIt;
1202 if (m_runFlags.TryGetValue(itemID, out runIt))
1203 {
1204 if (!runIt)
1205 StopScript(itemID);
1206 m_runFlags.Remove(itemID);
1207 }
1208
1199 return true; 1209 return true;
1200 } 1210 }
1201 1211
@@ -1541,13 +1551,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1541 } 1551 }
1542 } 1552 }
1543 1553
1544 public void SetRunEnable(UUID instanceID, bool enable)
1545 {
1546 IScriptInstance instance = GetInstance(instanceID);
1547 if (instance != null)
1548 instance.Run = enable;
1549 }
1550
1551 public bool GetScriptState(UUID itemID) 1554 public bool GetScriptState(UUID itemID)
1552 { 1555 {
1553 IScriptInstance instance = GetInstance(itemID); 1556 IScriptInstance instance = GetInstance(itemID);
@@ -1575,6 +1578,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1575 IScriptInstance instance = GetInstance(itemID); 1578 IScriptInstance instance = GetInstance(itemID);
1576 if (instance != null) 1579 if (instance != null)
1577 instance.Start(); 1580 instance.Start();
1581 else
1582 m_runFlags.AddOrUpdate(itemID, true, 240);
1578 } 1583 }
1579 1584
1580 public void StopScript(UUID itemID) 1585 public void StopScript(UUID itemID)
@@ -1586,6 +1591,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1586 // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort. 1591 // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort.
1587 instance.Stop(1000); 1592 instance.Stop(1000);
1588 } 1593 }
1594 else
1595 {
1596 m_runFlags.AddOrUpdate(itemID, false, 240);
1597 }
1589 } 1598 }
1590 1599
1591 public DetectParams GetDetectParams(UUID itemID, int idx) 1600 public DetectParams GetDetectParams(UUID itemID, int idx)
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index faf746f..c11ea02 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -57,7 +57,12 @@ namespace OpenSim.Region.UserStatistics
57 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 57 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58 58
59 private static SqliteConnection dbConn; 59 private static SqliteConnection dbConn;
60
61 /// <summary>
62 /// User statistics sessions keyed by agent ID
63 /// </summary>
60 private Dictionary<UUID, UserSessionID> m_sessions = new Dictionary<UUID, UserSessionID>(); 64 private Dictionary<UUID, UserSessionID> m_sessions = new Dictionary<UUID, UserSessionID>();
65
61 private List<Scene> m_scenes = new List<Scene>(); 66 private List<Scene> m_scenes = new List<Scene>();
62 private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>(); 67 private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>();
63 private Dictionary<UUID, USimStatsData> m_simstatsCounters = new Dictionary<UUID, USimStatsData>(); 68 private Dictionary<UUID, USimStatsData> m_simstatsCounters = new Dictionary<UUID, USimStatsData>();
@@ -308,49 +313,41 @@ namespace OpenSim.Region.UserStatistics
308 scene.EventManager.OnDeregisterCaps += OnDeRegisterCaps; 313 scene.EventManager.OnDeregisterCaps += OnDeRegisterCaps;
309 scene.EventManager.OnClientClosed += OnClientClosed; 314 scene.EventManager.OnClientClosed += OnClientClosed;
310 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; 315 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
311 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
312 } 316 }
313 } 317 }
314 } 318 }
315 319
316 private void OnMakeRootAgent(ScenePresence agent) 320 private void OnMakeRootAgent(ScenePresence agent)
317 { 321 {
318 UUID regionUUID = GetRegionUUIDFromHandle(agent.RegionHandle);
319
320 lock (m_sessions) 322 lock (m_sessions)
321 { 323 {
324 UserSessionID uid;
325
322 if (!m_sessions.ContainsKey(agent.UUID)) 326 if (!m_sessions.ContainsKey(agent.UUID))
323 { 327 {
324 UserSessionData usd = UserSessionUtil.newUserSessionData(); 328 UserSessionData usd = UserSessionUtil.newUserSessionData();
325 329 uid = new UserSessionID();
326 UserSessionID uid = new UserSessionID();
327 uid.name_f = agent.Firstname; 330 uid.name_f = agent.Firstname;
328 uid.name_l = agent.Lastname; 331 uid.name_l = agent.Lastname;
329 uid.region_id = regionUUID;
330 uid.session_id = agent.ControllingClient.SessionId;
331 uid.session_data = usd; 332 uid.session_data = usd;
332 333
333 m_sessions.Add(agent.UUID, uid); 334 m_sessions.Add(agent.UUID, uid);
334 } 335 }
335 else 336 else
336 { 337 {
337 UserSessionID uid = m_sessions[agent.UUID]; 338 uid = m_sessions[agent.UUID];
338 uid.region_id = regionUUID;
339 uid.session_id = agent.ControllingClient.SessionId;
340 m_sessions[agent.UUID] = uid;
341 } 339 }
342 }
343 }
344 340
345 private void OnMakeChildAgent(ScenePresence agent) 341 uid.region_id = agent.Scene.RegionInfo.RegionID;
346 { 342 uid.session_id = agent.ControllingClient.SessionId;
343 }
347 } 344 }
348 345
349 private void OnClientClosed(UUID agentID, Scene scene) 346 private void OnClientClosed(UUID agentID, Scene scene)
350 { 347 {
351 lock (m_sessions) 348 lock (m_sessions)
352 { 349 {
353 if (m_sessions.ContainsKey(agentID)) 350 if (m_sessions.ContainsKey(agentID) && m_sessions[agentID].region_id == scene.RegionInfo.RegionID)
354 { 351 {
355 m_sessions.Remove(agentID); 352 m_sessions.Remove(agentID);
356 } 353 }
@@ -395,20 +392,6 @@ namespace OpenSim.Region.UserStatistics
395 return encoding.GetString(buffer); 392 return encoding.GetString(buffer);
396 } 393 }
397 394
398 private UUID GetRegionUUIDFromHandle(ulong regionhandle)
399 {
400 lock (m_scenes)
401 {
402 foreach (Scene scene in m_scenes)
403 {
404 if (scene.RegionInfo.RegionHandle == regionhandle)
405 return scene.RegionInfo.RegionID;
406 }
407 }
408
409 return UUID.Zero;
410 }
411
412 /// <summary> 395 /// <summary>
413 /// Callback for a viewerstats cap 396 /// Callback for a viewerstats cap
414 /// </summary> 397 /// </summary>