diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 86815e53e5..a500593855 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -46,10 +46,18 @@ namespace OpenSim.Services.GridService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + protected bool m_AllowDuplicateNames = false; + public GridService(IConfigSource config) : base(config) { m_log.DebugFormat("[GRID SERVICE]: Starting..."); + + IConfig gridConfig = config.Configs["GridService"]; + if (gridConfig != null) + { + m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); + } } #region IGridService @@ -82,6 +90,23 @@ namespace OpenSim.Services.GridService } } + if (!m_AllowDuplicateNames) + { + List dupe = m_Database.Get(regionInfos.RegionName, scopeID); + if (dupe != null && dupe.Count > 0) + { + foreach (RegionData d in dupe) + { + if (d.RegionID != regionInfos.RegionID) + { + m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", + regionInfos.RegionName, regionInfos.RegionID); + return false; + } + } + } + } + // Everything is ok, let's register RegionData rdata = RegionInfo2RegionData(regionInfos); rdata.ScopeID = scopeID; diff --git a/bin/OpenSim.Server.ini.example b/bin/OpenSim.Server.ini.example index 12af0cd2c4..d4e05af5d0 100644 --- a/bin/OpenSim.Server.ini.example +++ b/bin/OpenSim.Server.ini.example @@ -80,3 +80,4 @@ LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData" ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=grid;" Realm = "regions" +; AllowDuplicateNames = "True"