aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2012-07-17 15:00:42 +0200
committerMelanie2012-07-17 15:00:42 +0200
commitc489bc1cd2c81273aaf0e0beb23b3714079ce4be (patch)
tree8dfd7c79ccc3996586036524a85726b6c814e00c
parentRestore update of inventory item on derez/logout. This is necessary to updat... (diff)
downloadopensim-SC_OLD-c489bc1cd2c81273aaf0e0beb23b3714079ce4be.zip
opensim-SC_OLD-c489bc1cd2c81273aaf0e0beb23b3714079ce4be.tar.gz
opensim-SC_OLD-c489bc1cd2c81273aaf0e0beb23b3714079ce4be.tar.bz2
opensim-SC_OLD-c489bc1cd2c81273aaf0e0beb23b3714079ce4be.tar.xz
Make the scrpt running flag work properly
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs16
2 files changed, 24 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index d570ef7..5793cc9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -312,11 +312,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
312 part.SetScriptEvents(ItemID, 312 part.SetScriptEvents(ItemID,
313 (int)m_Script.GetStateEventFlags(State)); 313 (int)m_Script.GetStateEventFlags(State));
314 314
315 Running = false; 315 if (!Running)
316
317 if (ShuttingDown)
318 m_startOnInit = false; 316 m_startOnInit = false;
319 317
318 Running = false;
319
320 // we get new rez events on sim restart, too 320 // we get new rez events on sim restart, too
321 // but if there is state, then we fire the change 321 // but if there is state, then we fire the change
322 // event 322 // event
@@ -352,12 +352,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
352 352
353 public void Init() 353 public void Init()
354 { 354 {
355 if (!m_startOnInit) 355 if (ShuttingDown)
356 return; 356 return;
357 357
358 if (m_startedFromSavedState) 358 if (m_startedFromSavedState)
359 { 359 {
360 Start(); 360 if (m_startOnInit)
361 Start();
361 if (m_postOnRez) 362 if (m_postOnRez)
362 { 363 {
363 PostEvent(new EventParams("on_rez", 364 PostEvent(new EventParams("on_rez",
@@ -389,7 +390,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
389 } 390 }
390 else 391 else
391 { 392 {
392 Start(); 393 if (m_startOnInit)
394 Start();
393 PostEvent(new EventParams("state_entry", 395 PostEvent(new EventParams("state_entry",
394 new Object[0], new DetectParams[0])); 396 new Object[0], new DetectParams[0]));
395 if (m_postOnRez) 397 if (m_postOnRez)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 01aebb6..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
@@ -1568,6 +1578,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1568 IScriptInstance instance = GetInstance(itemID); 1578 IScriptInstance instance = GetInstance(itemID);
1569 if (instance != null) 1579 if (instance != null)
1570 instance.Start(); 1580 instance.Start();
1581 else
1582 m_runFlags.AddOrUpdate(itemID, true, 240);
1571 } 1583 }
1572 1584
1573 public void StopScript(UUID itemID) 1585 public void StopScript(UUID itemID)
@@ -1579,6 +1591,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1579 // 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.
1580 instance.Stop(1000); 1592 instance.Stop(1000);
1581 } 1593 }
1594 else
1595 {
1596 m_runFlags.AddOrUpdate(itemID, false, 240);
1597 }
1582 } 1598 }
1583 1599
1584 public DetectParams GetDetectParams(UUID itemID, int idx) 1600 public DetectParams GetDetectParams(UUID itemID, int idx)