Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix a bug where regions could potentially overlap in some situations.

  • Loading branch information...
commit ea7b8fe3095a76cb301825bdc1e88a2bd884799a 1 parent 8e9fa03
Revolution Smythe authored
Showing with 23 additions and 14 deletions.
  1. +23 −14 OpenSim/Services/GridService/GridService.cs
View
37 OpenSim/Services/GridService/GridService.cs
@@ -327,41 +327,50 @@ public virtual multipleMapItemReply GetMapItems(ulong regionHandle, GridItemType
}
[CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.None)]
- public virtual RegisterRegion RegisterRegion(GridRegion regionInfos, UUID oldSessionID)
+ public virtual RegisterRegion RegisterRegion (GridRegion regionInfos, UUID oldSessionID)
{
- RegisterRegion rr = new RegisterRegion();
- object remoteValue = DoRemoteByURL("RegistrationURI", regionInfos, oldSessionID);
- if (remoteValue != null || m_doRemoteOnly)
- {
+ RegisterRegion rr = new RegisterRegion ();
+ object remoteValue = DoRemoteByURL ("RegistrationURI", regionInfos, oldSessionID);
+ if (remoteValue != null || m_doRemoteOnly) {
rr = (RegisterRegion)remoteValue;
if (rr != null)
- m_registry.RequestModuleInterface<IConfigurationService>().AddNewUrls(regionInfos.RegionHandle.ToString(), rr.Urls);
+ m_registry.RequestModuleInterface<IConfigurationService> ().AddNewUrls (
+ regionInfos.RegionHandle.ToString (),
+ rr.Urls
+ );
else
- rr = new RegisterRegion() { Error = "Could not reach grid service." };
+ rr = new RegisterRegion () { Error = "Could not reach grid service." };
return rr;
}
if (m_DisableRegistrations)
- return new RegisterRegion() { Error = "Registrations are disabled." };
+ return new RegisterRegion () { Error = "Registrations are disabled." };
UUID NeedToDeletePreviousRegion = UUID.Zero;
- IConfig gridConfig = m_config.Configs["GridService"];
+ IConfig gridConfig = m_config.Configs ["GridService"];
//Get the range of this so that we get the full count and make sure that we are not overlapping smaller regions
- List<GridRegion> regions = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY,
+ List<GridRegion> regions = m_Database.Get (regionInfos.RegionLocX - GetMaxRegionSize (), regionInfos.RegionLocY - GetMaxRegionSize (),
regionInfos.RegionLocX + regionInfos.RegionSizeX - 1,
regionInfos.RegionLocY + regionInfos.RegionSizeY - 1,
regionInfos.ScopeID);
- if (regions.Count > 1)
+ foreach (GridRegion r in regions)
{
- //More than one region is here... it is overlapping stuff
- MainConsole.Instance.WarnFormat(
+ if ((r.RegionLocX >= regionInfos.RegionLocX ||
+ r.RegionLocX < regionInfos.RegionLocX + regionInfos.RegionSizeX) &&
+ (r.RegionLocY >= regionInfos.RegionLocY ||
+ r.RegionLocY < regionInfos.RegionLocY + regionInfos.RegionSizeY) &&
+ !r.RegionID == regionInfos.RegionID)
+ {
+ //More than one region is here... it is overlapping stuff
+ MainConsole.Instance.WarnFormat (
"[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.",
regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, regionInfos.ScopeID);
- return new RegisterRegion() { Error = "Region overlaps another region" };
+ return new RegisterRegion () { Error = "Region overlaps another region" };
+ }
}
GridRegion region = m_Database.Get(regionInfos.RegionID, UUID.Zero);
Please sign in to comment.
Something went wrong with that request. Please try again.