diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 74 |
1 files changed, 43 insertions, 31 deletions
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; |