Add the option to reject duplicate region names
parent
07aaad0d10
commit
7467a471ca
|
@ -46,10 +46,18 @@ namespace OpenSim.Services.GridService
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
protected bool m_AllowDuplicateNames = false;
|
||||||
|
|
||||||
public GridService(IConfigSource config)
|
public GridService(IConfigSource config)
|
||||||
: base(config)
|
: base(config)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[GRID SERVICE]: Starting...");
|
m_log.DebugFormat("[GRID SERVICE]: Starting...");
|
||||||
|
|
||||||
|
IConfig gridConfig = config.Configs["GridService"];
|
||||||
|
if (gridConfig != null)
|
||||||
|
{
|
||||||
|
m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IGridService
|
#region IGridService
|
||||||
|
@ -82,6 +90,23 @@ namespace OpenSim.Services.GridService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_AllowDuplicateNames)
|
||||||
|
{
|
||||||
|
List<RegionData> 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
|
// Everything is ok, let's register
|
||||||
RegionData rdata = RegionInfo2RegionData(regionInfos);
|
RegionData rdata = RegionInfo2RegionData(regionInfos);
|
||||||
rdata.ScopeID = scopeID;
|
rdata.ScopeID = scopeID;
|
||||||
|
|
|
@ -80,3 +80,4 @@ LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
|
||||||
StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData"
|
StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData"
|
||||||
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=grid;"
|
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=grid;"
|
||||||
Realm = "regions"
|
Realm = "regions"
|
||||||
|
; AllowDuplicateNames = "True"
|
||||||
|
|
Loading…
Reference in New Issue