Better guards on RegisterRegion in GridService.
Added serverPort to the fields that get stored (I think this is the UDP port).remotes/origin/0.6.7-post-fixes
parent
eb0aa6a7f4
commit
52e477b41f
|
@ -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);
|
||||
|
|
|
@ -267,6 +267,7 @@ namespace OpenSim.Services.Interfaces
|
|||
kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString();
|
||||
kvp["serverHttpPort"] = HttpPort.ToString();
|
||||
kvp["serverURI"] = ServerURI;
|
||||
kvp["serverPort"] = InternalEndPoint.Port.ToString();
|
||||
|
||||
return kvp;
|
||||
}
|
||||
|
@ -287,7 +288,7 @@ namespace OpenSim.Services.Interfaces
|
|||
|
||||
if (kvp.ContainsKey("serverIP"))
|
||||
{
|
||||
int port = 0;
|
||||
//int port = 0;
|
||||
//Int32.TryParse((string)kvp["serverPort"], out port);
|
||||
//IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port);
|
||||
ExternalHostName = (string)kvp["serverIP"];
|
||||
|
@ -295,6 +296,13 @@ namespace OpenSim.Services.Interfaces
|
|||
else
|
||||
ExternalHostName = "127.0.0.1";
|
||||
|
||||
if (kvp.ContainsKey("serverPort"))
|
||||
{
|
||||
Int32 port = 0;
|
||||
Int32.TryParse((string)kvp["serverPort"], out port);
|
||||
InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port);
|
||||
}
|
||||
|
||||
if (kvp.ContainsKey("serverHttpPort"))
|
||||
{
|
||||
UInt32 port = 0;
|
||||
|
|
|
@ -137,6 +137,9 @@ namespace OpenSim.Tests.Clients.GridClient
|
|||
else
|
||||
Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
|
||||
|
||||
Console.Write("Proceed to deregister? Press enter...");
|
||||
Console.ReadLine();
|
||||
|
||||
// Deregister them all
|
||||
Console.WriteLine("[GRID CLIENT]: *** Deregistering region 1");
|
||||
success = m_Connector.DeregisterRegion(r1.RegionID);
|
||||
|
@ -166,7 +169,7 @@ namespace OpenSim.Tests.Clients.GridClient
|
|||
region.RegionID = UUID.Random();
|
||||
region.ExternalHostName = "127.0.0.1";
|
||||
region.HttpPort = 9000;
|
||||
region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
|
||||
region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 9000);
|
||||
|
||||
return region;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue