From 175b6115f19f9bad7c81fde625250b3a7f8a33f2 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Mon, 26 Nov 2007 05:02:18 +0000 Subject: * Restarting regions with the estate tools works in sandbox mode. I'm still working on grid mode, however. It doesn't break anything, but that feature doesn't work in grid mode yet either. --- OpenSim/Region/Environment/Scenes/Scene.cs | 41 +++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index fd17d56..a9791ee 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -216,7 +216,7 @@ namespace OpenSim.Region.Environment.Scenes m_regionHandle = m_regInfo.RegionHandle; m_regionName = m_regInfo.RegionName; m_datastore = m_regInfo.DataStore; - RegisterRegionWithComms(); + m_physicalPrim = physicalPrim; m_sendTasksToChild = SendTasksToChild; @@ -244,6 +244,7 @@ namespace OpenSim.Region.Environment.Scenes httpListener = httpServer; m_dumpAssetsToFile = dumpAssetsToFile; + RegisterRegionWithComms(); } #endregion @@ -257,21 +258,29 @@ namespace OpenSim.Region.Environment.Scenes m_eventManager.OnPermissionError += SendPermissionAlert; } - public override void OtherRegionUp(RegionInfo otherRegion) + public override bool OtherRegionUp(RegionInfo otherRegion) { // Another region is up. We have to tell all our ScenePresences about it // This fails to get the desired effect and needs further work. - - ForEachScenePresence(delegate(ScenePresence agent) + try { - if (!(agent.IsChildAgent)) - { - InformClientOfNeighbor(agent, otherRegion); - this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); - + + ForEachScenePresence(delegate(ScenePresence agent) + { + if (!(agent.IsChildAgent)) + { + this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); + InformClientOfNeighbor(agent, otherRegion); + } } + + ); } - ); + catch (System.NullReferenceException) + { + // This means that we're not booted up completely yet. + } + return true; } public virtual void Restart(float seconds) { @@ -1068,9 +1077,13 @@ namespace OpenSim.Region.Environment.Scenes m_sceneGridService.OnExpectUser += NewUserConnection; m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; m_sceneGridService.OnCloseAgentConnection += CloseConnection; + m_sceneGridService.OnRegionUp += OtherRegionUp; + // Tell Other regions that I'm here. + m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo); } public void UnRegisterReginWithComms() { + m_sceneGridService.OnRegionUp -= OtherRegionUp; m_sceneGridService.OnExpectUser -= NewUserConnection; m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; m_sceneGridService.OnCloseAgentConnection -= CloseConnection; @@ -1578,9 +1591,13 @@ namespace OpenSim.Region.Environment.Scenes /// public void ForEachScenePresence(Action action) { - foreach (ScenePresence presence in m_scenePresences.Values) + // We don't want to try to send messages if there are no avatar. + if (!(m_scenePresences.Equals(null))) { - action(presence); + foreach (ScenePresence presence in m_scenePresences.Values) + { + action(presence); + } } } -- cgit v1.1