aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-10-19 20:53:24 +0100
committerJustin Clark-Casey (justincc)2011-10-19 20:53:24 +0100
commit3cf7fb4eca2ad57835311e8098868f2571709392 (patch)
tree383c0ce40cbd6c2635e8c74c105a9b4a94e4217a /OpenSim/Region/ScriptEngine
parenton log and "show scripts" messages, show script item UUID rather than asset UUID (diff)
downloadopensim-SC-3cf7fb4eca2ad57835311e8098868f2571709392.zip
opensim-SC-3cf7fb4eca2ad57835311e8098868f2571709392.tar.gz
opensim-SC-3cf7fb4eca2ad57835311e8098868f2571709392.tar.bz2
opensim-SC-3cf7fb4eca2ad57835311e8098868f2571709392.tar.xz
Add "scripts suspend" and "scripts resume" commands.
These aim currently to suspend and resume all scripts. However, resume isn't currently working due to what looks like a bug in resume functionality itself.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs50
2 files changed, 53 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 9d48e94..893f3ef 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
55{ 55{
56 public class ScriptInstance : MarshalByRefObject, IScriptInstance 56 public class ScriptInstance : MarshalByRefObject, IScriptInstance
57 { 57 {
58 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 58// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59 59
60 private IScriptEngine m_Engine; 60 private IScriptEngine m_Engine;
61 private IScriptWorkItem m_CurrentResult = null; 61 private IScriptWorkItem m_CurrentResult = null;
@@ -645,6 +645,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
645 /// <returns></returns> 645 /// <returns></returns>
646 public object EventProcessor() 646 public object EventProcessor()
647 { 647 {
648// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName);
649
648 if (Suspended) 650 if (Suspended)
649 return 0; 651 return 0;
650 652
@@ -679,7 +681,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
679 m_CollisionInQueue = false; 681 m_CollisionInQueue = false;
680 } 682 }
681 683
682 //m_log.DebugFormat("[XEngine]: Processing event {0} for {1}", data.EventName, this); 684// m_log.DebugFormat("[XEngine]: Processing event {0} for {1}", data.EventName, this);
683 685
684 m_DetectParams = data.DetectParams; 686 m_DetectParams = data.DetectParams;
685 687
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 304848e..bb08d90 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -274,6 +274,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
274 MainConsole.Instance.Commands.AddCommand( 274 MainConsole.Instance.Commands.AddCommand(
275 "scripts", false, "show scripts", "show scripts", "Show script information", 275 "scripts", false, "show scripts", "show scripts", "Show script information",
276 "Synonym for scripts show command", HandleShowScripts); 276 "Synonym for scripts show command", HandleShowScripts);
277
278 MainConsole.Instance.Commands.AddCommand(
279 "scripts", false, "scripts suspend", "scripts suspend", "Suspend all scripts",
280 "Suspends all currently running scripts. This only suspends event delivery, it will not suspend a"
281 + " script that is currently processing an event.",
282 HandleSuspendScripts);
283
284 MainConsole.Instance.Commands.AddCommand(
285 "scripts", false, "scripts resume", "scripts resume", "Resume all scripts",
286 "Resumes all currently suspended scripts", HandleResumeScripts);
277 } 287 }
278 288
279 public void HandleShowScripts(string module, string[] cmdparams) 289 public void HandleShowScripts(string module, string[] cmdparams)
@@ -313,6 +323,44 @@ namespace OpenSim.Region.ScriptEngine.XEngine
313 } 323 }
314 } 324 }
315 325
326 public void HandleSuspendScripts(string module, string[] cmdparams)
327 {
328 lock (m_Scripts)
329 {
330 foreach (IScriptInstance instance in m_Scripts.Values)
331 {
332 if (!instance.Suspended)
333 {
334 instance.Suspend();
335
336 SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID);
337 MainConsole.Instance.OutputFormat(
338 "Suspended {0}.{1}, item UUID {2}, prim UUID {3} @ {4}",
339 instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, sop.AbsolutePosition);
340 }
341 }
342 }
343 }
344
345 public void HandleResumeScripts(string module, string[] cmdparams)
346 {
347 lock (m_Scripts)
348 {
349 foreach (IScriptInstance instance in m_Scripts.Values)
350 {
351 if (instance.Suspended)
352 {
353 instance.Resume();
354
355 SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID);
356 MainConsole.Instance.OutputFormat(
357 "Resumed {0}.{1}, item UUID {2}, prim UUID {3} @ {4}",
358 instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, sop.AbsolutePosition);
359 }
360 }
361 }
362 }
363
316 public void RemoveRegion(Scene scene) 364 public void RemoveRegion(Scene scene)
317 { 365 {
318 if (!m_Enabled) 366 if (!m_Enabled)
@@ -841,7 +889,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
841 889
842 m_log.DebugFormat( 890 m_log.DebugFormat(
843 "[XEngine] Loaded script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}", 891 "[XEngine] Loaded script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}",
844 part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID, 892 part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID,
845 part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName); 893 part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
846 894
847 if (presence != null) 895 if (presence != null)