diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 98 |
1 files changed, 62 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5f45529..1ad5edd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -176,7 +176,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
176 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 176 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
177 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 177 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
178 | protected string m_simulatorVersion = "OpenSimulator Server"; | 178 | protected string m_simulatorVersion = "OpenSimulator Server"; |
179 | protected ModuleLoader m_moduleLoader; | ||
180 | protected AgentCircuitManager m_authenticateHandler; | 179 | protected AgentCircuitManager m_authenticateHandler; |
181 | protected SceneCommunicationService m_sceneGridService; | 180 | protected SceneCommunicationService m_sceneGridService; |
182 | 181 | ||
@@ -659,7 +658,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
659 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, | 658 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, |
660 | SceneCommunicationService sceneGridService, | 659 | SceneCommunicationService sceneGridService, |
661 | ISimulationDataService simDataService, IEstateDataService estateDataService, | 660 | ISimulationDataService simDataService, IEstateDataService estateDataService, |
662 | ModuleLoader moduleLoader, bool dumpAssetsToFile, | 661 | bool dumpAssetsToFile, |
663 | IConfigSource config, string simulatorVersion) | 662 | IConfigSource config, string simulatorVersion) |
664 | : this(regInfo) | 663 | : this(regInfo) |
665 | { | 664 | { |
@@ -670,7 +669,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
670 | Random random = new Random(); | 669 | Random random = new Random(); |
671 | 670 | ||
672 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); | 671 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); |
673 | m_moduleLoader = moduleLoader; | ||
674 | m_authenticateHandler = authen; | 672 | m_authenticateHandler = authen; |
675 | m_sceneGridService = sceneGridService; | 673 | m_sceneGridService = sceneGridService; |
676 | m_SimulationDataService = simDataService; | 674 | m_SimulationDataService = simDataService; |
@@ -742,7 +740,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
742 | // | 740 | // |
743 | // Out of memory | 741 | // Out of memory |
744 | // Operating system has killed the plugin | 742 | // Operating system has killed the plugin |
745 | m_sceneGraph.UnRecoverableError += RestartNow; | 743 | m_sceneGraph.UnRecoverableError |
744 | += () => | ||
745 | { | ||
746 | m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name); | ||
747 | RestartNow(); | ||
748 | }; | ||
746 | 749 | ||
747 | RegisterDefaultSceneEvents(); | 750 | RegisterDefaultSceneEvents(); |
748 | 751 | ||
@@ -1136,15 +1139,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1136 | } | 1139 | } |
1137 | } | 1140 | } |
1138 | 1141 | ||
1139 | m_log.Error("[REGION]: Closing"); | 1142 | m_log.InfoFormat("[REGION]: Restarting region {0}", Name); |
1140 | Close(); | ||
1141 | 1143 | ||
1142 | if (PhysicsScene != null) | 1144 | Close(); |
1143 | { | ||
1144 | PhysicsScene.Dispose(); | ||
1145 | } | ||
1146 | |||
1147 | m_log.Error("[REGION]: Firing Region Restart Message"); | ||
1148 | 1145 | ||
1149 | base.Restart(); | 1146 | base.Restart(); |
1150 | } | 1147 | } |
@@ -1267,6 +1264,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1267 | // This is the method that shuts down the scene. | 1264 | // This is the method that shuts down the scene. |
1268 | public override void Close() | 1265 | public override void Close() |
1269 | { | 1266 | { |
1267 | if (m_shuttingDown) | ||
1268 | { | ||
1269 | m_log.WarnFormat("[SCENE]: Ignoring close request because already closing {0}", Name); | ||
1270 | return; | ||
1271 | } | ||
1272 | |||
1270 | m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); | 1273 | m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); |
1271 | 1274 | ||
1272 | StatsReporter.Close(); | 1275 | StatsReporter.Close(); |
@@ -1310,6 +1313,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1310 | 1313 | ||
1311 | m_sceneGraph.Close(); | 1314 | m_sceneGraph.Close(); |
1312 | 1315 | ||
1316 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | ||
1317 | m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); | ||
1318 | |||
1319 | base.Close(); | ||
1320 | |||
1321 | // XEngine currently listens to the EventManager.OnShutdown event to trigger script stop and persistence. | ||
1322 | // Therefore. we must dispose of the PhysicsScene after this to prevent a window where script code can | ||
1323 | // attempt to reference a null or disposed physics scene. | ||
1313 | if (PhysicsScene != null) | 1324 | if (PhysicsScene != null) |
1314 | { | 1325 | { |
1315 | PhysicsScene phys = PhysicsScene; | 1326 | PhysicsScene phys = PhysicsScene; |
@@ -1318,12 +1329,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1318 | phys.Dispose(); | 1329 | phys.Dispose(); |
1319 | phys = null; | 1330 | phys = null; |
1320 | } | 1331 | } |
1321 | |||
1322 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | ||
1323 | m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); | ||
1324 | |||
1325 | // call the base class Close method. | ||
1326 | base.Close(); | ||
1327 | } | 1332 | } |
1328 | 1333 | ||
1329 | /// <summary> | 1334 | /// <summary> |
@@ -1684,12 +1689,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1684 | 1689 | ||
1685 | private void CheckAtTargets() | 1690 | private void CheckAtTargets() |
1686 | { | 1691 | { |
1687 | Dictionary<UUID, SceneObjectGroup>.ValueCollection objs; | 1692 | List<SceneObjectGroup> objs = null; |
1693 | |||
1688 | lock (m_groupsWithTargets) | 1694 | lock (m_groupsWithTargets) |
1689 | objs = m_groupsWithTargets.Values; | 1695 | { |
1696 | if (m_groupsWithTargets.Count != 0) | ||
1697 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); | ||
1698 | } | ||
1690 | 1699 | ||
1691 | foreach (SceneObjectGroup entry in objs) | 1700 | if (objs != null) |
1692 | entry.checkAtTargets(); | 1701 | { |
1702 | foreach (SceneObjectGroup entry in objs) | ||
1703 | entry.checkAtTargets(); | ||
1704 | } | ||
1693 | } | 1705 | } |
1694 | 1706 | ||
1695 | /// <summary> | 1707 | /// <summary> |
@@ -3373,9 +3385,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3373 | } | 3385 | } |
3374 | else | 3386 | else |
3375 | { | 3387 | { |
3376 | // We remove the acd up here to avoid later raec conditions if two RemoveClient() calls occurred | 3388 | // We remove the acd up here to avoid later race conditions if two RemoveClient() calls occurred |
3377 | // simultaneously. | 3389 | // simultaneously. |
3378 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | 3390 | // We also need to remove by agent ID since NPCs will have no circuit code. |
3391 | m_authenticateHandler.RemoveCircuit(agentID); | ||
3379 | } | 3392 | } |
3380 | } | 3393 | } |
3381 | 3394 | ||
@@ -3427,9 +3440,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3427 | if (closeChildAgents && CapsModule != null) | 3440 | if (closeChildAgents && CapsModule != null) |
3428 | CapsModule.RemoveCaps(agentID); | 3441 | CapsModule.RemoveCaps(agentID); |
3429 | 3442 | ||
3430 | // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | 3443 | // // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3431 | // this method is doing is HORRIBLE!!! | 3444 | // // this method is doing is HORRIBLE!!! |
3432 | avatar.Scene.NeedSceneCacheClear(avatar.UUID); | 3445 | // Commented pending deletion since this method no longer appears to do anything at all |
3446 | // avatar.Scene.NeedSceneCacheClear(avatar.UUID); | ||
3433 | 3447 | ||
3434 | if (closeChildAgents && !isChildAgent) | 3448 | if (closeChildAgents && !isChildAgent) |
3435 | { | 3449 | { |
@@ -4688,13 +4702,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
4688 | /// Get a group via its UUID | 4702 | /// Get a group via its UUID |
4689 | /// </summary> | 4703 | /// </summary> |
4690 | /// <param name="fullID"></param> | 4704 | /// <param name="fullID"></param> |
4691 | /// <returns>null if no group with that name exists</returns> | 4705 | /// <returns>null if no group with that id exists</returns> |
4692 | public SceneObjectGroup GetSceneObjectGroup(UUID fullID) | 4706 | public SceneObjectGroup GetSceneObjectGroup(UUID fullID) |
4693 | { | 4707 | { |
4694 | return m_sceneGraph.GetSceneObjectGroup(fullID); | 4708 | return m_sceneGraph.GetSceneObjectGroup(fullID); |
4695 | } | 4709 | } |
4696 | 4710 | ||
4697 | /// <summary> | 4711 | /// <summary> |
4712 | /// Get a group via its local ID | ||
4713 | /// </summary> | ||
4714 | /// <remarks>This will only return a group if the local ID matches a root part</remarks> | ||
4715 | /// <param name="localID"></param> | ||
4716 | /// <returns>null if no group with that id exists</returns> | ||
4717 | public SceneObjectGroup GetSceneObjectGroup(uint localID) | ||
4718 | { | ||
4719 | return m_sceneGraph.GetSceneObjectGroup(localID); | ||
4720 | } | ||
4721 | |||
4722 | /// <summary> | ||
4698 | /// Get a group by name from the scene (will return the first | 4723 | /// Get a group by name from the scene (will return the first |
4699 | /// found, if there are more than one prim with the same name) | 4724 | /// found, if there are more than one prim with the same name) |
4700 | /// </summary> | 4725 | /// </summary> |
@@ -4854,14 +4879,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4854 | client.SendRegionHandle(regionID, handle); | 4879 | client.SendRegionHandle(regionID, handle); |
4855 | } | 4880 | } |
4856 | 4881 | ||
4857 | public bool NeedSceneCacheClear(UUID agentID) | 4882 | // Commented pending deletion since this method no longer appears to do anything at all |
4858 | { | 4883 | // public bool NeedSceneCacheClear(UUID agentID) |
4859 | IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); | 4884 | // { |
4860 | if (inv == null) | 4885 | // IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); |
4861 | return true; | 4886 | // if (inv == null) |
4862 | 4887 | // return true; | |
4863 | return inv.NeedSceneCacheClear(agentID, this); | 4888 | // |
4864 | } | 4889 | // return inv.NeedSceneCacheClear(agentID, this); |
4890 | // } | ||
4865 | 4891 | ||
4866 | public void CleanTempObjects() | 4892 | public void CleanTempObjects() |
4867 | { | 4893 | { |