OSSL: stop reading configuration file on every script start.
parent
c7714d6320
commit
2abf375351
|
@ -28,6 +28,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.Remoting.Lifetime;
|
using System.Runtime.Remoting.Lifetime;
|
||||||
|
@ -142,39 +143,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi
|
public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi
|
||||||
{
|
{
|
||||||
|
public const string GridInfoServiceConfigSectionName = "GridInfoService";
|
||||||
|
|
||||||
|
// shared things
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public const string GridInfoServiceConfigSectionName = "GridInfoService";
|
private static object m_OSSLLock = new object();
|
||||||
|
private static bool m_doneSharedInit = false;
|
||||||
|
internal static bool m_OSFunctionsEnabled = false;
|
||||||
|
internal static TimeZoneInfo PSTTimeZone = null;
|
||||||
|
internal static bool m_PermissionErrortoOwner = false;
|
||||||
|
internal static ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow;
|
||||||
|
internal static float m_ScriptDelayFactor = 1.0f;
|
||||||
|
internal static float m_ScriptDistanceFactor = 1.0f;
|
||||||
|
internal static IConfig m_osslconfig;
|
||||||
|
|
||||||
|
internal static ConcurrentDictionary<string, FunctionPerms> m_FunctionPerms = new ConcurrentDictionary<string, FunctionPerms>();
|
||||||
|
|
||||||
internal IScriptEngine m_ScriptEngine;
|
internal IScriptEngine m_ScriptEngine;
|
||||||
internal LSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there
|
internal LSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there
|
||||||
internal SceneObjectPart m_host;
|
internal SceneObjectPart m_host;
|
||||||
internal TaskInventoryItem m_item;
|
internal TaskInventoryItem m_item;
|
||||||
internal bool m_OSFunctionsEnabled = false;
|
|
||||||
internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow;
|
|
||||||
internal float m_ScriptDelayFactor = 1.0f;
|
|
||||||
internal float m_ScriptDistanceFactor = 1.0f;
|
|
||||||
internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >();
|
|
||||||
protected IUrlModule m_UrlModule = null;
|
protected IUrlModule m_UrlModule = null;
|
||||||
protected ISoundModule m_SoundModule = null;
|
protected ISoundModule m_SoundModule = null;
|
||||||
internal IConfig m_osslconfig;
|
|
||||||
internal TimeZoneInfo PSTTimeZone = null;
|
|
||||||
internal bool m_PermissionErrortoOwner = false;
|
|
||||||
|
|
||||||
public void Initialize(
|
public void Initialize(IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
|
||||||
IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
|
|
||||||
{
|
{
|
||||||
|
//private init
|
||||||
m_ScriptEngine = scriptEngine;
|
m_ScriptEngine = scriptEngine;
|
||||||
m_host = host;
|
m_host = host;
|
||||||
m_item = item;
|
m_item = item;
|
||||||
|
|
||||||
|
m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
|
||||||
|
m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>();
|
||||||
|
|
||||||
|
//private init
|
||||||
|
lock (m_OSSLLock)
|
||||||
|
{
|
||||||
|
if(m_doneSharedInit)
|
||||||
|
return;
|
||||||
|
|
||||||
m_osslconfig = m_ScriptEngine.ConfigSource.Configs["OSSL"];
|
m_osslconfig = m_ScriptEngine.ConfigSource.Configs["OSSL"];
|
||||||
if(m_osslconfig == null)
|
if(m_osslconfig == null)
|
||||||
m_osslconfig = m_ScriptEngine.Config;
|
m_osslconfig = m_ScriptEngine.Config;
|
||||||
|
|
||||||
m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
|
|
||||||
m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>();
|
|
||||||
|
|
||||||
if (m_osslconfig.GetBoolean("AllowOSFunctions", false))
|
if (m_osslconfig.GetBoolean("AllowOSFunctions", false))
|
||||||
{
|
{
|
||||||
m_OSFunctionsEnabled = true;
|
m_OSFunctionsEnabled = true;
|
||||||
|
@ -236,6 +248,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
PSTTimeZone = null;
|
PSTTimeZone = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_doneSharedInit = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Object InitializeLifetimeService()
|
public override Object InitializeLifetimeService()
|
||||||
|
|
Loading…
Reference in New Issue