Better guards on RegisterRegion in GridService.

Added serverPort to the fields that get stored (I think this is the UDP port).
This commit is contained in:
Diva Canto
2009-09-25 06:02:41 -07:00
parent eb0aa6a7f4
commit 52e477b41f
3 changed files with 21 additions and 8 deletions

View File

@@ -56,19 +56,21 @@ namespace OpenSim.Services.GridService
public bool RegisterRegion(UUID scopeID, GridRegion regionInfos)
{
if (m_Database.Get(regionInfos.RegionID, scopeID) != null)
{
m_log.WarnFormat("[GRID SERVICE]: Region {0} already registered in scope {1}.", regionInfos.RegionID, scopeID);
return false;
}
// This needs better sanity testing. What if regionInfo is registering in
// overlapping coords?
if (m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID) != null)
RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
if ((region != null) && (region.RegionID != regionInfos.RegionID))
{
m_log.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, scopeID);
return false;
}
if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
{
// Region reregistering in other coordinates. Delete the old entry
m_Database.Delete(regionInfos.RegionID);
}
// Everything is ok, let's register
RegionData rdata = RegionInfo2RegionData(regionInfos);