From 9fd98368416ce9514e0926301a1fc20648d9ad59 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 4 Sep 2010 16:39:03 -0700 Subject: Make User Agent Service and Login Service separable. --- .../Hypergrid/UserAgentServiceConnector.cs | 42 ++++++++++++++++------ 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 7fa086a..5d29087 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -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"); + } - 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; + 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 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; } -- cgit v1.1