diff options
author | Melanie | 2012-07-19 09:47:51 +0100 |
---|---|---|
committer | Melanie | 2012-07-19 09:47:51 +0100 |
commit | 36d744e2a5963d8f3ed33990943aa0ab25832a8b (patch) | |
tree | ae78b4d8a5db18ad551fbe2157e9abdb7a57ce04 /OpenSim/Region | |
parent | Fix llSameGroup to work according to specs (diff) | |
parent | Add EventManager.OnRegionLoginsStatusChange fired whenever logins are enabled... (diff) | |
download | opensim-SC_OLD-36d744e2a5963d8f3ed33990943aa0ab25832a8b.zip opensim-SC_OLD-36d744e2a5963d8f3ed33990943aa0ab25832a8b.tar.gz opensim-SC_OLD-36d744e2a5963d8f3ed33990943aa0ab25832a8b.tar.bz2 opensim-SC_OLD-36d744e2a5963d8f3ed33990943aa0ab25832a8b.tar.xz |
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
Diffstat (limited to 'OpenSim/Region')
16 files changed, 241 insertions, 168 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 394b90a..c679a7b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -636,10 +636,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
636 | 636 | ||
637 | m_scene.InventoryService.UpdateItem(item); | 637 | m_scene.InventoryService.UpdateItem(item); |
638 | 638 | ||
639 | // this gets called when the agent logs off! | 639 | // If the name of the object has been changed whilst attached then we want to update the inventory |
640 | // item in the viewer. | ||
640 | if (sp.ControllingClient != null) | 641 | if (sp.ControllingClient != null) |
641 | sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | 642 | sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0); |
642 | } | 643 | } |
644 | |||
643 | grp.HasGroupChanged = false; // Prevent it being saved over and over | 645 | grp.HasGroupChanged = false; // Prevent it being saved over and over |
644 | } | 646 | } |
645 | // else | 647 | // else |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 6064ddc..1406aae 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -141,13 +141,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
141 | foreach (Scene scene in m_Scenes) | 141 | foreach (Scene scene in m_Scenes) |
142 | { | 142 | { |
143 | // m_log.DebugFormat( | 143 | // m_log.DebugFormat( |
144 | // "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", | 144 | // "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", |
145 | // toAgentID.ToString(), scene.RegionInfo.RegionName); | 145 | // toAgentID.ToString(), scene.RegionInfo.RegionName); |
146 | |||
146 | ScenePresence sp = scene.GetScenePresence(toAgentID); | 147 | ScenePresence sp = scene.GetScenePresence(toAgentID); |
147 | if (sp != null && !sp.IsChildAgent) | 148 | if (sp != null && !sp.IsChildAgent) |
148 | { | 149 | { |
149 | // Local message | 150 | // Local message |
150 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); | 151 | m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", sp.Name, toAgentID); |
152 | |||
151 | sp.ControllingClient.SendInstantMessage(im); | 153 | sp.ControllingClient.SendInstantMessage(im); |
152 | 154 | ||
153 | // Message sent | 155 | // Message sent |
@@ -159,13 +161,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
159 | // try child avatar second | 161 | // try child avatar second |
160 | foreach (Scene scene in m_Scenes) | 162 | foreach (Scene scene in m_Scenes) |
161 | { | 163 | { |
162 | // m_log.DebugFormat( | 164 | m_log.DebugFormat( |
163 | // "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); | 165 | "[INSTANT MESSAGE]: Looking for child of {0} in {1}", toAgentID, scene.RegionInfo.RegionName); |
166 | |||
164 | ScenePresence sp = scene.GetScenePresence(toAgentID); | 167 | ScenePresence sp = scene.GetScenePresence(toAgentID); |
165 | if (sp != null) | 168 | if (sp != null) |
166 | { | 169 | { |
167 | // Local message | 170 | // Local message |
168 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); | 171 | m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", sp.Name, toAgentID); |
172 | |||
169 | sp.ControllingClient.SendInstantMessage(im); | 173 | sp.ControllingClient.SendInstantMessage(im); |
170 | 174 | ||
171 | // Message sent | 175 | // Message sent |
@@ -174,10 +178,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
174 | } | 178 | } |
175 | } | 179 | } |
176 | 180 | ||
177 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); | 181 | m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); |
178 | SendGridInstantMessageViaXMLRPC(im, result); | ||
179 | 182 | ||
180 | return; | 183 | SendGridInstantMessageViaXMLRPC(im, result); |
181 | } | 184 | } |
182 | 185 | ||
183 | private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result) | 186 | 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 80554fb..81de29c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -313,8 +313,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
313 | m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); | 313 | m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined || | 316 | else if ( |
317 | im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined) | 317 | im.dialog == (byte)InstantMessageDialog.InventoryDeclined |
318 | || im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined) | ||
318 | { | 319 | { |
319 | // Here, the recipient is local and we can assume that the | 320 | // Here, the recipient is local and we can assume that the |
320 | // inventory is loaded. Courtesy of the above bulk update, | 321 | // 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 6cd077a..7ed1320 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs | |||
@@ -149,10 +149,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
149 | lock (m_scenes) | 149 | lock (m_scenes) |
150 | m_scenes[scene.RegionInfo.RegionID] = scene; | 150 | m_scenes[scene.RegionInfo.RegionID] = scene; |
151 | 151 | ||
152 | scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; | 152 | scene.EventManager.OnRegionReady += s => UploadMapTile(s); |
153 | } | 153 | } |
154 | 154 | ||
155 | |||
156 | ///<summary> | 155 | ///<summary> |
157 | /// | 156 | /// |
158 | ///</summary> | 157 | ///</summary> |
@@ -166,21 +165,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
166 | } | 165 | } |
167 | 166 | ||
168 | #endregion ISharedRegionModule | 167 | #endregion ISharedRegionModule |
169 | 168 | ||
170 | void OnLoginsEnabled(string regionName) | ||
171 | { | ||
172 | Scene scene = null; | ||
173 | foreach (Scene s in m_scenes.Values) | ||
174 | if (s.RegionInfo.RegionName == regionName) | ||
175 | { | ||
176 | scene = s; | ||
177 | break; | ||
178 | } | ||
179 | if (scene != null) | ||
180 | UploadMapTile(scene); | ||
181 | } | ||
182 | |||
183 | |||
184 | ///<summary> | 169 | ///<summary> |
185 | /// | 170 | /// |
186 | ///</summary> | 171 | ///</summary> |
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs index 553a32d..e7b1454 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 | |||
129 | switch (cmd[1]) | 129 | switch (cmd[1]) |
130 | { | 130 | { |
131 | case "enable": | 131 | case "enable": |
132 | scene.LoginsDisabled = false; | 132 | scene.LoginsEnabled = true; |
133 | MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName)); | 133 | MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName)); |
134 | break; | 134 | break; |
135 | case "disable": | 135 | case "disable": |
136 | scene.LoginsDisabled = true; | 136 | scene.LoginsEnabled = false; |
137 | MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName)); | 137 | MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName)); |
138 | break; | 138 | break; |
139 | case "status": | 139 | case "status": |
140 | if (scene.LoginsDisabled) | 140 | if (scene.LoginsEnabled) |
141 | MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName)); | ||
142 | else | ||
143 | MainConsole.Instance.Output(String.Format("Login in {0} are enabled", scene.RegionInfo.RegionName)); | 141 | MainConsole.Instance.Output(String.Format("Login in {0} are enabled", scene.RegionInfo.RegionName)); |
142 | else | ||
143 | MainConsole.Instance.Output(String.Format("Login in {0} are disabled", scene.RegionInfo.RegionName)); | ||
144 | break; | 144 | break; |
145 | default: | 145 | default: |
146 | MainConsole.Instance.Output("Syntax: login enable|disable|status"); | 146 | 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 aa4a757..136ca92 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs | |||
@@ -25,14 +25,23 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | |||
29 | using System; | 28 | using System; |
29 | using OpenSim.Framework; | ||
30 | 30 | ||
31 | namespace OpenSim.Region.Framework.Interfaces | 31 | namespace OpenSim.Region.Framework.Interfaces |
32 | { | 32 | { |
33 | public interface IRegionReadyModule | 33 | public interface IRegionReadyModule |
34 | { | 34 | { |
35 | void OarLoadingAlert(string msg); | 35 | void OarLoadingAlert(string msg); |
36 | |||
37 | /// <summary> | ||
38 | /// Trigger region ready status manually. | ||
39 | /// </summary> | ||
40 | /// <remarks> | ||
41 | /// This should be called by the scene if the IRegionReadyModule has set Scene.LoginLock == true | ||
42 | /// </remarks> | ||
43 | /// <param name='scene'></param> | ||
44 | void TriggerRegionReady(IScene scene); | ||
36 | } | 45 | } |
37 | } | 46 | } |
38 | 47 | ||
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index d783e57..418904f 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -500,15 +500,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
500 | public delegate void RegionHeartbeatEnd(Scene scene); | 500 | public delegate void RegionHeartbeatEnd(Scene scene); |
501 | public event RegionHeartbeatEnd OnRegionHeartbeatEnd; | 501 | public event RegionHeartbeatEnd OnRegionHeartbeatEnd; |
502 | 502 | ||
503 | public delegate void LoginsEnabled(string regionName); | 503 | /// <summary> |
504 | /// Fired when logins to a region are enabled or disabled. | ||
505 | /// </summary> | ||
506 | /// <remarks> | ||
507 | /// | ||
508 | /// </remarks> | ||
509 | /// Fired | ||
510 | public event RegionLoginsStatusChange OnRegionLoginsStatusChange; | ||
511 | public delegate void RegionLoginsStatusChange(IScene scene); | ||
504 | 512 | ||
505 | /// <summary> | 513 | /// <summary> |
506 | /// This should only fire in all circumstances if the RegionReady module is active. | 514 | /// Fired when a region is considered ready for use. |
507 | /// </summary> | 515 | /// </summary> |
508 | /// <remarks> | 516 | /// <remarks> |
509 | /// TODO: Fire this even when the RegionReady module is not active. | 517 | /// A region is considered ready when startup operations such as loading of scripts already on the region |
518 | /// have been completed. | ||
510 | /// </remarks> | 519 | /// </remarks> |
511 | public event LoginsEnabled OnLoginsEnabled; | 520 | public event RegionReady OnRegionReady; |
521 | public delegate void RegionReady(IScene scene); | ||
512 | 522 | ||
513 | public delegate void PrimsLoaded(Scene s); | 523 | public delegate void PrimsLoaded(Scene s); |
514 | public event PrimsLoaded OnPrimsLoaded; | 524 | public event PrimsLoaded OnPrimsLoaded; |
@@ -2502,21 +2512,42 @@ namespace OpenSim.Region.Framework.Scenes | |||
2502 | } | 2512 | } |
2503 | } | 2513 | } |
2504 | 2514 | ||
2505 | public void TriggerLoginsEnabled (string regionName) | 2515 | public void TriggerRegionLoginsStatusChange(IScene scene) |
2506 | { | 2516 | { |
2507 | LoginsEnabled handler = OnLoginsEnabled; | 2517 | RegionLoginsStatusChange handler = OnRegionLoginsStatusChange; |
2508 | 2518 | ||
2509 | if ( handler != null) | 2519 | if (handler != null) |
2510 | { | 2520 | { |
2511 | foreach (LoginsEnabled d in handler.GetInvocationList()) | 2521 | foreach (RegionLoginsStatusChange d in handler.GetInvocationList()) |
2512 | { | 2522 | { |
2513 | try | 2523 | try |
2514 | { | 2524 | { |
2515 | d(regionName); | 2525 | d(scene); |
2526 | } | ||
2527 | catch (Exception e) | ||
2528 | { | ||
2529 | m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionLoginsStatusChange failed - continuing {0} - {1}", | ||
2530 | e.Message, e.StackTrace); | ||
2531 | } | ||
2532 | } | ||
2533 | } | ||
2534 | } | ||
2535 | |||
2536 | public void TriggerRegionReady(IScene scene) | ||
2537 | { | ||
2538 | RegionReady handler = OnRegionReady; | ||
2539 | |||
2540 | if (handler != null) | ||
2541 | { | ||
2542 | foreach (RegionReady d in handler.GetInvocationList()) | ||
2543 | { | ||
2544 | try | ||
2545 | { | ||
2546 | d(scene); | ||
2516 | } | 2547 | } |
2517 | catch (Exception e) | 2548 | catch (Exception e) |
2518 | { | 2549 | { |
2519 | m_log.ErrorFormat("[EVENT MANAGER]: Delegate for LoginsEnabled failed - continuing {0} - {1}", | 2550 | m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReady failed - continuing {0} - {1}", |
2520 | e.Message, e.StackTrace); | 2551 | e.Message, e.StackTrace); |
2521 | } | 2552 | } |
2522 | } | 2553 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f501828..645b3d5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -129,9 +129,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
129 | public bool m_strictAccessControl = true; | 129 | public bool m_strictAccessControl = true; |
130 | public bool m_seeIntoBannedRegion = false; | 130 | public bool m_seeIntoBannedRegion = false; |
131 | public int MaxUndoCount = 5; | 131 | public int MaxUndoCount = 5; |
132 | |||
132 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; | 133 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; |
133 | public bool LoginLock = false; | 134 | public bool LoginLock = false; |
134 | public bool LoginsDisabled = true; | 135 | |
135 | public bool StartDisabled = false; | 136 | public bool StartDisabled = false; |
136 | public bool LoadingPrims; | 137 | public bool LoadingPrims; |
137 | public IXfer XferManager; | 138 | public IXfer XferManager; |
@@ -727,6 +728,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
727 | { | 728 | { |
728 | IConfig startupConfig = m_config.Configs["Startup"]; | 729 | IConfig startupConfig = m_config.Configs["Startup"]; |
729 | 730 | ||
731 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | ||
732 | |||
730 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); | 733 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
731 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); | 734 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); |
732 | if (!m_useBackup) | 735 | if (!m_useBackup) |
@@ -1530,7 +1533,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1530 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); | 1533 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); |
1531 | //} | 1534 | //} |
1532 | 1535 | ||
1533 | if (LoginsDisabled && Frame == 20) | 1536 | if (!LoginsEnabled && Frame == 20) |
1534 | { | 1537 | { |
1535 | // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); | 1538 | // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); |
1536 | 1539 | ||
@@ -1538,31 +1541,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
1538 | // this is a rare case where we know we have just went through a long cycle of heap | 1541 | // this is a rare case where we know we have just went through a long cycle of heap |
1539 | // allocations, and there is no more work to be done until someone logs in | 1542 | // allocations, and there is no more work to be done until someone logs in |
1540 | GC.Collect(); | 1543 | GC.Collect(); |
1541 | 1544 | ||
1542 | IConfig startupConfig = m_config.Configs["Startup"]; | 1545 | if (!LoginLock) |
1543 | if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) | ||
1544 | { | 1546 | { |
1545 | // This handles a case of a region having no scripts for the RegionReady module | 1547 | if (!StartDisabled) |
1546 | if (m_sceneGraph.GetActiveScriptsCount() == 0) | ||
1547 | { | ||
1548 | // need to be able to tell these have changed in RegionReady | ||
1549 | LoginLock = false; | ||
1550 | EventManager.TriggerLoginsEnabled(RegionInfo.RegionName); | ||
1551 | } | ||
1552 | |||
1553 | // For RegionReady lockouts | ||
1554 | if (!LoginLock) | ||
1555 | { | 1548 | { |
1556 | m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); | 1549 | m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); |
1557 | LoginsDisabled = false; | 1550 | LoginsEnabled = true; |
1558 | } | 1551 | } |
1559 | 1552 | ||
1560 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); | 1553 | m_sceneGridService.InformNeighborsThatRegionisUp( |
1554 | RequestModuleInterface<INeighbourService>(), RegionInfo); | ||
1555 | |||
1556 | // Region ready should always be triggered whether logins are immediately enabled or not. | ||
1557 | EventManager.TriggerRegionReady(this); | ||
1561 | } | 1558 | } |
1562 | else | 1559 | else |
1563 | { | 1560 | { |
1564 | StartDisabled = true; | 1561 | // This handles a case of a region having no scripts for the RegionReady module |
1565 | LoginsDisabled = true; | 1562 | if (m_sceneGraph.GetActiveScriptsCount() == 0) |
1563 | { | ||
1564 | // In this case, we leave it to the IRegionReadyModule to enable logins | ||
1565 | |||
1566 | // LoginLock can currently only be set by a region module implementation. | ||
1567 | // If somehow this hasn't been done then the quickest way to bugfix is to see the | ||
1568 | // NullReferenceException | ||
1569 | IRegionReadyModule rrm = RequestModuleInterface<IRegionReadyModule>(); | ||
1570 | rrm.TriggerRegionReady(this); | ||
1571 | } | ||
1566 | } | 1572 | } |
1567 | } | 1573 | } |
1568 | } | 1574 | } |
@@ -3487,25 +3493,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
3487 | if (AgentTransactionsModule != null) | 3493 | if (AgentTransactionsModule != null) |
3488 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3494 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3489 | 3495 | ||
3490 | avatar.Close(); | ||
3491 | |||
3492 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3496 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3493 | m_log.Debug("[Scene] The avatar has left the building"); | 3497 | m_log.Debug("[Scene] The avatar has left the building"); |
3494 | } | 3498 | } |
3495 | catch (Exception e) | 3499 | catch (Exception e) |
3496 | { | 3500 | { |
3497 | m_log.Error( | 3501 | m_log.Error( |
3498 | string.Format("[SCENE]: Exception removing {0} from {1}, ", avatar.Name, RegionInfo.RegionName), e); | 3502 | string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e); |
3499 | } | 3503 | } |
3500 | finally | 3504 | finally |
3501 | { | 3505 | { |
3502 | // Always clean these structures up so that any failure above doesn't cause them to remain in the | 3506 | try |
3503 | // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering | 3507 | { |
3504 | // the same cleanup exception continually. | 3508 | // Always clean these structures up so that any failure above doesn't cause them to remain in the |
3505 | // TODO: This should probably extend to the whole method, but we don't want to also catch the NRE | 3509 | // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering |
3506 | // since this would hide the underlying failure and other associated problems. | 3510 | // the same cleanup exception continually. |
3507 | m_sceneGraph.RemoveScenePresence(agentID); | 3511 | m_sceneGraph.RemoveScenePresence(agentID); |
3508 | m_clientManager.Remove(agentID); | 3512 | m_clientManager.Remove(agentID); |
3513 | |||
3514 | avatar.Close(); | ||
3515 | } | ||
3516 | catch (Exception e) | ||
3517 | { | ||
3518 | m_log.Error( | ||
3519 | string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e); | ||
3520 | } | ||
3509 | } | 3521 | } |
3510 | 3522 | ||
3511 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3523 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
@@ -3619,7 +3631,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3619 | agent.startpos | 3631 | agent.startpos |
3620 | ); | 3632 | ); |
3621 | 3633 | ||
3622 | if (LoginsDisabled) | 3634 | if (!LoginsEnabled) |
3623 | { | 3635 | { |
3624 | reason = "Logins Disabled"; | 3636 | reason = "Logins Disabled"; |
3625 | return false; | 3637 | return false; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 8db4397..d55b082 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -106,6 +106,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
106 | 106 | ||
107 | protected readonly ClientManager m_clientManager = new ClientManager(); | 107 | protected readonly ClientManager m_clientManager = new ClientManager(); |
108 | 108 | ||
109 | public bool LoginsEnabled | ||
110 | { | ||
111 | get | ||
112 | { | ||
113 | return m_loginsEnabled; | ||
114 | } | ||
115 | |||
116 | set | ||
117 | { | ||
118 | if (m_loginsEnabled != value) | ||
119 | { | ||
120 | m_loginsEnabled = value; | ||
121 | EventManager.TriggerRegionLoginsStatusChange(this); | ||
122 | } | ||
123 | } | ||
124 | } | ||
125 | private bool m_loginsEnabled; | ||
126 | |||
109 | public float TimeDilation | 127 | public float TimeDilation |
110 | { | 128 | { |
111 | get { return 1.0f; } | 129 | get { return 1.0f; } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 5d8447b..775a4c2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -100,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
100 | { | 100 | { |
101 | m_log.WarnFormat( | 101 | m_log.WarnFormat( |
102 | "[SCENE COMMUNICATION SERVICE]: Region {0} failed to inform neighbour at {1}-{2} that it is up.", | 102 | "[SCENE COMMUNICATION SERVICE]: Region {0} failed to inform neighbour at {1}-{2} that it is up.", |
103 | x / Constants.RegionSize, y / Constants.RegionSize); | 103 | m_scene.Name, x / Constants.RegionSize, y / Constants.RegionSize); |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 6ab0027..08c7a58 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1991,7 +1991,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1991 | try | 1991 | try |
1992 | { | 1992 | { |
1993 | if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart | 1993 | if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart |
1994 | m_scene.LoginsDisabled || // We're starting up or doing maintenance, don't mess with things | 1994 | !m_scene.LoginsEnabled || // We're starting up or doing maintenance, don't mess with things |
1995 | m_scene.LoadingPrims) // Land may not be valid yet | 1995 | m_scene.LoadingPrims) // Land may not be valid yet |
1996 | 1996 | ||
1997 | { | 1997 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index a407f01..37b5184 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 | |||
301 | sp.AbsolutePosition = preTeleportPosition; | 301 | sp.AbsolutePosition = preTeleportPosition; |
302 | 302 | ||
303 | // Make sceneB refuse CreateAgent | 303 | // Make sceneB refuse CreateAgent |
304 | sceneB.LoginsDisabled = true; | 304 | sceneB.LoginsEnabled = false; |
305 | 305 | ||
306 | sceneA.RequestTeleportLocation( | 306 | sceneA.RequestTeleportLocation( |
307 | sp.ControllingClient, | 307 | sp.ControllingClient, |
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 600cafb..e49ad2a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | |||
@@ -31,16 +31,14 @@ using System.Reflection; | |||
31 | using System.Net; | 31 | using System.Net; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Text; | 33 | using System.Text; |
34 | |||
35 | using log4net; | 34 | using log4net; |
36 | using Nini.Config; | 35 | using Nini.Config; |
37 | using OpenMetaverse; | 36 | using OpenMetaverse; |
38 | using OpenMetaverse.StructuredData; | 37 | using OpenMetaverse.StructuredData; |
39 | using OpenSim.Services.Interfaces; | ||
40 | |||
41 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
42 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Services.Interfaces; | ||
44 | 42 | ||
45 | namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | 43 | namespace OpenSim.Region.OptionalModules.Scripting.RegionReady |
46 | { | 44 | { |
@@ -56,10 +54,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
56 | private bool m_lastOarLoadedOk; | 54 | private bool m_lastOarLoadedOk; |
57 | private int m_channelNotify = -1000; | 55 | private int m_channelNotify = -1000; |
58 | private bool m_enabled = false; | 56 | private bool m_enabled = false; |
59 | private bool m_disable_logins = false; | 57 | private bool m_disable_logins; |
60 | private string m_uri = string.Empty; | 58 | private string m_uri = string.Empty; |
61 | 59 | ||
62 | Scene m_scene = null; | 60 | Scene m_scene; |
63 | 61 | ||
64 | #region INonSharedRegionModule interface | 62 | #region INonSharedRegionModule interface |
65 | 63 | ||
@@ -99,47 +97,35 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
99 | m_lastOarLoadedOk = true; | 97 | m_lastOarLoadedOk = true; |
100 | 98 | ||
101 | m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; | 99 | m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; |
102 | m_scene.EventManager.OnRezScript += OnRezScript; | ||
103 | m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; | ||
104 | 100 | ||
105 | m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName); | 101 | m_log.DebugFormat("[RegionReady]: Enabled for region {0}", scene.RegionInfo.RegionName); |
106 | 102 | ||
107 | if (m_disable_logins == true) | 103 | if (m_disable_logins) |
108 | { | 104 | { |
109 | scene.LoginLock = true; | 105 | m_scene.LoginLock = true; |
110 | scene.LoginsDisabled = true; | 106 | m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; |
111 | m_log.InfoFormat("[RegionReady]: Region {0} - logins disabled during initialization.",m_scene.RegionInfo.RegionName); | 107 | |
108 | m_log.InfoFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name); | ||
112 | 109 | ||
113 | if(m_uri != string.Empty) | 110 | if (m_uri != string.Empty) |
114 | { | 111 | { |
115 | RRAlert("disabled"); | 112 | RRAlert("disabled"); |
116 | } | 113 | } |
117 | } | 114 | } |
118 | } | 115 | } |
119 | 116 | ||
120 | void OnRezScript (uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) | ||
121 | { | ||
122 | if (!m_ScriptRez) | ||
123 | { | ||
124 | m_ScriptRez = true; | ||
125 | m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; | ||
126 | m_scene.EventManager.OnRezScript -= OnRezScript; | ||
127 | } | ||
128 | } | ||
129 | |||
130 | public void RemoveRegion(Scene scene) | 117 | public void RemoveRegion(Scene scene) |
131 | { | 118 | { |
132 | if (!m_enabled) | 119 | if (!m_enabled) |
133 | return; | 120 | return; |
134 | 121 | ||
135 | m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; | ||
136 | m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; | 122 | m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; |
137 | m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled; | ||
138 | 123 | ||
139 | if(m_uri != string.Empty) | 124 | if (m_disable_logins) |
140 | { | 125 | m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; |
126 | |||
127 | if (m_uri != string.Empty) | ||
141 | RRAlert("shutdown"); | 128 | RRAlert("shutdown"); |
142 | } | ||
143 | 129 | ||
144 | m_scene = null; | 130 | m_scene = null; |
145 | } | 131 | } |
@@ -159,7 +145,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
159 | 145 | ||
160 | #endregion | 146 | #endregion |
161 | 147 | ||
162 | |||
163 | void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) | 148 | void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) |
164 | { | 149 | { |
165 | m_log.DebugFormat("[RegionReady]: Script compile queue empty!"); | 150 | m_log.DebugFormat("[RegionReady]: Script compile queue empty!"); |
@@ -193,75 +178,80 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
193 | m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); | 178 | m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); |
194 | 179 | ||
195 | m_scene.EventManager.TriggerOnChatBroadcast(this, c); | 180 | m_scene.EventManager.TriggerOnChatBroadcast(this, c); |
196 | m_scene.EventManager.TriggerLoginsEnabled(m_scene.RegionInfo.RegionName); | 181 | |
197 | m_scene.SceneGridService.InformNeighborsThatRegionisUp(m_scene.RequestModuleInterface<INeighbourService>(), m_scene.RegionInfo); | 182 | TriggerRegionReady(m_scene); |
198 | } | 183 | } |
199 | } | 184 | } |
200 | 185 | ||
201 | void OnOarFileLoaded(Guid requestId, string message) | 186 | void OnOarFileLoaded(Guid requestId, string message) |
202 | { | 187 | { |
203 | m_oarFileLoading = true; | 188 | m_oarFileLoading = true; |
189 | |||
204 | if (message==String.Empty) | 190 | if (message==String.Empty) |
205 | { | 191 | { |
206 | m_lastOarLoadedOk = true; | 192 | m_lastOarLoadedOk = true; |
207 | } else { | 193 | } |
194 | else | ||
195 | { | ||
208 | m_log.WarnFormat("[RegionReady]: Oar file load errors: {0}", message); | 196 | m_log.WarnFormat("[RegionReady]: Oar file load errors: {0}", message); |
209 | m_lastOarLoadedOk = false; | 197 | m_lastOarLoadedOk = false; |
210 | } | 198 | } |
211 | } | 199 | } |
212 | 200 | ||
213 | // This will be triggerd by Scene if we have no scripts | 201 | /// <summary> |
214 | // m_ScriptsRezzing will be false if there were none | 202 | /// This will be triggered by Scene directly if it contains no scripts on startup. Otherwise it is triggered |
215 | // else it will be true and we should wait on the | 203 | /// when the script compile queue is empty after initial region startup. |
216 | // empty compile queue | 204 | /// </summary> |
217 | void OnLoginsEnabled(string regionName) | 205 | /// <param name='scene'></param> |
206 | public void TriggerRegionReady(IScene scene) | ||
218 | { | 207 | { |
219 | if (m_disable_logins == true) | 208 | m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; |
209 | m_scene.LoginLock = false; | ||
210 | |||
211 | if (!m_scene.StartDisabled) | ||
220 | { | 212 | { |
221 | if (m_scene.StartDisabled == false) | 213 | m_scene.LoginsEnabled = true; |
222 | { | ||
223 | m_scene.LoginsDisabled = false; | ||
224 | m_scene.LoginLock = false; | ||
225 | 214 | ||
226 | m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; | 215 | // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", |
216 | // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); | ||
227 | 217 | ||
228 | // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", | 218 | m_log.InfoFormat( |
229 | // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); | 219 | "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); |
220 | } | ||
230 | 221 | ||
231 | m_log.InfoFormat( | 222 | m_scene.SceneGridService.InformNeighborsThatRegionisUp( |
232 | "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); | 223 | m_scene.RequestModuleInterface<INeighbourService>(), m_scene.RegionInfo); |
233 | 224 | ||
234 | if (m_uri != string.Empty) | 225 | if (m_uri != string.Empty) |
235 | { | 226 | { |
236 | RRAlert("enabled"); | 227 | RRAlert("enabled"); |
237 | } | ||
238 | } | ||
239 | } | 228 | } |
229 | |||
230 | m_scene.EventManager.TriggerRegionReady(m_scene); | ||
240 | } | 231 | } |
241 | 232 | ||
242 | public void OarLoadingAlert(string msg) | 233 | public void OarLoadingAlert(string msg) |
243 | { | 234 | { |
244 | // Let's bypass this for now until some better feedback can be established | 235 | // Let's bypass this for now until some better feedback can be established |
245 | // | 236 | // |
246 | return; | ||
247 | 237 | ||
248 | if (msg == "load") | 238 | // if (msg == "load") |
249 | { | 239 | // { |
250 | m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; | 240 | // m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; |
251 | m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; | 241 | // m_scene.EventManager.OnOarFileLoaded += OnOarFileLoaded; |
252 | m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; | 242 | // m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled; |
253 | m_scene.EventManager.OnRezScript += OnRezScript; | 243 | // m_scene.EventManager.OnRezScript += OnRezScript; |
254 | m_oarFileLoading = true; | 244 | // m_oarFileLoading = true; |
255 | m_firstEmptyCompileQueue = true; | 245 | // m_firstEmptyCompileQueue = true; |
256 | 246 | // | |
257 | m_scene.LoginsDisabled = true; | 247 | // m_scene.LoginsDisabled = true; |
258 | m_scene.LoginLock = true; | 248 | // m_scene.LoginLock = true; |
259 | if ( m_uri != string.Empty ) | 249 | // if ( m_uri != string.Empty ) |
260 | { | 250 | // { |
261 | RRAlert("loading oar"); | 251 | // RRAlert("loading oar"); |
262 | RRAlert("disabled"); | 252 | // RRAlert("disabled"); |
263 | } | 253 | // } |
264 | } | 254 | // } |
265 | } | 255 | } |
266 | 256 | ||
267 | public void RRAlert(string status) | 257 | 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 7cb4a26..6dfd723 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -6887,22 +6887,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6887 | if (folderID == UUID.Zero) | 6887 | if (folderID == UUID.Zero) |
6888 | return; | 6888 | return; |
6889 | 6889 | ||
6890 | byte[] bucket = new byte[1]; | ||
6891 | bucket[0] = (byte)AssetType.Folder; | ||
6892 | //byte[] objBytes = folderID.GetBytes(); | ||
6893 | //Array.Copy(objBytes, 0, bucket, 1, 16); | ||
6894 | |||
6895 | GridInstantMessage msg = new GridInstantMessage(World, | ||
6896 | m_host.OwnerID, m_host.Name, destID, | ||
6897 | (byte)InstantMessageDialog.TaskInventoryOffered, | ||
6898 | false, category+". "+m_host.Name+" is located at "+ | ||
6899 | World.RegionInfo.RegionName+" "+ | ||
6900 | m_host.AbsolutePosition.ToString(), | ||
6901 | folderID, true, m_host.AbsolutePosition, | ||
6902 | bucket); | ||
6903 | |||
6904 | if (m_TransferModule != null) | 6890 | if (m_TransferModule != null) |
6891 | { | ||
6892 | byte[] bucket = new byte[] { (byte)AssetType.Folder }; | ||
6893 | |||
6894 | GridInstantMessage msg = new GridInstantMessage(World, | ||
6895 | m_host.UUID, m_host.Name + ", an object owned by " + | ||
6896 | resolveName(m_host.OwnerID) + ",", destID, | ||
6897 | (byte)InstantMessageDialog.TaskInventoryOffered, | ||
6898 | false, category + "\n" + m_host.Name + " is located at " + | ||
6899 | World.RegionInfo.RegionName + " " + | ||
6900 | m_host.AbsolutePosition.ToString(), | ||
6901 | folderID, true, m_host.AbsolutePosition, | ||
6902 | bucket); | ||
6903 | |||
6905 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); | 6904 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); |
6905 | } | ||
6906 | } | 6906 | } |
6907 | 6907 | ||
6908 | public void llSetVehicleType(int type) | 6908 | public void llSetVehicleType(int type) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 983eed2..771db0c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -312,11 +312,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
312 | part.SetScriptEvents(ItemID, | 312 | part.SetScriptEvents(ItemID, |
313 | (int)m_Script.GetStateEventFlags(State)); | 313 | (int)m_Script.GetStateEventFlags(State)); |
314 | 314 | ||
315 | Running = false; | 315 | if (!Running) |
316 | |||
317 | if (ShuttingDown) | ||
318 | m_startOnInit = false; | 316 | m_startOnInit = false; |
319 | 317 | ||
318 | Running = false; | ||
319 | |||
320 | // we get new rez events on sim restart, too | 320 | // we get new rez events on sim restart, too |
321 | // but if there is state, then we fire the change | 321 | // but if there is state, then we fire the change |
322 | // event | 322 | // event |
@@ -352,12 +352,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
352 | 352 | ||
353 | public void Init() | 353 | public void Init() |
354 | { | 354 | { |
355 | if (!m_startOnInit) | 355 | if (ShuttingDown) |
356 | return; | 356 | return; |
357 | 357 | ||
358 | if (m_startedFromSavedState) | 358 | if (m_startedFromSavedState) |
359 | { | 359 | { |
360 | Start(); | 360 | if (m_startOnInit) |
361 | Start(); | ||
361 | if (m_postOnRez) | 362 | if (m_postOnRez) |
362 | { | 363 | { |
363 | PostEvent(new EventParams("on_rez", | 364 | PostEvent(new EventParams("on_rez", |
@@ -389,7 +390,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
389 | } | 390 | } |
390 | else | 391 | else |
391 | { | 392 | { |
392 | Start(); | 393 | if (m_startOnInit) |
394 | Start(); | ||
393 | PostEvent(new EventParams("state_entry", | 395 | PostEvent(new EventParams("state_entry", |
394 | new Object[0], new DetectParams[0])); | 396 | new Object[0], new DetectParams[0])); |
395 | if (m_postOnRez) | 397 | if (m_postOnRez) |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 35a0200..79a6e09 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -109,6 +109,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
109 | private bool m_KillTimedOutScripts; | 109 | private bool m_KillTimedOutScripts; |
110 | private string m_ScriptEnginesPath = null; | 110 | private string m_ScriptEnginesPath = null; |
111 | 111 | ||
112 | private ExpiringCache<UUID, bool> m_runFlags = new ExpiringCache<UUID, bool>(); | ||
113 | |||
112 | /// <summary> | 114 | /// <summary> |
113 | /// Is the entire simulator in the process of shutting down? | 115 | /// Is the entire simulator in the process of shutting down? |
114 | /// </summary> | 116 | /// </summary> |
@@ -715,6 +717,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
715 | m_Scene.EventManager.OnGetScriptRunning += OnGetScriptRunning; | 717 | m_Scene.EventManager.OnGetScriptRunning += OnGetScriptRunning; |
716 | m_Scene.EventManager.OnShutdown += OnShutdown; | 718 | m_Scene.EventManager.OnShutdown += OnShutdown; |
717 | 719 | ||
720 | // If region ready has been triggered, then the region had no scripts to compile and completed its other | ||
721 | // work. | ||
722 | m_Scene.EventManager.OnRegionReady += s => m_InitialStartup = false; | ||
723 | |||
718 | if (m_SleepTime > 0) | 724 | if (m_SleepTime > 0) |
719 | { | 725 | { |
720 | m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoMaintenance), | 726 | m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoMaintenance), |
@@ -1269,7 +1275,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1269 | 1275 | ||
1270 | if (instance!=null) | 1276 | if (instance!=null) |
1271 | instance.Init(); | 1277 | instance.Init(); |
1272 | 1278 | ||
1279 | bool runIt; | ||
1280 | if (m_runFlags.TryGetValue(itemID, out runIt)) | ||
1281 | { | ||
1282 | if (!runIt) | ||
1283 | StopScript(itemID); | ||
1284 | m_runFlags.Remove(itemID); | ||
1285 | } | ||
1286 | |||
1273 | return true; | 1287 | return true; |
1274 | } | 1288 | } |
1275 | 1289 | ||
@@ -1660,6 +1674,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1660 | IScriptInstance instance = GetInstance(itemID); | 1674 | IScriptInstance instance = GetInstance(itemID); |
1661 | if (instance != null) | 1675 | if (instance != null) |
1662 | instance.Start(); | 1676 | instance.Start(); |
1677 | else | ||
1678 | m_runFlags.AddOrUpdate(itemID, true, 240); | ||
1663 | } | 1679 | } |
1664 | 1680 | ||
1665 | public void StopScript(UUID itemID) | 1681 | public void StopScript(UUID itemID) |
@@ -1671,6 +1687,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1671 | // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort. | 1687 | // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort. |
1672 | instance.Stop(1000); | 1688 | instance.Stop(1000); |
1673 | } | 1689 | } |
1690 | else | ||
1691 | { | ||
1692 | m_runFlags.AddOrUpdate(itemID, false, 240); | ||
1693 | } | ||
1674 | } | 1694 | } |
1675 | 1695 | ||
1676 | public DetectParams GetDetectParams(UUID itemID, int idx) | 1696 | public DetectParams GetDetectParams(UUID itemID, int idx) |