Added code to gridserver to prevent new region from connecting at X,Y location already used by an existing region.
parent
b8efd5f294
commit
9985d53681
|
@ -228,18 +228,20 @@ namespace OpenSim.Grid.GridServer
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
|
|
||||||
RegionProfileData TheSim = null;
|
RegionProfileData TheSim = null;
|
||||||
Hashtable requestData = (Hashtable) request.Params[0];
|
RegionProfileData OldSim = null;
|
||||||
|
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
string myword;
|
string myword;
|
||||||
if (requestData.ContainsKey("UUID"))
|
if (requestData.ContainsKey("UUID"))
|
||||||
{
|
{
|
||||||
TheSim = getRegion(new LLUUID((string) requestData["UUID"]));
|
TheSim = getRegion(new LLUUID((string)requestData["UUID"]));
|
||||||
|
|
||||||
// logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID.");
|
// logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID.");
|
||||||
}
|
}
|
||||||
else if (requestData.ContainsKey("region_handle"))
|
else if (requestData.ContainsKey("region_handle"))
|
||||||
{
|
{
|
||||||
// TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"]));
|
// TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"]));
|
||||||
// logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle.");
|
// logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -270,25 +272,30 @@ namespace OpenSim.Grid.GridServer
|
||||||
TheSim.regionUserSendKey = config.UserSendKey;
|
TheSim.regionUserSendKey = config.UserSendKey;
|
||||||
TheSim.regionUserRecvKey = config.UserRecvKey;
|
TheSim.regionUserRecvKey = config.UserRecvKey;
|
||||||
|
|
||||||
TheSim.serverIP = (string) requestData["sim_ip"];
|
TheSim.serverIP = (string)requestData["sim_ip"];
|
||||||
TheSim.serverPort = Convert.ToUInt32((string) requestData["sim_port"]);
|
TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
|
||||||
TheSim.httpPort = Convert.ToUInt32((string) requestData["http_port"]);
|
TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
|
||||||
TheSim.remotingPort = Convert.ToUInt32((string) requestData["remoting_port"]);
|
TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
|
||||||
TheSim.regionLocX = Convert.ToUInt32((string) requestData["region_locx"]);
|
TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
|
||||||
TheSim.regionLocY = Convert.ToUInt32((string) requestData["region_locy"]);
|
TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
|
||||||
TheSim.regionLocZ = 0;
|
TheSim.regionLocZ = 0;
|
||||||
TheSim.regionMapTextureID = new LLUUID((string) requestData["map-image-id"]);
|
TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]);
|
||||||
|
|
||||||
TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256));
|
TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
|
||||||
TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
|
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.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/";
|
||||||
|
|
||||||
|
|
||||||
TheSim.regionName = (string) requestData["sim_name"];
|
TheSim.regionName = (string)requestData["sim_name"];
|
||||||
TheSim.UUID = new LLUUID((string) requestData["UUID"]);
|
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)
|
foreach (KeyValuePair<string, IGridData> kvp in _plugins)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -329,6 +336,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ArrayList SimNeighboursData = new ArrayList();
|
ArrayList SimNeighboursData = new ArrayList();
|
||||||
|
|
||||||
RegionProfileData neighbour;
|
RegionProfileData neighbour;
|
||||||
|
@ -363,13 +371,13 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
getRegion(
|
getRegion(
|
||||||
Helpers.UIntsToLong((uint) ((TheSim.regionLocX + x)*256),
|
Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256),
|
||||||
(uint) (TheSim.regionLocY + y)*256)) != null)
|
(uint)(TheSim.regionLocY + y) * 256)) != null)
|
||||||
{
|
{
|
||||||
neighbour =
|
neighbour =
|
||||||
getRegion(
|
getRegion(
|
||||||
Helpers.UIntsToLong((uint) ((TheSim.regionLocX + x)*256),
|
Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256),
|
||||||
(uint) (TheSim.regionLocY + y)*256));
|
(uint)(TheSim.regionLocY + y) * 256));
|
||||||
|
|
||||||
NeighbourBlock = new Hashtable();
|
NeighbourBlock = new Hashtable();
|
||||||
NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString();
|
NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString();
|
||||||
|
@ -408,6 +416,14 @@ namespace OpenSim.Grid.GridServer
|
||||||
|
|
||||||
|
|
||||||
return response;
|
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)
|
public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
|
||||||
|
|
Loading…
Reference in New Issue