Moved all HG1 operations to HGGridConnector.cs and HypergridServerConnector.cs/HypergridServiceConnector.cs, away from Region.Communications and HGNetworkServersInfo.

Fixed small bugs with hyperlinked regions' map positions.
This commit is contained in:
Diva Canto
2009-09-26 21:00:51 -07:00
parent dcfd08b8dd
commit f4bf581b96
14 changed files with 538 additions and 101 deletions

View File

@@ -149,5 +149,94 @@ namespace OpenSim.Services.Connectors.Grid
}
}
public bool InformRegionOfUser(GridRegion regInfo, AgentCircuitData agentData, GridRegion home, string userServer, string assetServer, string inventoryServer)
{
string capsPath = agentData.CapsPath;
Hashtable loginParams = new Hashtable();
loginParams["session_id"] = agentData.SessionID.ToString();
loginParams["firstname"] = agentData.firstname;
loginParams["lastname"] = agentData.lastname;
loginParams["agent_id"] = agentData.AgentID.ToString();
loginParams["circuit_code"] = agentData.circuitcode.ToString();
loginParams["startpos_x"] = agentData.startpos.X.ToString();
loginParams["startpos_y"] = agentData.startpos.Y.ToString();
loginParams["startpos_z"] = agentData.startpos.Z.ToString();
loginParams["caps_path"] = capsPath;
if (home != null)
{
loginParams["region_uuid"] = home.RegionID.ToString();
loginParams["regionhandle"] = home.RegionHandle.ToString();
loginParams["home_address"] = home.ExternalHostName;
loginParams["home_port"] = home.HttpPort.ToString();
loginParams["internal_port"] = home.InternalEndPoint.Port.ToString();
m_log.Debug(" --------- Home -------");
m_log.Debug(" >> " + loginParams["home_address"] + " <<");
m_log.Debug(" >> " + loginParams["region_uuid"] + " <<");
m_log.Debug(" >> " + loginParams["regionhandle"] + " <<");
m_log.Debug(" >> " + loginParams["home_port"] + " <<");
m_log.Debug(" --------- ------------ -------");
}
else
m_log.WarnFormat("[HGrid]: Home region not found for {0} {1}", agentData.firstname, agentData.lastname);
loginParams["userserver_id"] = userServer;
loginParams["assetserver_id"] = assetServer;
loginParams["inventoryserver_id"] = inventoryServer;
ArrayList SendParams = new ArrayList();
SendParams.Add(loginParams);
// Send
string uri = "http://" + regInfo.ExternalHostName + ":" + regInfo.HttpPort + "/";
//m_log.Debug("XXX uri: " + uri);
XmlRpcRequest request = new XmlRpcRequest("expect_hg_user", SendParams);
XmlRpcResponse reply;
try
{
reply = request.Send(uri, 6000);
}
catch (Exception e)
{
m_log.Warn("[HGrid]: Failed to notify region about user. Reason: " + e.Message);
return false;
}
if (!reply.IsFault)
{
bool responseSuccess = true;
if (reply.Value != null)
{
Hashtable resp = (Hashtable)reply.Value;
if (resp.ContainsKey("success"))
{
if ((string)resp["success"] == "FALSE")
{
responseSuccess = false;
}
}
}
if (responseSuccess)
{
m_log.Info("[HGrid]: Successfully informed remote region about user " + agentData.AgentID);
return true;
}
else
{
m_log.ErrorFormat("[HGrid]: Region responded that it is not available to receive clients");
return false;
}
}
else
{
m_log.ErrorFormat("[HGrid]: XmlRpc request to region failed with message {0}, code {1} ", reply.FaultString, reply.FaultCode);
return false;
}
}
}
}

View File

@@ -191,6 +191,20 @@ namespace OpenSim.Services.Interfaces
Maturity = ConvertFrom.RegionSettings.Maturity;
}
public GridRegion(GridRegion ConvertFrom)
{
m_regionName = ConvertFrom.RegionName;
m_regionLocX = ConvertFrom.RegionLocX;
m_regionLocY = ConvertFrom.RegionLocY;
m_internalEndPoint = ConvertFrom.InternalEndPoint;
m_externalHostName = ConvertFrom.ExternalHostName;
m_httpPort = ConvertFrom.HttpPort;
RegionID = ConvertFrom.RegionID;
ServerURI = ConvertFrom.ServerURI;
TerrainImage = ConvertFrom.TerrainImage;
Access = ConvertFrom.Access;
Maturity = ConvertFrom.Maturity;
}
/// <value>
/// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.