diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index a9432c2df3..2c38e0f6a1 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -66,6 +66,11 @@ namespace OpenSim.Framework IConfigSource Config { get; } + /// + /// Are logins enabled on this simulator? + /// + bool LoginsEnabled { get; set; } + float TimeDilation { get; } bool AllowScriptCrossings { get; } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 0dad3c4147..596174b3cd 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -137,13 +137,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage foreach (Scene scene in m_Scenes) { // m_log.DebugFormat( -// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", +// "[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 @@ -155,13 +157,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 @@ -170,10 +174,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) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 19c774f7c6..f3af59ab2a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -297,7 +297,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer }); } } - else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) + 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, diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs index 322a9f8c86..56418043e4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs @@ -146,10 +146,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); } - /// /// /// @@ -163,21 +162,7 @@ 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); - } - - + /// /// /// diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs index 553a32d3bd..e7b14547f4 100644 --- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs @@ -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"); diff --git a/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs index aa4a757420..136ca9261b 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs @@ -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); + + /// + /// Trigger region ready status manually. + /// + /// + /// This should be called by the scene if the IRegionReadyModule has set Scene.LoginLock == true + /// + /// + void TriggerRegionReady(IScene scene); } } diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index f92ed8e599..620b605e02 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -496,15 +496,25 @@ namespace OpenSim.Region.Framework.Scenes public delegate void RegionHeartbeatEnd(Scene scene); public event RegionHeartbeatEnd OnRegionHeartbeatEnd; - public delegate void LoginsEnabled(string regionName); - /// - /// This should only fire in all circumstances if the RegionReady module is active. + /// Fired when logins to a region are enabled or disabled. /// /// - /// TODO: Fire this even when the RegionReady module is not active. + /// /// - public event LoginsEnabled OnLoginsEnabled; + /// Fired + public event RegionLoginsStatusChange OnRegionLoginsStatusChange; + public delegate void RegionLoginsStatusChange(IScene scene); + + /// + /// Fired when a region is considered ready for use. + /// + /// + /// A region is considered ready when startup operations such as loading of scripts already on the region + /// have been completed. + /// + public event RegionReady OnRegionReady; + public delegate void RegionReady(IScene scene); public delegate void PrimsLoaded(Scene s); public event PrimsLoaded OnPrimsLoaded; @@ -2477,21 +2487,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) + 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); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3e9583cb43..6d8ee7b9ef 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -128,9 +128,10 @@ namespace OpenSim.Region.Framework.Scenes // root agents when ACL denies access to root agent public bool m_strictAccessControl = true; 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; @@ -702,6 +703,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) @@ -1476,7 +1479,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); @@ -1484,31 +1487,34 @@ namespace OpenSim.Region.Framework.Scenes // this is a rare case where we know we have just went through a long cycle of heap // 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(), 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 + + // 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(); + rrm.TriggerRegionReady(this); } - - // For RegionReady lockouts - if (!LoginLock) - { - m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); - LoginsDisabled = false; - } - - m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo); - } - else - { - StartDisabled = true; - LoginsDisabled = true; } } } @@ -3317,24 +3323,30 @@ namespace OpenSim.Region.Framework.Scenes if (AgentTransactionsModule != null) AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); - avatar.Close(); - m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); } 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 { - // 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); + 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. + 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)); @@ -3448,7 +3460,7 @@ namespace OpenSim.Region.Framework.Scenes agent.startpos ); - if (LoginsDisabled) + if (!LoginsEnabled) { reason = "Logins Disabled"; return false; diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index f50fbfcdbf..282fc5e927 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -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; } diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 661e03c9be..305f8a4d0d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -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); } } diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index a407f01d63..37b5184715 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -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, diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 600cafb7c4..e49ad2a3f8 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -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,47 +97,35 @@ 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; - if(m_uri != string.Empty) + m_log.InfoFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name); + + if (m_uri != string.Empty) { RRAlert("disabled"); } } } - 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_uri != string.Empty) - { + 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(), 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) + /// + /// 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. + /// + /// + public void TriggerRegionReady(IScene scene) { - if (m_disable_logins == true) + m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; + m_scene.LoginLock = false; + + if (!m_scene.StartDisabled) { - if (m_scene.StartDisabled == false) - { - m_scene.LoginsDisabled = false; - m_scene.LoginLock = false; + m_scene.LoginsEnabled = true; - m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; + // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", + // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); - // 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); - - if (m_uri != string.Empty) - { - RRAlert("enabled"); - } - } + m_log.InfoFormat( + "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); } + + m_scene.SceneGridService.InformNeighborsThatRegionisUp( + m_scene.RequestModuleInterface(), 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) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f88338d3c6..084bd41bf1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3973,23 +3973,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (agentItem == null) return; - byte[] bucket = new byte[17]; - bucket[0] = (byte)item.Type; - byte[] objBytes = agentItem.ID.GetBytes(); - Array.Copy(objBytes, 0, bucket, 1, 16); - - GridInstantMessage msg = new GridInstantMessage(World, - m_host.UUID, m_host.Name + ", an object owned by " + - resolveName(m_host.OwnerID) + ",", destId, - (byte)InstantMessageDialog.TaskInventoryOffered, - false, item.Name + "\n" + m_host.Name + " is located at " + - World.RegionInfo.RegionName+" "+ - m_host.AbsolutePosition.ToString(), - agentItem.ID, true, m_host.AbsolutePosition, - bucket); - if (m_TransferModule != null) + { + byte[] bucket = new byte[] { (byte)item.Type }; + + GridInstantMessage msg = new GridInstantMessage(World, + m_host.UUID, m_host.Name + ", an object owned by " + + resolveName(m_host.OwnerID) + ",", destId, + (byte)InstantMessageDialog.TaskInventoryOffered, + false, item.Name + "\n" + m_host.Name + " is located at " + + World.RegionInfo.RegionName+" "+ + m_host.AbsolutePosition.ToString(), + agentItem.ID, true, m_host.AbsolutePosition, + bucket); + m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); + } ScriptSleep(3000); } @@ -6397,23 +6396,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (folderID == UUID.Zero) return; - byte[] bucket = new byte[17]; - bucket[0] = (byte)AssetType.Folder; - byte[] objBytes = folderID.GetBytes(); - Array.Copy(objBytes, 0, bucket, 1, 16); - - GridInstantMessage msg = new GridInstantMessage(World, - m_host.UUID, m_host.Name + ", an object owned by " + - resolveName(m_host.OwnerID) + ",", destID, - (byte)InstantMessageDialog.InventoryOffered, - 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) + { + byte[] bucket = new byte[] { (byte)AssetType.Folder }; + + GridInstantMessage msg = new GridInstantMessage(World, + m_host.UUID, m_host.Name + ", an object owned by " + + resolveName(m_host.OwnerID) + ",", destID, + (byte)InstantMessageDialog.TaskInventoryOffered, + false, category + "\n" + m_host.Name + " is located at " + + World.RegionInfo.RegionName + " " + + m_host.AbsolutePosition.ToString(), + folderID, true, m_host.AbsolutePosition, + bucket); + m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); + } } public void llSetVehicleType(int type) diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 7a9c80c28e..da344d6116 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -644,6 +644,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), diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 769de83c9c..7598cc360e 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -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);