Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
	OpenSim/Region/Framework/Scenes/Scene.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
	OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
avinationmerge
Melanie 2012-07-19 09:47:51 +01:00
commit 36d744e2a5
18 changed files with 252 additions and 174 deletions

View File

@ -66,6 +66,11 @@ namespace OpenSim.Framework
IConfigSource Config { get; }
/// <summary>
/// Are logins enabled on this simulator?
/// </summary>
bool LoginsEnabled { get; set; }
float TimeDilation { get; }
bool AllowScriptCrossings { get; }

View File

@ -636,10 +636,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
m_scene.InventoryService.UpdateItem(item);
// this gets called when the agent logs off!
// If the name of the object has been changed whilst attached then we want to update the inventory
// item in the viewer.
if (sp.ControllingClient != null)
sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
}
grp.HasGroupChanged = false; // Prevent it being saved over and over
}
// else

View File

@ -143,11 +143,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
// m_log.DebugFormat(
// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
// toAgentID.ToString(), scene.RegionInfo.RegionName);
ScenePresence sp = scene.GetScenePresence(toAgentID);
if (sp != null && !sp.IsChildAgent)
{
// Local message
// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID);
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", sp.Name, toAgentID);
sp.ControllingClient.SendInstantMessage(im);
// Message sent
@ -159,13 +161,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
// try child avatar second
foreach (Scene scene in m_Scenes)
{
// m_log.DebugFormat(
// "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName);
m_log.DebugFormat(
"[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName);
ScenePresence sp = scene.GetScenePresence(toAgentID);
if (sp != null)
{
// Local message
// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID);
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", sp.Name, toAgentID);
sp.ControllingClient.SendInstantMessage(im);
// Message sent
@ -174,10 +178,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
}
}
// m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
SendGridInstantMessageViaXMLRPC(im, result);
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
return;
SendGridInstantMessageViaXMLRPC(im, result);
}
private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result)

View File

@ -313,8 +313,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
m_TransferModule.SendInstantMessage(im, delegate(bool success) {});
}
}
else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined ||
im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined)
else if (
im.dialog == (byte)InstantMessageDialog.InventoryDeclined
|| im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined)
{
// Here, the recipient is local and we can assume that the
// inventory is loaded. Courtesy of the above bulk update,

View File

@ -149,10 +149,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
lock (m_scenes)
m_scenes[scene.RegionInfo.RegionID] = scene;
scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
scene.EventManager.OnRegionReady += s => UploadMapTile(s);
}
///<summary>
///
///</summary>
@ -167,20 +166,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
#endregion ISharedRegionModule
void OnLoginsEnabled(string regionName)
{
Scene scene = null;
foreach (Scene s in m_scenes.Values)
if (s.RegionInfo.RegionName == regionName)
{
scene = s;
break;
}
if (scene != null)
UploadMapTile(scene);
}
///<summary>
///
///</summary>

View File

@ -129,18 +129,18 @@ namespace OpenSim.Region.CoreModules.World
switch (cmd[1])
{
case "enable":
scene.LoginsDisabled = false;
scene.LoginsEnabled = true;
MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName));
break;
case "disable":
scene.LoginsDisabled = true;
scene.LoginsEnabled = false;
MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName));
break;
case "status":
if (scene.LoginsDisabled)
MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName));
else
if (scene.LoginsEnabled)
MainConsole.Instance.Output(String.Format("Login in {0} are enabled", scene.RegionInfo.RegionName));
else
MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName));
break;
default:
MainConsole.Instance.Output("Syntax: login enable|disable|status");

View File

@ -25,14 +25,23 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using OpenSim.Framework;
namespace OpenSim.Region.Framework.Interfaces
{
public interface IRegionReadyModule
{
void OarLoadingAlert(string msg);
/// <summary>
/// Trigger region ready status manually.
/// </summary>
/// <remarks>
/// This should be called by the scene if the IRegionReadyModule has set Scene.LoginLock == true
/// </remarks>
/// <param name='scene'></param>
void TriggerRegionReady(IScene scene);
}
}

View File

@ -500,15 +500,25 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void RegionHeartbeatEnd(Scene scene);
public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
public delegate void LoginsEnabled(string regionName);
/// <summary>
/// This should only fire in all circumstances if the RegionReady module is active.
/// Fired when logins to a region are enabled or disabled.
/// </summary>
/// <remarks>
/// TODO: Fire this even when the RegionReady module is not active.
///
/// </remarks>
public event LoginsEnabled OnLoginsEnabled;
/// Fired
public event RegionLoginsStatusChange OnRegionLoginsStatusChange;
public delegate void RegionLoginsStatusChange(IScene scene);
/// <summary>
/// Fired when a region is considered ready for use.
/// </summary>
/// <remarks>
/// A region is considered ready when startup operations such as loading of scripts already on the region
/// have been completed.
/// </remarks>
public event RegionReady OnRegionReady;
public delegate void RegionReady(IScene scene);
public delegate void PrimsLoaded(Scene s);
public event PrimsLoaded OnPrimsLoaded;
@ -2502,21 +2512,42 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void TriggerLoginsEnabled (string regionName)
public void TriggerRegionLoginsStatusChange(IScene scene)
{
LoginsEnabled handler = OnLoginsEnabled;
RegionLoginsStatusChange handler = OnRegionLoginsStatusChange;
if (handler != null)
{
foreach (LoginsEnabled d in handler.GetInvocationList())
foreach (RegionLoginsStatusChange d in handler.GetInvocationList())
{
try
{
d(regionName);
d(scene);
}
catch (Exception e)
{
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for LoginsEnabled failed - continuing {0} - {1}",
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionLoginsStatusChange failed - continuing {0} - {1}",
e.Message, e.StackTrace);
}
}
}
}
public void TriggerRegionReady(IScene scene)
{
RegionReady handler = OnRegionReady;
if (handler != null)
{
foreach (RegionReady d in handler.GetInvocationList())
{
try
{
d(scene);
}
catch (Exception e)
{
m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReady failed - continuing {0} - {1}",
e.Message, e.StackTrace);
}
}

View File

@ -129,9 +129,10 @@ namespace OpenSim.Region.Framework.Scenes
public bool m_strictAccessControl = true;
public bool m_seeIntoBannedRegion = false;
public int MaxUndoCount = 5;
// Using this for RegionReady module to prevent LoginsDisabled from changing under our feet;
public bool LoginLock = false;
public bool LoginsDisabled = true;
public bool StartDisabled = false;
public bool LoadingPrims;
public IXfer XferManager;
@ -727,6 +728,8 @@ namespace OpenSim.Region.Framework.Scenes
{
IConfig startupConfig = m_config.Configs["Startup"];
StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup);
if (!m_useBackup)
@ -1530,7 +1533,7 @@ namespace OpenSim.Region.Framework.Scenes
// landMS = Util.EnvironmentTickCountSubtract(ldMS);
//}
if (LoginsDisabled && Frame == 20)
if (!LoginsEnabled && Frame == 20)
{
// m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock);
@ -1539,30 +1542,33 @@ namespace OpenSim.Region.Framework.Scenes
// allocations, and there is no more work to be done until someone logs in
GC.Collect();
IConfig startupConfig = m_config.Configs["Startup"];
if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
if (!LoginLock)
{
if (!StartDisabled)
{
m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
LoginsEnabled = true;
}
m_sceneGridService.InformNeighborsThatRegionisUp(
RequestModuleInterface<INeighbourService>(), RegionInfo);
// Region ready should always be triggered whether logins are immediately enabled or not.
EventManager.TriggerRegionReady(this);
}
else
{
// This handles a case of a region having no scripts for the RegionReady module
if (m_sceneGraph.GetActiveScriptsCount() == 0)
{
// need to be able to tell these have changed in RegionReady
LoginLock = false;
EventManager.TriggerLoginsEnabled(RegionInfo.RegionName);
}
// In this case, we leave it to the IRegionReadyModule to enable logins
// For RegionReady lockouts
if (!LoginLock)
{
m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
LoginsDisabled = false;
// LoginLock can currently only be set by a region module implementation.
// If somehow this hasn't been done then the quickest way to bugfix is to see the
// NullReferenceException
IRegionReadyModule rrm = RequestModuleInterface<IRegionReadyModule>();
rrm.TriggerRegionReady(this);
}
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
}
else
{
StartDisabled = true;
LoginsDisabled = true;
}
}
}
@ -3487,25 +3493,31 @@ namespace OpenSim.Region.Framework.Scenes
if (AgentTransactionsModule != null)
AgentTransactionsModule.RemoveAgentAssetTransactions(agentID);
avatar.Close();
m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
m_log.Debug("[Scene] The avatar has left the building");
}
catch (Exception e)
{
m_log.Error(
string.Format("[SCENE]: Exception removing {0} from {1}, ", avatar.Name, RegionInfo.RegionName), e);
string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e);
}
finally
{
try
{
// Always clean these structures up so that any failure above doesn't cause them to remain in the
// scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering
// the same cleanup exception continually.
// TODO: This should probably extend to the whole method, but we don't want to also catch the NRE
// since this would hide the underlying failure and other associated problems.
m_sceneGraph.RemoveScenePresence(agentID);
m_clientManager.Remove(agentID);
avatar.Close();
}
catch (Exception e)
{
m_log.Error(
string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e);
}
}
//m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
@ -3619,7 +3631,7 @@ namespace OpenSim.Region.Framework.Scenes
agent.startpos
);
if (LoginsDisabled)
if (!LoginsEnabled)
{
reason = "Logins Disabled";
return false;

View File

@ -106,6 +106,24 @@ namespace OpenSim.Region.Framework.Scenes
protected readonly ClientManager m_clientManager = new ClientManager();
public bool LoginsEnabled
{
get
{
return m_loginsEnabled;
}
set
{
if (m_loginsEnabled != value)
{
m_loginsEnabled = value;
EventManager.TriggerRegionLoginsStatusChange(this);
}
}
}
private bool m_loginsEnabled;
public float TimeDilation
{
get { return 1.0f; }

View File

@ -100,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.WarnFormat(
"[SCENE COMMUNICATION SERVICE]: Region {0} failed to inform neighbour at {1}-{2} that it is up.",
x / Constants.RegionSize, y / Constants.RegionSize);
m_scene.Name, x / Constants.RegionSize, y / Constants.RegionSize);
}
}

View File

@ -1991,7 +1991,7 @@ namespace OpenSim.Region.Framework.Scenes
try
{
if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart
m_scene.LoginsDisabled || // We're starting up or doing maintenance, don't mess with things
!m_scene.LoginsEnabled || // We're starting up or doing maintenance, don't mess with things
m_scene.LoadingPrims) // Land may not be valid yet
{

View File

@ -301,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
sp.AbsolutePosition = preTeleportPosition;
// Make sceneB refuse CreateAgent
sceneB.LoginsDisabled = true;
sceneB.LoginsEnabled = false;
sceneA.RequestTeleportLocation(
sp.ControllingClient,

View File

@ -31,16 +31,14 @@ using System.Reflection;
using System.Net;
using System.IO;
using System.Text;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Services.Interfaces;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
{
@ -56,10 +54,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
private bool m_lastOarLoadedOk;
private int m_channelNotify = -1000;
private bool m_enabled = false;
private bool m_disable_logins = false;
private bool m_disable_logins;
private string m_uri = string.Empty;
Scene m_scene = null;
Scene m_scene;
#region INonSharedRegionModule interface
@ -99,16 +97,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_lastOarLoadedOk = true;
m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
m_scene.EventManager.OnRezScript += OnRezScript;
m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName);
if (m_disable_logins == true)
if (m_disable_logins)
{
scene.LoginLock = true;
scene.LoginsDisabled = true;
m_log.InfoFormat("[RegionReady]: Region {0} - logins disabled during initialization.",m_scene.RegionInfo.RegionName);
m_scene.LoginLock = true;
m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
m_log.InfoFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name);
if (m_uri != string.Empty)
{
@ -117,29 +114,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
}
}
void OnRezScript (uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
{
if (!m_ScriptRez)
{
m_ScriptRez = true;
m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
m_scene.EventManager.OnRezScript -= OnRezScript;
}
}
public void RemoveRegion(Scene scene)
{
if (!m_enabled)
return;
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded;
m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled;
if (m_disable_logins)
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
if (m_uri != string.Empty)
{
RRAlert("shutdown");
}
m_scene = null;
}
@ -159,7 +145,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
#endregion
void OnEmptyScriptCompileQueue(int numScriptsFailed, string message)
{
m_log.DebugFormat("[RegionReady]: Script compile queue empty!");
@ -193,75 +178,80 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.RegionInfo.RegionName, c.Message, m_channelNotify);
m_scene.EventManager.TriggerOnChatBroadcast(this, c);
m_scene.EventManager.TriggerLoginsEnabled(m_scene.RegionInfo.RegionName);
m_scene.SceneGridService.InformNeighborsThatRegionisUp(m_scene.RequestModuleInterface<INeighbourService>(), m_scene.RegionInfo);
TriggerRegionReady(m_scene);
}
}
void OnOarFileLoaded(Guid requestId, string message)
{
m_oarFileLoading = true;
if (message==String.Empty)
{
m_lastOarLoadedOk = true;
} else {
}
else
{
m_log.WarnFormat("[RegionReady]: Oar file load errors: {0}", message);
m_lastOarLoadedOk = false;
}
}
// This will be triggerd by Scene if we have no scripts
// m_ScriptsRezzing will be false if there were none
// else it will be true and we should wait on the
// empty compile queue
void OnLoginsEnabled(string regionName)
/// <summary>
/// This will be triggered by Scene directly if it contains no scripts on startup. Otherwise it is triggered
/// when the script compile queue is empty after initial region startup.
/// </summary>
/// <param name='scene'></param>
public void TriggerRegionReady(IScene scene)
{
if (m_disable_logins == true)
{
if (m_scene.StartDisabled == false)
{
m_scene.LoginsDisabled = false;
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
m_scene.LoginLock = false;
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
if (!m_scene.StartDisabled)
{
m_scene.LoginsEnabled = true;
// m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
// m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
m_log.InfoFormat(
"[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name);
}
m_scene.SceneGridService.InformNeighborsThatRegionisUp(
m_scene.RequestModuleInterface<INeighbourService>(), m_scene.RegionInfo);
if (m_uri != string.Empty)
{
RRAlert("enabled");
}
}
}
m_scene.EventManager.TriggerRegionReady(m_scene);
}
public void OarLoadingAlert(string msg)
{
// Let's bypass this for now until some better feedback can be established
//
return;
if (msg == "load")
{
m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
m_scene.EventManager.OnRezScript += OnRezScript;
m_oarFileLoading = true;
m_firstEmptyCompileQueue = true;
m_scene.LoginsDisabled = true;
m_scene.LoginLock = true;
if ( m_uri != string.Empty )
{
RRAlert("loading oar");
RRAlert("disabled");
}
}
// if (msg == "load")
// {
// m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
// m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded;
// m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
// m_scene.EventManager.OnRezScript += OnRezScript;
// m_oarFileLoading = true;
// m_firstEmptyCompileQueue = true;
//
// m_scene.LoginsDisabled = true;
// m_scene.LoginLock = true;
// if ( m_uri != string.Empty )
// {
// RRAlert("loading oar");
// RRAlert("disabled");
// }
// }
}
public void RRAlert(string status)

View File

@ -6887,23 +6887,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (folderID == UUID.Zero)
return;
byte[] bucket = new byte[1];
bucket[0] = (byte)AssetType.Folder;
//byte[] objBytes = folderID.GetBytes();
//Array.Copy(objBytes, 0, bucket, 1, 16);
if (m_TransferModule != null)
{
byte[] bucket = new byte[] { (byte)AssetType.Folder };
GridInstantMessage msg = new GridInstantMessage(World,
m_host.OwnerID, m_host.Name, destID,
m_host.UUID, m_host.Name + ", an object owned by " +
resolveName(m_host.OwnerID) + ",", destID,
(byte)InstantMessageDialog.TaskInventoryOffered,
false, category+". "+m_host.Name+" is located at "+
false, category + "\n" + m_host.Name + " is located at " +
World.RegionInfo.RegionName + " " +
m_host.AbsolutePosition.ToString(),
folderID, true, m_host.AbsolutePosition,
bucket);
if (m_TransferModule != null)
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
}
}
public void llSetVehicleType(int type)
{

View File

@ -312,11 +312,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
part.SetScriptEvents(ItemID,
(int)m_Script.GetStateEventFlags(State));
Running = false;
if (ShuttingDown)
if (!Running)
m_startOnInit = false;
Running = false;
// we get new rez events on sim restart, too
// but if there is state, then we fire the change
// event
@ -352,11 +352,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public void Init()
{
if (!m_startOnInit)
if (ShuttingDown)
return;
if (m_startedFromSavedState)
{
if (m_startOnInit)
Start();
if (m_postOnRez)
{
@ -389,6 +390,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
else
{
if (m_startOnInit)
Start();
PostEvent(new EventParams("state_entry",
new Object[0], new DetectParams[0]));

View File

@ -109,6 +109,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private bool m_KillTimedOutScripts;
private string m_ScriptEnginesPath = null;
private ExpiringCache<UUID, bool> m_runFlags = new ExpiringCache<UUID, bool>();
/// <summary>
/// Is the entire simulator in the process of shutting down?
/// </summary>
@ -715,6 +717,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
m_Scene.EventManager.OnGetScriptRunning += OnGetScriptRunning;
m_Scene.EventManager.OnShutdown += OnShutdown;
// If region ready has been triggered, then the region had no scripts to compile and completed its other
// work.
m_Scene.EventManager.OnRegionReady += s => m_InitialStartup = false;
if (m_SleepTime > 0)
{
m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoMaintenance),
@ -1270,6 +1276,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (instance!=null)
instance.Init();
bool runIt;
if (m_runFlags.TryGetValue(itemID, out runIt))
{
if (!runIt)
StopScript(itemID);
m_runFlags.Remove(itemID);
}
return true;
}
@ -1660,6 +1674,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
IScriptInstance instance = GetInstance(itemID);
if (instance != null)
instance.Start();
else
m_runFlags.AddOrUpdate(itemID, true, 240);
}
public void StopScript(UUID itemID)
@ -1671,6 +1687,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort.
instance.Stop(1000);
}
else
{
m_runFlags.AddOrUpdate(itemID, false, 240);
}
}
public DetectParams GetDetectParams(UUID itemID, int idx)

View File

@ -190,7 +190,7 @@ namespace OpenSim.Tests.Common
= physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");
testScene.RegionInfo.EstateSettings = new EstateSettings();
testScene.LoginsDisabled = false;
testScene.LoginsEnabled = true;
testScene.RegisterRegionWithGrid();
SceneManager.Add(testScene);