* minor refactoring
parent
8194a83f54
commit
da854b9691
|
@ -234,17 +234,15 @@ namespace OpenSim.Grid.GridServer
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
|
|
||||||
RegionProfileData TheSim = null;
|
RegionProfileData sim;
|
||||||
RegionProfileData OldSim = null;
|
RegionProfileData existingSim;
|
||||||
|
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
string myword;
|
string myword;
|
||||||
LLUUID uuid;
|
LLUUID uuid;
|
||||||
if (requestData.ContainsKey("UUID") && LLUUID.TryParse((string)requestData["UUID"], out uuid))
|
if (requestData.ContainsKey("UUID") && LLUUID.TryParse((string)requestData["UUID"], out uuid))
|
||||||
{
|
{
|
||||||
TheSim = getRegion(uuid);
|
sim = getRegion(uuid);
|
||||||
|
|
||||||
// logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcSimulatorLoginMethod",String.Empty, 5,"Region attempting login with UUID.");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -253,7 +251,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TheSim == null) // Shouldnt this be in the REST Simulator Set method?
|
if (sim == null) // Shouldnt this be in the REST Simulator Set method?
|
||||||
{
|
{
|
||||||
m_log.Info("[GRID]: New region connecting");
|
m_log.Info("[GRID]: New region connecting");
|
||||||
myword = "creation";
|
myword = "creation";
|
||||||
|
@ -263,28 +261,28 @@ namespace OpenSim.Grid.GridServer
|
||||||
myword = "connection";
|
myword = "connection";
|
||||||
}
|
}
|
||||||
|
|
||||||
TheSim = new RegionProfileData();
|
sim = new RegionProfileData();
|
||||||
|
|
||||||
TheSim.regionRecvKey = String.Empty;
|
sim.regionRecvKey = String.Empty;
|
||||||
TheSim.regionSendKey = String.Empty;
|
sim.regionSendKey = String.Empty;
|
||||||
TheSim.regionSecret = config.SimRecvKey;
|
sim.regionSecret = config.SimRecvKey;
|
||||||
TheSim.regionDataURI = String.Empty;
|
sim.regionDataURI = String.Empty;
|
||||||
TheSim.regionAssetURI = config.DefaultAssetServer;
|
sim.regionAssetURI = config.DefaultAssetServer;
|
||||||
TheSim.regionAssetRecvKey = config.AssetRecvKey;
|
sim.regionAssetRecvKey = config.AssetRecvKey;
|
||||||
TheSim.regionAssetSendKey = config.AssetSendKey;
|
sim.regionAssetSendKey = config.AssetSendKey;
|
||||||
TheSim.regionUserURI = config.DefaultUserServer;
|
sim.regionUserURI = config.DefaultUserServer;
|
||||||
TheSim.regionUserSendKey = config.UserSendKey;
|
sim.regionUserSendKey = config.UserSendKey;
|
||||||
TheSim.regionUserRecvKey = config.UserRecvKey;
|
sim.regionUserRecvKey = config.UserRecvKey;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TheSim.serverIP = (string)requestData["sim_ip"];
|
sim.serverIP = (string)requestData["sim_ip"];
|
||||||
TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
|
sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]);
|
||||||
TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
|
sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]);
|
||||||
TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
|
sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]);
|
||||||
TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
|
sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]);
|
||||||
TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
|
sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]);
|
||||||
TheSim.regionLocZ = 0;
|
sim.regionLocZ = 0;
|
||||||
}
|
}
|
||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
|
@ -294,7 +292,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
LLUUID textureID = LLUUID.Zero;
|
LLUUID textureID = LLUUID.Zero;
|
||||||
if (LLUUID.TryParse((string)requestData["map-image-id"], out textureID))
|
if (LLUUID.TryParse((string)requestData["map-image-id"], out textureID))
|
||||||
TheSim.regionMapTextureID = textureID;
|
sim.regionMapTextureID = textureID;
|
||||||
|
|
||||||
// part of an initial brutish effort to provide accurate information (as per the xml region spec)
|
// part of an initial brutish effort to provide accurate information (as per the xml region spec)
|
||||||
// wrt the ownership of a given region
|
// wrt the ownership of a given region
|
||||||
|
@ -304,48 +302,48 @@ namespace OpenSim.Grid.GridServer
|
||||||
//
|
//
|
||||||
// this particular section of the mod attempts to receive a value from the region's xml file by way of
|
// this particular section of the mod attempts to receive a value from the region's xml file by way of
|
||||||
// OSG1GridServices for the region's owner
|
// OSG1GridServices for the region's owner
|
||||||
TheSim.owner_uuid = (string)requestData["master_avatar_uuid"];
|
sim.owner_uuid = (string)requestData["master_avatar_uuid"];
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TheSim.regionRecvKey = (string)requestData["recvkey"];
|
sim.regionRecvKey = (string)requestData["recvkey"];
|
||||||
TheSim.regionSendKey = (string)requestData["authkey"];
|
sim.regionSendKey = (string)requestData["authkey"];
|
||||||
}
|
}
|
||||||
catch (KeyNotFoundException) { }
|
catch (KeyNotFoundException) { }
|
||||||
|
|
||||||
TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize));
|
sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize));
|
||||||
TheSim.serverURI = (string)requestData["server_uri"];
|
sim.serverURI = (string)requestData["server_uri"];
|
||||||
Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " +
|
Console.WriteLine("adding region " + sim.regionLocX + " , " + sim.regionLocY + " , " +
|
||||||
TheSim.serverURI);
|
sim.serverURI);
|
||||||
|
|
||||||
TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/";
|
sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/";
|
||||||
|
|
||||||
TheSim.regionName = (string)requestData["sim_name"];
|
sim.regionName = (string)requestData["sim_name"];
|
||||||
TheSim.UUID = new LLUUID((string)requestData["UUID"]);
|
sim.UUID = new LLUUID((string)requestData["UUID"]);
|
||||||
TheSim.originUUID = new LLUUID((string) requestData["originUUID"]);
|
sim.originUUID = new LLUUID((string) requestData["originUUID"]);
|
||||||
|
|
||||||
//make sure there is not an existing region at this location
|
//make sure there is not an existing region at this location
|
||||||
OldSim = getRegion(TheSim.regionHandle);
|
existingSim = getRegion(sim.regionHandle);
|
||||||
//if (OldSim == null || OldSim.UUID == TheSim.UUID)
|
//if (OldSim == null || OldSim.UUID == TheSim.UUID)
|
||||||
if (OldSim == null || OldSim.UUID == TheSim.UUID || TheSim.UUID != TheSim.originUUID)
|
if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID)
|
||||||
{
|
{
|
||||||
bool brandNew = ( OldSim == null && TheSim.regionRecvKey == config.SimSendKey &&
|
bool brandNew = ( existingSim == null && sim.regionRecvKey == config.SimSendKey &&
|
||||||
TheSim.regionSendKey == config.SimRecvKey);
|
sim.regionSendKey == config.SimRecvKey);
|
||||||
|
|
||||||
bool overwritingOldOne = ( OldSim != null && OldSim.regionRecvKey == TheSim.regionRecvKey &&
|
bool overwritingOldOne = ( existingSim != null && existingSim.regionRecvKey == sim.regionRecvKey &&
|
||||||
OldSim.regionSendKey == TheSim.regionSendKey );
|
existingSim.regionSendKey == sim.regionSendKey );
|
||||||
|
|
||||||
if (brandNew)
|
if (brandNew)
|
||||||
{
|
{
|
||||||
m_log.Info("[GRID]: Adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " +
|
m_log.Info("[GRID]: Adding region " + sim.regionLocX + " , " + sim.regionLocY + " , " +
|
||||||
TheSim.serverURI);
|
sim.serverURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overwritingOldOne)
|
if (overwritingOldOne)
|
||||||
{
|
{
|
||||||
m_log.Info("[GRID]: Overwriting region " + OldSim.regionLocX + " , " + OldSim.regionLocY + " , " +
|
m_log.Info("[GRID]: Overwriting region " + existingSim.regionLocX + " , " + existingSim.regionLocY + " , " +
|
||||||
OldSim.serverURI + " with " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " +
|
existingSim.serverURI + " with " + sim.regionLocX + " , " + sim.regionLocY + " , " +
|
||||||
TheSim.serverURI);
|
sim.serverURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (brandNew ||
|
if (brandNew ||
|
||||||
|
@ -356,35 +354,35 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DataResponse insertResponse = kvp.Value.AddProfile(TheSim);
|
DataResponse insertResponse = kvp.Value.AddProfile(sim);
|
||||||
switch (insertResponse)
|
switch (insertResponse)
|
||||||
{
|
{
|
||||||
case DataResponse.RESPONSE_OK:
|
case DataResponse.RESPONSE_OK:
|
||||||
m_log.Info("[grid]: New sim " + myword + " successful: " + TheSim.regionName);
|
m_log.Info("[grid]: New sim " + myword + " successful: " + sim.regionName);
|
||||||
break;
|
break;
|
||||||
case DataResponse.RESPONSE_ERROR:
|
case DataResponse.RESPONSE_ERROR:
|
||||||
m_log.Warn("[storage]: New sim creation failed (Error): " + TheSim.regionName);
|
m_log.Warn("[storage]: New sim creation failed (Error): " + sim.regionName);
|
||||||
break;
|
break;
|
||||||
case DataResponse.RESPONSE_INVALIDCREDENTIALS:
|
case DataResponse.RESPONSE_INVALIDCREDENTIALS:
|
||||||
m_log.Warn("[storage]: " +
|
m_log.Warn("[storage]: " +
|
||||||
"New sim creation failed (Invalid Credentials): " + TheSim.regionName);
|
"New sim creation failed (Invalid Credentials): " + sim.regionName);
|
||||||
break;
|
break;
|
||||||
case DataResponse.RESPONSE_AUTHREQUIRED:
|
case DataResponse.RESPONSE_AUTHREQUIRED:
|
||||||
m_log.Warn("[storage]: " +
|
m_log.Warn("[storage]: " +
|
||||||
"New sim creation failed (Authentication Required): " +
|
"New sim creation failed (Authentication Required): " +
|
||||||
TheSim.regionName);
|
sim.regionName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Warn("[storage]: " +
|
m_log.Warn("[storage]: " +
|
||||||
"Unable to add region " + TheSim.UUID.ToString() + " via " + kvp.Key);
|
"Unable to add region " + sim.UUID.ToString() + " via " + kvp.Key);
|
||||||
m_log.Warn("[storage]: " + e.ToString());
|
m_log.Warn("[storage]: " + e.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (getRegion(TheSim.regionHandle) == null)
|
if (getRegion(sim.regionHandle) == null)
|
||||||
{
|
{
|
||||||
responseData["error"] = "Unable to add new region";
|
responseData["error"] = "Unable to add new region";
|
||||||
return response;
|
return response;
|
||||||
|
@ -403,8 +401,8 @@ namespace OpenSim.Grid.GridServer
|
||||||
if (fastMode)
|
if (fastMode)
|
||||||
{
|
{
|
||||||
Dictionary<ulong, RegionProfileData> neighbours =
|
Dictionary<ulong, RegionProfileData> neighbours =
|
||||||
getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1,
|
getRegions(sim.regionLocX - 1, sim.regionLocY - 1, sim.regionLocX + 1,
|
||||||
TheSim.regionLocY + 1);
|
sim.regionLocY + 1);
|
||||||
|
|
||||||
foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
|
foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours)
|
||||||
{
|
{
|
||||||
|
@ -416,7 +414,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
NeighbourBlock["UUID"] = aSim.Value.UUID.ToString();
|
NeighbourBlock["UUID"] = aSim.Value.UUID.ToString();
|
||||||
NeighbourBlock["regionHandle"] = aSim.Value.regionHandle.ToString();
|
NeighbourBlock["regionHandle"] = aSim.Value.regionHandle.ToString();
|
||||||
|
|
||||||
if (aSim.Value.UUID != TheSim.UUID)
|
if (aSim.Value.UUID != sim.UUID)
|
||||||
{
|
{
|
||||||
SimNeighboursData.Add(NeighbourBlock);
|
SimNeighboursData.Add(NeighbourBlock);
|
||||||
}
|
}
|
||||||
|
@ -429,13 +427,13 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
getRegion(
|
getRegion(
|
||||||
Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * Constants.RegionSize),
|
Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize),
|
||||||
(uint)(TheSim.regionLocY + y) * Constants.RegionSize)) != null)
|
(uint)(sim.regionLocY + y) * Constants.RegionSize)) != null)
|
||||||
{
|
{
|
||||||
neighbour =
|
neighbour =
|
||||||
getRegion(
|
getRegion(
|
||||||
Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * Constants.RegionSize),
|
Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize),
|
||||||
(uint)(TheSim.regionLocY + y) * Constants.RegionSize));
|
(uint)(sim.regionLocY + y) * Constants.RegionSize));
|
||||||
|
|
||||||
NeighbourBlock = new Hashtable();
|
NeighbourBlock = new Hashtable();
|
||||||
NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString();
|
NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString();
|
||||||
|
@ -445,30 +443,30 @@ namespace OpenSim.Grid.GridServer
|
||||||
NeighbourBlock["UUID"] = neighbour.UUID.ToString();
|
NeighbourBlock["UUID"] = neighbour.UUID.ToString();
|
||||||
NeighbourBlock["regionHandle"] = neighbour.regionHandle.ToString();
|
NeighbourBlock["regionHandle"] = neighbour.regionHandle.ToString();
|
||||||
|
|
||||||
if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock);
|
if (neighbour.UUID != sim.UUID) SimNeighboursData.Add(NeighbourBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
responseData["UUID"] = TheSim.UUID.ToString();
|
responseData["UUID"] = sim.UUID.ToString();
|
||||||
responseData["region_locx"] = TheSim.regionLocX.ToString();
|
responseData["region_locx"] = sim.regionLocX.ToString();
|
||||||
responseData["region_locy"] = TheSim.regionLocY.ToString();
|
responseData["region_locy"] = sim.regionLocY.ToString();
|
||||||
responseData["regionname"] = TheSim.regionName;
|
responseData["regionname"] = sim.regionName;
|
||||||
responseData["estate_id"] = "1";
|
responseData["estate_id"] = "1";
|
||||||
responseData["neighbours"] = SimNeighboursData;
|
responseData["neighbours"] = SimNeighboursData;
|
||||||
|
|
||||||
responseData["sim_ip"] = TheSim.serverIP;
|
responseData["sim_ip"] = sim.serverIP;
|
||||||
responseData["sim_port"] = TheSim.serverPort.ToString();
|
responseData["sim_port"] = sim.serverPort.ToString();
|
||||||
responseData["asset_url"] = TheSim.regionAssetURI;
|
responseData["asset_url"] = sim.regionAssetURI;
|
||||||
responseData["asset_sendkey"] = TheSim.regionAssetSendKey;
|
responseData["asset_sendkey"] = sim.regionAssetSendKey;
|
||||||
responseData["asset_recvkey"] = TheSim.regionAssetRecvKey;
|
responseData["asset_recvkey"] = sim.regionAssetRecvKey;
|
||||||
responseData["user_url"] = TheSim.regionUserURI;
|
responseData["user_url"] = sim.regionUserURI;
|
||||||
responseData["user_sendkey"] = TheSim.regionUserSendKey;
|
responseData["user_sendkey"] = sim.regionUserSendKey;
|
||||||
responseData["user_recvkey"] = TheSim.regionUserRecvKey;
|
responseData["user_recvkey"] = sim.regionUserRecvKey;
|
||||||
responseData["authkey"] = TheSim.regionSecret;
|
responseData["authkey"] = sim.regionSecret;
|
||||||
|
|
||||||
// New! If set, use as URL to local sim storage (ie http://remotehost/region.yap)
|
// New! If set, use as URL to local sim storage (ie http://remotehost/region.yap)
|
||||||
responseData["data_uri"] = TheSim.regionDataURI;
|
responseData["data_uri"] = sim.regionDataURI;
|
||||||
|
|
||||||
responseData["allow_forceful_banlines"] = config.AllowForcefulBanlines;
|
responseData["allow_forceful_banlines"] = config.AllowForcefulBanlines;
|
||||||
|
|
||||||
|
@ -490,17 +488,17 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (OldSim == null)
|
if (existingSim == null)
|
||||||
{
|
{
|
||||||
m_log.Warn("[grid]: Authentication failed when trying to add new region " + TheSim.regionName +
|
m_log.Warn("[grid]: Authentication failed when trying to add new region " + sim.regionName +
|
||||||
" at location " + TheSim.regionLocX +
|
" at location " + sim.regionLocX +
|
||||||
" " + TheSim.regionLocY + " with TheSim.regionRecvKey " + TheSim.regionRecvKey + "(" + config.SimSendKey + ") and TheSim.regionRecvKey " + TheSim.regionSendKey + "(" + config.SimRecvKey + ") ");
|
" " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + config.SimSendKey + ") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + config.SimRecvKey + ") ");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Warn("[grid]: Authentication failed when trying to add new region " + TheSim.regionName +
|
m_log.Warn("[grid]: Authentication failed when trying to add new region " + sim.regionName +
|
||||||
" at location " + TheSim.regionLocX +
|
" at location " + sim.regionLocX +
|
||||||
" " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName);
|
" " + sim.regionLocY + " currently occupied by " + existingSim.regionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
responseData["error"] =
|
responseData["error"] =
|
||||||
|
@ -510,7 +508,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Warn("[grid]: Failed to add new region " + TheSim.regionName + " at location " + TheSim.regionLocX + " " + TheSim.regionLocY + " currently occupied by " + OldSim.regionName);
|
m_log.Warn("[grid]: Failed to add new region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + " currently occupied by " + existingSim.regionName);
|
||||||
responseData["error"] = "Another region already exists at that location. Try another";
|
responseData["error"] = "Another region already exists at that location. Try another";
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue