Added code to gridserver to prevent new region from connecting at X,Y location already used by an existing region.

afrisby
Brian McBee 2008-01-06 19:59:58 +00:00
parent b8efd5f294
commit 9985d53681
1 changed files with 136 additions and 120 deletions

View File

@ -228,6 +228,8 @@ namespace OpenSim.Grid.GridServer
response.Value = responseData;
RegionProfileData TheSim = null;
RegionProfileData OldSim = null;
Hashtable requestData = (Hashtable)request.Params[0];
string myword;
if (requestData.ContainsKey("UUID"))
@ -281,14 +283,19 @@ namespace OpenSim.Grid.GridServer
TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " +
TheSim.serverURI);
TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/";
TheSim.regionName = (string)requestData["sim_name"];
TheSim.UUID = new LLUUID((string)requestData["UUID"]);
//make sure there is not an existing region at this location
OldSim = getRegion(TheSim.regionHandle);
if (OldSim == null || OldSim.UUID == TheSim.UUID)
{
Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " +
TheSim.serverURI);
foreach (KeyValuePair<string, IGridData> kvp in _plugins)
{
try
@ -329,6 +336,7 @@ namespace OpenSim.Grid.GridServer
}
ArrayList SimNeighboursData = new ArrayList();
RegionProfileData neighbour;
@ -408,6 +416,14 @@ namespace OpenSim.Grid.GridServer
return response;
}
else
{
MainLog.Instance.Warn("grid", "Failed to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName);
responseData["error"] = "Another region already exists at that location. Try another";
return response;
}
}
public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)