aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs')
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 6f159a0..cabee4c 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -38,6 +38,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
38 38
39using OpenMetaverse; 39using OpenMetaverse;
40using OpenMetaverse.Imaging; 40using OpenMetaverse.Imaging;
41using OpenMetaverse.StructuredData;
41using Nwc.XmlRpc; 42using Nwc.XmlRpc;
42using log4net; 43using log4net;
43 44
@@ -278,5 +279,48 @@ namespace OpenSim.Services.Connectors.Hypergrid
278 return null; 279 return null;
279 } 280 }
280 281
282 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason)
283 {
284 HttpWebRequest AgentCreateRequest = null;
285 myipaddress = String.Empty;
286 reason = String.Empty;
287
288 if (SendRequest(destination, aCircuit, flags, out reason, out AgentCreateRequest))
289 {
290 string response = GetResponse(AgentCreateRequest, out reason);
291 bool success = true;
292 UnpackResponse(response, out success, out reason, out myipaddress);
293 return success;
294 }
295
296 return false;
297 }
298
299 protected void UnpackResponse(string response, out bool result, out string reason, out string ipaddress)
300 {
301 result = true;
302 reason = string.Empty;
303 ipaddress = string.Empty;
304
305 if (!String.IsNullOrEmpty(response))
306 {
307 try
308 {
309 // we assume we got an OSDMap back
310 OSDMap r = Util.GetOSDMap(response);
311 result = r["success"].AsBoolean();
312 reason = r["reason"].AsString();
313 ipaddress = r["your_ip"].AsString();
314 }
315 catch (NullReferenceException e)
316 {
317 m_log.InfoFormat("[GATEKEEPER SERVICE CONNECTOR]: exception on UnpackResponse of DoCreateChildAgentCall {0}", e.Message);
318 reason = "Internal error";
319 result = false;
320 }
321 }
322 }
323
324
281 } 325 }
282} 326}