From eac9bc68890cff90c9be45fe8ddfd3ea5f4fade2 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Mon, 10 Dec 2007 19:16:50 +0000 Subject: * More refactoring to prepare for draw distance based agent sim notification. --- OpenSim/Framework/RegionInfo.cs | 20 ++++++++++++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 19 +++++++++++++------ .../Environment/Scenes/SceneCommunicationService.cs | 20 +++++++++++++++----- 3 files changed, 48 insertions(+), 11 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index ff5c204..bd896bd 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -64,6 +64,16 @@ namespace OpenSim.Framework m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); } + public SimpleRegionInfo(RegionInfo ConvertFrom) + { + m_regionLocX = ConvertFrom.RegionLocX; + m_regionLocY = ConvertFrom.RegionLocY; + m_internalEndPoint = ConvertFrom.InternalEndPoint; + m_externalHostName = ConvertFrom.ExternalHostName; + m_remotingPort = ConvertFrom.RemotingPort; + RemotingAddress = ConvertFrom.RemotingAddress; + RegionID = LLUUID.Zero; + } public LLUUID RegionID = LLUUID.Zero; @@ -238,6 +248,16 @@ namespace OpenSim.Framework RemotingAddress = ConvertFrom.RemotingAddress; RegionID = LLUUID.Zero; } + public RegionInfo(SimpleRegionInfo ConvertFrom) + { + m_regionLocX = ConvertFrom.RegionLocX; + m_regionLocY = ConvertFrom.RegionLocY; + m_internalEndPoint = ConvertFrom.InternalEndPoint; + m_externalHostName = ConvertFrom.ExternalHostName; + m_remotingPort = ConvertFrom.RemotingPort; + RemotingAddress = ConvertFrom.RemotingAddress; + RegionID = LLUUID.Zero; + } //not in use, should swap to nini though. public void LoadFromNiniSource(IConfigSource source) { diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 01bcd83..587d940 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -269,7 +269,12 @@ namespace OpenSim.Region.Environment.Scenes { // Another region is up. // We have to tell all our ScenePresences about it.. - //and add it to the neighbor list. + // and add it to the neighbor list. + + // We only add it to the neighbor list if it's within 1 region from here. + // Agents may have draw distance values that cross two regions though, so + // we add it to the notify list regardless of distance. + // We'll check the agent's draw distance before notifying them though. if (RegionInfo.RegionHandle != otherRegion.RegionHandle) @@ -297,12 +302,11 @@ namespace OpenSim.Region.Environment.Scenes { m_neighbours.Add(otherRegion); } - if (!(m_regionRestartNotifyList.Contains(otherRegion))) { m_regionRestartNotifyList.Add(otherRegion); - - m_restartWaitTimer.Interval= 50000; + + m_restartWaitTimer.Interval = 50000; m_restartWaitTimer.AutoReset = false; m_restartWaitTimer.Elapsed += new ElapsedEventHandler(RestartNotifyWaitElapsed); m_restartWaitTimer.Start(); @@ -312,6 +316,9 @@ namespace OpenSim.Region.Environment.Scenes { MainLog.Instance.Verbose("INTERGRID", "Got notice about Region at X:" + otherRegion.RegionLocX.ToString() + " Y:" + otherRegion.RegionLocY.ToString() + " but it was too far away to send to the client"); } + + + } return true; @@ -1250,7 +1257,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void InformClientOfNeighbours(ScenePresence presence) { - m_sceneGridService.EnableNeighbourChildAgents(presence); + m_sceneGridService.EnableNeighbourChildAgents(presence, m_neighbours); } /// @@ -1260,7 +1267,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void InformClientOfNeighbor(ScenePresence presence, RegionInfo region) { - m_sceneGridService.InformNeighborChildAgent(presence, region); + m_sceneGridService.InformNeighborChildAgent(presence, region, m_neighbours); } /// diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 4d2379b..68bb3b5 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -191,14 +191,24 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void EnableNeighbourChildAgents(ScenePresence avatar) + public void EnableNeighbourChildAgents(ScenePresence avatar, List lstneighbours) { - List neighbours = - m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); + List neighbours = new List(); + + //m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); + for (int i = 0; i < lstneighbours.Count; i++) + { + // We don't want to keep sending to regions that consistently fail on comms. + if (!(lstneighbours[i].commFailTF)) + { + neighbours.Add(new SimpleRegionInfo(lstneighbours[i])); + } + } if (neighbours != null) { for (int i = 0; i < neighbours.Count; i++) { + AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); agent.BaseFolder = LLUUID.Zero; agent.InventoryFolder = LLUUID.Zero; @@ -212,7 +222,7 @@ namespace OpenSim.Region.Environment.Scenes } } } - public void InformNeighborChildAgent(ScenePresence avatar, RegionInfo region) + public void InformNeighborChildAgent(ScenePresence avatar, RegionInfo region, List neighbours) { AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); agent.BaseFolder = LLUUID.Zero; @@ -257,7 +267,7 @@ namespace OpenSim.Region.Environment.Scenes List neighbours = new List(); - + // This stays uncached because we don't already know about our neighbors at this point. neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); if (neighbours != null) { -- cgit v1.1