diff options
Diffstat (limited to 'OpenSim/Services/GridService/GridService.cs')
-rw-r--r-- | OpenSim/Services/GridService/GridService.cs | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 86815e5..7749c37 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -46,15 +46,23 @@ namespace OpenSim.Services.GridService | |||
46 | LogManager.GetLogger( | 46 | LogManager.GetLogger( |
47 | MethodBase.GetCurrentMethod().DeclaringType); | 47 | MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | protected bool m_AllowDuplicateNames = false; | ||
50 | |||
49 | public GridService(IConfigSource config) | 51 | public GridService(IConfigSource config) |
50 | : base(config) | 52 | : base(config) |
51 | { | 53 | { |
52 | m_log.DebugFormat("[GRID SERVICE]: Starting..."); | 54 | m_log.DebugFormat("[GRID SERVICE]: Starting..."); |
55 | |||
56 | IConfig gridConfig = config.Configs["GridService"]; | ||
57 | if (gridConfig != null) | ||
58 | { | ||
59 | m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); | ||
60 | } | ||
53 | } | 61 | } |
54 | 62 | ||
55 | #region IGridService | 63 | #region IGridService |
56 | 64 | ||
57 | public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) | 65 | public string RegisterRegion(UUID scopeID, GridRegion regionInfos) |
58 | { | 66 | { |
59 | // This needs better sanity testing. What if regionInfo is registering in | 67 | // This needs better sanity testing. What if regionInfo is registering in |
60 | // overlapping coords? | 68 | // overlapping coords? |
@@ -63,7 +71,7 @@ namespace OpenSim.Services.GridService | |||
63 | { | 71 | { |
64 | m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", | 72 | m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", |
65 | regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); | 73 | regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); |
66 | return false; | 74 | return "Region overlaps another region"; |
67 | } | 75 | } |
68 | if ((region != null) && (region.RegionID == regionInfos.RegionID) && | 76 | if ((region != null) && (region.RegionID == regionInfos.RegionID) && |
69 | ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) | 77 | ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) |
@@ -82,6 +90,23 @@ namespace OpenSim.Services.GridService | |||
82 | } | 90 | } |
83 | } | 91 | } |
84 | 92 | ||
93 | if (!m_AllowDuplicateNames) | ||
94 | { | ||
95 | List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID); | ||
96 | if (dupe != null && dupe.Count > 0) | ||
97 | { | ||
98 | foreach (RegionData d in dupe) | ||
99 | { | ||
100 | if (d.RegionID != regionInfos.RegionID) | ||
101 | { | ||
102 | m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", | ||
103 | regionInfos.RegionName, regionInfos.RegionID); | ||
104 | return "Duplicate region name"; | ||
105 | } | ||
106 | } | ||
107 | } | ||
108 | } | ||
109 | |||
85 | // Everything is ok, let's register | 110 | // Everything is ok, let's register |
86 | RegionData rdata = RegionInfo2RegionData(regionInfos); | 111 | RegionData rdata = RegionInfo2RegionData(regionInfos); |
87 | rdata.ScopeID = scopeID; | 112 | rdata.ScopeID = scopeID; |
@@ -97,7 +122,7 @@ namespace OpenSim.Services.GridService | |||
97 | m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}", | 122 | m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}", |
98 | regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); | 123 | regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); |
99 | 124 | ||
100 | return true; | 125 | return String.Empty; |
101 | } | 126 | } |
102 | 127 | ||
103 | public bool DeregisterRegion(UUID regionID) | 128 | public bool DeregisterRegion(UUID regionID) |