From 4eca59ec13bb48309120fea24890341c65157c65 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Sep 2009 17:33:34 -0700 Subject: Improved the Local grid connector to fetch data from the DB when it doesn't find it in the cache. Commented out the Standalone teleport test because it's failing, and the scene setup is very confusing. I suspect it may be wrong -- the connectors-as-ISharedRegionModules are being instantiated several times when there are several scenes. --- .../ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs | 7 +++++-- .../ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs | 10 ++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 6c2928a..3ca4882 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -149,7 +149,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); else m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene)); - } } @@ -184,7 +183,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { if (m_LocalCache.ContainsKey(regionID)) { - return m_LocalCache[regionID].GetNeighbours(); + List neighbours = m_LocalCache[regionID].GetNeighbours(); + if (neighbours.Count == 0) + // try the DB + neighbours = m_GridService.GetNeighbours(scopeID, regionID); + return neighbours; } else { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index be32d6b..2ca90f8 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs @@ -78,6 +78,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests r1.ExternalHostName = "127.0.0.1"; r1.HttpPort = 9001; r1.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); + Scene s = new Scene(new RegionInfo()); + s.RegionInfo.RegionID = r1.RegionID; + m_LocalConnector.AddRegion(s); + GridRegion r2 = new GridRegion(); r2.RegionName = "Test Region 2"; @@ -87,6 +91,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests r2.ExternalHostName = "127.0.0.1"; r2.HttpPort = 9002; r2.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); + s = new Scene(new RegionInfo()); + s.RegionInfo.RegionID = r1.RegionID; + m_LocalConnector.AddRegion(s); GridRegion r3 = new GridRegion(); r3.RegionName = "Test Region 3"; @@ -96,6 +103,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests r3.ExternalHostName = "127.0.0.1"; r3.HttpPort = 9003; r3.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); + s = new Scene(new RegionInfo()); + s.RegionInfo.RegionID = r1.RegionID; + m_LocalConnector.AddRegion(s); m_LocalConnector.RegisterRegion(UUID.Zero, r1); GridRegion result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test"); -- cgit v1.1