From 7741143fb5c7c62355170a2f795561d28b9f589f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 10 Aug 2010 11:14:24 -0700 Subject: Enforce DB limits on region name to 32 chars, or else (not good). Removed a piece of code from Hyperlinker that didn't work anyway. Shortened the hyperlink region name. --- OpenSim/Data/MySQL/MySQLRegionData.cs | 3 +++ OpenSim/Services/GridService/HypergridLinker.cs | 25 ++----------------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 878b8e8..baa948e 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -210,6 +210,9 @@ namespace OpenSim.Data.MySQL if (data.Data.ContainsKey("locY")) data.Data.Remove("locY"); + if (data.RegionName.Length > 32) + data.RegionName = data.RegionName.Substring(0, 32); + string[] fields = new List(data.Data.Keys).ToArray(); using (MySqlCommand cmd = new MySqlCommand()) diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index b190f93..3d722ec 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -247,21 +247,8 @@ namespace OpenSim.Services.GridService } regInfo.RegionID = regionID; - Uri uri = null; - try - { - uri = new Uri(externalName); - regInfo.ExternalHostName = uri.Host; - regInfo.HttpPort = (uint)uri.Port; - } - catch - { - m_log.WarnFormat("[HYPERGRID LINKER]: Remote Gatekeeper at {0} provided malformed ExternalName {1}", regInfo.ExternalHostName, externalName); - } - string name = regInfo.RegionName; - regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort; - if (name != string.Empty) - regInfo.RegionName += ":" + name; + if (regInfo.RegionName == string.Empty) + regInfo.RegionName = regInfo.ExternalHostName; // Try get the map image //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); @@ -384,8 +371,6 @@ namespace OpenSim.Services.GridService private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) { - //m_HyperlinkRegions[regionInfo.RegionID] = regionInfo; - //m_HyperlinkHandles[regionInfo.RegionID] = regionHandle; RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; @@ -397,12 +382,6 @@ namespace OpenSim.Services.GridService private void RemoveHyperlinkRegion(UUID regionID) { - //// Try the hyperlink collection - //if (m_HyperlinkRegions.ContainsKey(regionID)) - //{ - // m_HyperlinkRegions.Remove(regionID); - // m_HyperlinkHandles.Remove(regionID); - //} m_Database.Delete(regionID); } -- cgit v1.1 From a299fa4849e41c04afc363f49fe9ed940451be7c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 10 Aug 2010 11:18:39 -0700 Subject: This file wants to be committed --- .../Grid/Tests/GridConnectorsTests.cs | 74 +++++++++++----------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index ebfba2b..e54ee02 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs @@ -57,9 +57,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); - config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion"); - config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion"); - config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion"); + config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion"); + config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion"); + config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion"); config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion"); m_LocalConnector = new LocalGridServicesConnector(config); @@ -128,8 +128,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests Assert.IsNotNull(result, "Retrieved GetRegionByName is null"); Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match"); - m_LocalConnector.RegisterRegion(UUID.Zero, r2); - m_LocalConnector.RegisterRegion(UUID.Zero, r3); + m_LocalConnector.RegisterRegion(UUID.Zero, r2); + m_LocalConnector.RegisterRegion(UUID.Zero, r3); m_LocalConnector.RegisterRegion(UUID.Zero, r4); result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1)); @@ -154,38 +154,38 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null"); Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected"); - results = m_LocalConnector.GetDefaultRegions(UUID.Zero); - Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null"); - Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size"); - Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match"); - - results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY); - Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null"); - Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size"); - Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); - Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); - Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); - - results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY); - Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null"); - Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size"); - Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3"); - Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3"); - Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3"); - - results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY); - Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null"); - Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size"); - Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2"); - Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2"); - Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2"); - - results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY); - Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null"); - Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size"); - Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2"); - Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2"); - Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2"); + results = m_LocalConnector.GetDefaultRegions(UUID.Zero); + Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null"); + Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size"); + Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match"); + + results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY); + Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null"); + Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size"); + Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); + Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); + Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3"); + + results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY); + Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null"); + Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size"); + Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3"); + Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3"); + Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3"); + + results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY); + Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null"); + Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size"); + Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2"); + Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2"); + Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2"); + + results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY); + Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null"); + Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size"); + Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2"); + Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2"); + Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2"); results = m_LocalConnector.GetHyperlinks(UUID.Zero); Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null"); -- cgit v1.1