diff options
Diffstat (limited to 'OpenSim/Services')
3 files changed, 80 insertions, 42 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 0e4d794..67a10b0 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | |||
@@ -112,7 +112,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
112 | // m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking"); | 112 | // m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking"); |
113 | 113 | ||
114 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); | 114 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); |
115 | Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); | 115 | Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); |
116 | 116 | ||
117 | OSDMap extraData = new OSDMap | 117 | OSDMap extraData = new OSDMap |
118 | { | 118 | { |
@@ -297,7 +297,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
297 | List<GridRegion> foundRegions = new List<GridRegion>(); | 297 | List<GridRegion> foundRegions = new List<GridRegion>(); |
298 | 298 | ||
299 | Vector3d minPosition = new Vector3d(xmin, ymin, 0.0); | 299 | Vector3d minPosition = new Vector3d(xmin, ymin, 0.0); |
300 | Vector3d maxPosition = new Vector3d(xmax, ymax, 4096.0); | 300 | Vector3d maxPosition = new Vector3d(xmax, ymax, Constants.RegionHeight); |
301 | 301 | ||
302 | NameValueCollection requestArgs = new NameValueCollection | 302 | NameValueCollection requestArgs = new NameValueCollection |
303 | { | 303 | { |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index aab403a..5bdea06 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -137,9 +137,14 @@ namespace OpenSim.Services.GridService | |||
137 | if (regionInfos.RegionID == UUID.Zero) | 137 | if (regionInfos.RegionID == UUID.Zero) |
138 | return "Invalid RegionID - cannot be zero UUID"; | 138 | return "Invalid RegionID - cannot be zero UUID"; |
139 | 139 | ||
140 | // This needs better sanity testing. What if regionInfo is registering in | ||
141 | // overlapping coords? | ||
142 | RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); | 140 | RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); |
141 | if ((region != null) && (region.RegionID != regionInfos.RegionID)) | ||
142 | { | ||
143 | m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", | ||
144 | regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); | ||
145 | return "Region overlaps another region"; | ||
146 | } | ||
147 | |||
143 | if (region != null) | 148 | if (region != null) |
144 | { | 149 | { |
145 | // There is a preexisting record | 150 | // There is a preexisting record |
@@ -176,19 +181,36 @@ namespace OpenSim.Services.GridService | |||
176 | } | 181 | } |
177 | } | 182 | } |
178 | 183 | ||
179 | if ((region != null) && (region.RegionID != regionInfos.RegionID)) | 184 | // If we get here, the destination is clear. Now for the real check. |
185 | |||
186 | if (!m_AllowDuplicateNames) | ||
180 | { | 187 | { |
181 | m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", | 188 | List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID); |
182 | regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); | 189 | if (dupe != null && dupe.Count > 0) |
183 | return "Region overlaps another region"; | 190 | { |
191 | foreach (RegionData d in dupe) | ||
192 | { | ||
193 | if (d.RegionID != regionInfos.RegionID) | ||
194 | { | ||
195 | m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", | ||
196 | regionInfos.RegionName, regionInfos.RegionID); | ||
197 | return "Duplicate region name"; | ||
198 | } | ||
199 | } | ||
200 | } | ||
184 | } | 201 | } |
185 | 202 | ||
203 | // If there is an old record for us, delete it if it is elsewhere. | ||
204 | region = m_Database.Get(regionInfos.RegionID, scopeID); | ||
186 | if ((region != null) && (region.RegionID == regionInfos.RegionID) && | 205 | if ((region != null) && (region.RegionID == regionInfos.RegionID) && |
187 | ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) | 206 | ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) |
188 | { | 207 | { |
189 | if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0) | 208 | if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0) |
190 | return "Can't move this region"; | 209 | return "Can't move this region"; |
191 | 210 | ||
211 | if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) | ||
212 | return "Region locked out"; | ||
213 | |||
192 | // Region reregistering in other coordinates. Delete the old entry | 214 | // Region reregistering in other coordinates. Delete the old entry |
193 | m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", | 215 | m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", |
194 | regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); | 216 | regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); |
@@ -203,23 +225,6 @@ namespace OpenSim.Services.GridService | |||
203 | } | 225 | } |
204 | } | 226 | } |
205 | 227 | ||
206 | if (!m_AllowDuplicateNames) | ||
207 | { | ||
208 | List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID); | ||
209 | if (dupe != null && dupe.Count > 0) | ||
210 | { | ||
211 | foreach (RegionData d in dupe) | ||
212 | { | ||
213 | if (d.RegionID != regionInfos.RegionID) | ||
214 | { | ||
215 | m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", | ||
216 | regionInfos.RegionName, regionInfos.RegionID); | ||
217 | return "Duplicate region name"; | ||
218 | } | ||
219 | } | ||
220 | } | ||
221 | } | ||
222 | |||
223 | // Everything is ok, let's register | 228 | // Everything is ok, let's register |
224 | RegionData rdata = RegionInfo2RegionData(regionInfos); | 229 | RegionData rdata = RegionInfo2RegionData(regionInfos); |
225 | rdata.ScopeID = scopeID; | 230 | rdata.ScopeID = scopeID; |
@@ -227,8 +232,6 @@ namespace OpenSim.Services.GridService | |||
227 | if (region != null) | 232 | if (region != null) |
228 | { | 233 | { |
229 | int oldFlags = Convert.ToInt32(region.Data["flags"]); | 234 | int oldFlags = Convert.ToInt32(region.Data["flags"]); |
230 | if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) | ||
231 | return "Region locked out"; | ||
232 | 235 | ||
233 | oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation; | 236 | oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation; |
234 | 237 | ||
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 7518b86..309dab4 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -94,6 +94,7 @@ namespace OpenSim.Services.InventoryService | |||
94 | 94 | ||
95 | m_Database = LoadPlugin<IXInventoryData>(dllName, | 95 | m_Database = LoadPlugin<IXInventoryData>(dllName, |
96 | new Object[] {connString, String.Empty}); | 96 | new Object[] {connString, String.Empty}); |
97 | |||
97 | if (m_Database == null) | 98 | if (m_Database == null) |
98 | throw new Exception("Could not find a storage interface in the given module"); | 99 | throw new Exception("Could not find a storage interface in the given module"); |
99 | } | 100 | } |
@@ -229,10 +230,28 @@ namespace OpenSim.Services.InventoryService | |||
229 | public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) | 230 | public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) |
230 | { | 231 | { |
231 | // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); | 232 | // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); |
233 | |||
234 | InventoryFolderBase rootFolder = GetRootFolder(principalID); | ||
235 | |||
236 | if (rootFolder == null) | ||
237 | { | ||
238 | m_log.WarnFormat( | ||
239 | "[XINVENTORY]: Found no root folder for {0} in GetFolderForType() when looking for {1}", | ||
240 | principalID, type); | ||
241 | |||
242 | return null; | ||
243 | } | ||
244 | |||
245 | return GetSystemFolderForType(rootFolder, type); | ||
246 | } | ||
247 | |||
248 | private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, AssetType type) | ||
249 | { | ||
250 | // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); | ||
232 | 251 | ||
233 | XInventoryFolder[] folders = m_Database.GetFolders( | 252 | XInventoryFolder[] folders = m_Database.GetFolders( |
234 | new string[] { "agentID", "type"}, | 253 | new string[] { "agentID", "parentFolderID", "type"}, |
235 | new string[] { principalID.ToString(), ((int)type).ToString() }); | 254 | new string[] { rootFolder.Owner.ToString(), rootFolder.ID.ToString(), ((int)type).ToString() }); |
236 | 255 | ||
237 | if (folders.Length == 0) | 256 | if (folders.Length == 0) |
238 | { | 257 | { |
@@ -308,22 +327,38 @@ namespace OpenSim.Services.InventoryService | |||
308 | if (check != null) | 327 | if (check != null) |
309 | return false; | 328 | return false; |
310 | 329 | ||
311 | if (folder.Type == (short)AssetType.Folder | 330 | if (folder.Type != (short)AssetType.Folder && folder.Type != (short)AssetType.Unknown) |
312 | || folder.Type == (short)AssetType.Unknown | ||
313 | || folder.Type == (short)AssetType.OutfitFolder | ||
314 | || GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null) | ||
315 | { | 331 | { |
316 | XInventoryFolder xFolder = ConvertFromOpenSim(folder); | 332 | InventoryFolderBase rootFolder = GetRootFolder(folder.Owner); |
317 | return m_Database.StoreFolder(xFolder); | 333 | |
318 | } | 334 | if (rootFolder == null) |
319 | else | 335 | { |
320 | { | 336 | m_log.WarnFormat( |
321 | m_log.WarnFormat( | 337 | "[XINVENTORY]: Found no root folder for {0} in AddFolder() when looking for {1}", |
322 | "[XINVENTORY]: Folder of type {0} already exists when tried to add {1} to {2} for {3}", | 338 | folder.Owner, folder.Type); |
323 | folder.Type, folder.Name, folder.ParentID, folder.Owner); | 339 | |
340 | return false; | ||
341 | } | ||
342 | |||
343 | // Check we're not trying to add this as a system folder. | ||
344 | if (folder.ParentID == rootFolder.ID) | ||
345 | { | ||
346 | InventoryFolderBase existingSystemFolder | ||
347 | = GetSystemFolderForType(rootFolder, (AssetType)folder.Type); | ||
348 | |||
349 | if (existingSystemFolder != null) | ||
350 | { | ||
351 | m_log.WarnFormat( | ||
352 | "[XINVENTORY]: System folder of type {0} already exists when tried to add {1} to {2} for {3}", | ||
353 | folder.Type, folder.Name, folder.ParentID, folder.Owner); | ||
354 | |||
355 | return false; | ||
356 | } | ||
357 | } | ||
324 | } | 358 | } |
325 | 359 | ||
326 | return false; | 360 | XInventoryFolder xFolder = ConvertFromOpenSim(folder); |
361 | return m_Database.StoreFolder(xFolder); | ||
327 | } | 362 | } |
328 | 363 | ||
329 | public virtual bool UpdateFolder(InventoryFolderBase folder) | 364 | public virtual bool UpdateFolder(InventoryFolderBase folder) |