diff options
author | Diva Canto | 2010-09-04 16:39:03 -0700 |
---|---|---|
committer | Diva Canto | 2010-09-04 16:39:03 -0700 |
commit | 9fd98368416ce9514e0926301a1fc20648d9ad59 (patch) | |
tree | 1d548f5311c51ad3dc5095232e87a45ef71c98b0 /OpenSim/Services/Connectors/Hypergrid | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-9fd98368416ce9514e0926301a1fc20648d9ad59.zip opensim-SC-9fd98368416ce9514e0926301a1fc20648d9ad59.tar.gz opensim-SC-9fd98368416ce9514e0926301a1fc20648d9ad59.tar.bz2 opensim-SC-9fd98368416ce9514e0926301a1fc20648d9ad59.tar.xz |
Make User Agent Service and Login Service separable.
Diffstat (limited to 'OpenSim/Services/Connectors/Hypergrid')
-rw-r--r-- | OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | 42 |
1 files changed, 32 insertions, 10 deletions
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 | |||
70 | 70 | ||
71 | public UserAgentServiceConnector(IConfigSource config) | 71 | public UserAgentServiceConnector(IConfigSource config) |
72 | { | 72 | { |
73 | } | 73 | IConfig serviceConfig = config.Configs["UserAgentService"]; |
74 | if (serviceConfig == null) | ||
75 | { | ||
76 | m_log.Error("[USER AGENT CONNECTOR]: UserAgentService missing from ini"); | ||
77 | throw new Exception("UserAgent connector init error"); | ||
78 | } | ||
74 | 79 | ||
75 | public bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint ipaddress, out string reason) | 80 | string serviceURI = serviceConfig.GetString("UserAgentServerURI", |
76 | { | 81 | String.Empty); |
77 | // not available over remote calls | 82 | |
78 | reason = "Method not available over remote calls"; | 83 | if (serviceURI == String.Empty) |
79 | return false; | 84 | { |
85 | m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService"); | ||
86 | throw new Exception("UserAgent connector init error"); | ||
87 | } | ||
88 | m_ServerURL = serviceURI; | ||
89 | |||
90 | m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); | ||
80 | } | 91 | } |
81 | 92 | ||
82 | public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) | 93 | |
94 | // The Login service calls this interface with a non-null [client] ipaddress | ||
95 | public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress, out string reason) | ||
83 | { | 96 | { |
84 | reason = String.Empty; | 97 | reason = String.Empty; |
85 | 98 | ||
@@ -90,7 +103,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
90 | return false; | 103 | return false; |
91 | } | 104 | } |
92 | 105 | ||
93 | string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/"; | 106 | string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/"; |
94 | 107 | ||
95 | Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri); | 108 | Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri); |
96 | 109 | ||
@@ -102,7 +115,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
102 | //AgentCreateRequest.Headers.Add("Authorization", authKey); | 115 | //AgentCreateRequest.Headers.Add("Authorization", authKey); |
103 | 116 | ||
104 | // Fill it in | 117 | // Fill it in |
105 | OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination); | 118 | OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination, ipaddress); |
106 | 119 | ||
107 | string strBuffer = ""; | 120 | string strBuffer = ""; |
108 | byte[] buffer = new byte[1]; | 121 | byte[] buffer = new byte[1]; |
@@ -199,7 +212,14 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
199 | 212 | ||
200 | } | 213 | } |
201 | 214 | ||
202 | protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination) | 215 | |
216 | // The simulators call this interface | ||
217 | public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) | ||
218 | { | ||
219 | return LoginAgentToGrid(aCircuit, gatekeeper, destination, null, out reason); | ||
220 | } | ||
221 | |||
222 | protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress) | ||
203 | { | 223 | { |
204 | OSDMap args = null; | 224 | OSDMap args = null; |
205 | try | 225 | try |
@@ -217,6 +237,8 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
217 | args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); | 237 | args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); |
218 | args["destination_name"] = OSD.FromString(destination.RegionName); | 238 | args["destination_name"] = OSD.FromString(destination.RegionName); |
219 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); | 239 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); |
240 | if (ipaddress != null) | ||
241 | args["client_ip"] = OSD.FromString(ipaddress.Address.ToString()); | ||
220 | 242 | ||
221 | return args; | 243 | return args; |
222 | } | 244 | } |