Make User Agent Service and Login Service separable.

This commit is contained in:
Diva Canto
2010-09-04 16:39:03 -07:00
parent c0b16f09bf
commit 9fd9836841
6 changed files with 81 additions and 32 deletions

View File

@@ -70,16 +70,29 @@ namespace OpenSim.Services.Connectors.Hypergrid
public UserAgentServiceConnector(IConfigSource config)
{
IConfig serviceConfig = config.Configs["UserAgentService"];
if (serviceConfig == null)
{
m_log.Error("[USER AGENT CONNECTOR]: UserAgentService missing from ini");
throw new Exception("UserAgent connector init error");
}
string serviceURI = serviceConfig.GetString("UserAgentServerURI",
String.Empty);
if (serviceURI == String.Empty)
{
m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService");
throw new Exception("UserAgent connector init error");
}
m_ServerURL = serviceURI;
m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL);
}
public bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint ipaddress, out string reason)
{
// not available over remote calls
reason = "Method not available over remote calls";
return false;
}
public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
// The Login service calls this interface with a non-null [client] ipaddress
public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress, out string reason)
{
reason = String.Empty;
@@ -90,7 +103,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
return false;
}
string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/";
string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/";
Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri);
@@ -102,7 +115,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
//AgentCreateRequest.Headers.Add("Authorization", authKey);
// Fill it in
OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination);
OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination, ipaddress);
string strBuffer = "";
byte[] buffer = new byte[1];
@@ -199,7 +212,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
}
protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination)
// The simulators call this interface
public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
{
return LoginAgentToGrid(aCircuit, gatekeeper, destination, null, out reason);
}
protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress)
{
OSDMap args = null;
try
@@ -217,6 +237,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
args["destination_name"] = OSD.FromString(destination.RegionName);
args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
if (ipaddress != null)
args["client_ip"] = OSD.FromString(ipaddress.Address.ToString());
return args;
}