aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
diff options
context:
space:
mode:
authorDr Scofield2009-01-28 09:22:12 +0000
committerDr Scofield2009-01-28 09:22:12 +0000
commita3ac702941bbae92ca5a3ed452eb3d417bf30f0b (patch)
tree3a827866b274b86447cc7b2237a7182d95270879 /OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
parentAdd in a stub for llSHA1String. I believe it is the only one new (diff)
downloadopensim-SC_OLD-a3ac702941bbae92ca5a3ed452eb3d417bf30f0b.zip
opensim-SC_OLD-a3ac702941bbae92ca5a3ed452eb3d417bf30f0b.tar.gz
opensim-SC_OLD-a3ac702941bbae92ca5a3ed452eb3d417bf30f0b.tar.bz2
opensim-SC_OLD-a3ac702941bbae92ca5a3ed452eb3d417bf30f0b.tar.xz
From: Christopher Yeoh <yeohc@au1.ibm.com>
Adding Oarfileloaded and EmptyScriptCompileQueue event support which allows (with a module) for programmatic notification of when a region objects and scripts are up and running after a server start or load-oar.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 30ce79b..fc76d0b 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -71,6 +71,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
71 private ThreadPriority m_Prio; 71 private ThreadPriority m_Prio;
72 private bool m_Enabled = false; 72 private bool m_Enabled = false;
73 private bool m_InitialStartup = true; 73 private bool m_InitialStartup = true;
74 private int m_ScriptFailCount; // Number of script fails since compile queue was last empty
75 private string m_ScriptErrorMessage;
74 76
75// disable warning: need to keep a reference to XEngine.EventManager 77// disable warning: need to keep a reference to XEngine.EventManager
76// alive to avoid it being garbage collected 78// alive to avoid it being garbage collected
@@ -149,6 +151,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
149 public void Initialise(Scene scene, IConfigSource configSource) 151 public void Initialise(Scene scene, IConfigSource configSource)
150 { 152 {
151 m_ScriptConfig = configSource.Configs["XEngine"]; 153 m_ScriptConfig = configSource.Configs["XEngine"];
154 m_ScriptFailCount = 0;
155 m_ScriptErrorMessage = String.Empty;
152 156
153 if (m_ScriptConfig == null) 157 if (m_ScriptConfig == null)
154 { 158 {
@@ -417,6 +421,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
417 { 421 {
418 m_InitialStartup = false; 422 m_InitialStartup = false;
419 System.Threading.Thread.Sleep(15000); 423 System.Threading.Thread.Sleep(15000);
424 lock (m_CompileQueue)
425 {
426 if (m_CompileQueue.Count==0)
427 // No scripts on region, so won't get triggered later
428 // by the queue becoming empty so we trigger it here
429 m_Scene.EventManager.TriggerEmptyScriptCompileQueue(0, String.Empty);
430 }
420 } 431 }
421 432
422 Object o; 433 Object o;
@@ -443,6 +454,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
443 else 454 else
444 { 455 {
445 m_CurrentCompile = null; 456 m_CurrentCompile = null;
457 m_Scene.EventManager.TriggerEmptyScriptCompileQueue(m_ScriptFailCount,
458 m_ScriptErrorMessage);
459 m_ScriptFailCount = 0;
446 } 460 }
447 } 461 }
448 return null; 462 return null;
@@ -468,12 +482,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
468 if (part == null) 482 if (part == null)
469 { 483 {
470 Log.Error("[Script] SceneObjectPart unavailable. Script NOT started."); 484 Log.Error("[Script] SceneObjectPart unavailable. Script NOT started.");
485 m_ScriptErrorMessage += "SceneObjectPart unavailable. Script NOT started.\n";
486 m_ScriptFailCount++;
471 return false; 487 return false;
472 } 488 }
473 489
474 TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID); 490 TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID);
475 if (item == null) 491 if (item == null)
492 {
493 m_ScriptErrorMessage += "Can't find script inventory item.\n";
494 m_ScriptFailCount++;
476 return false; 495 return false;
496 }
477 497
478 UUID assetID = item.AssetID; 498 UUID assetID = item.AssetID;
479 499
@@ -499,6 +519,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
499 try 519 try
500 { 520 {
501 // DISPLAY ERROR INWORLD 521 // DISPLAY ERROR INWORLD
522 m_ScriptErrorMessage += "Failed to compile: " + e.Message.ToString();
523 m_ScriptFailCount++;
502 string text = "Error compiling script:\n" + e.Message.ToString(); 524 string text = "Error compiling script:\n" + e.Message.ToString();
503 if (text.Length > 1000) 525 if (text.Length > 1000)
504 text = text.Substring(0, 1000); 526 text = text.Substring(0, 1000);
@@ -567,6 +589,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
567 catch (Exception e) 589 catch (Exception e)
568 { 590 {
569 m_log.ErrorFormat("[XEngine] Exception creating app domain:\n {0}", e.ToString()); 591 m_log.ErrorFormat("[XEngine] Exception creating app domain:\n {0}", e.ToString());
592 m_ScriptErrorMessage += "Exception creating app domain:\n";
593 m_ScriptFailCount++;
570 return false; 594 return false;
571 } 595 }
572 } 596 }