aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Simulation
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Connectors/Simulation')
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs102
1 files changed, 35 insertions, 67 deletions
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index ef2494a..0e74073 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -79,11 +79,27 @@ namespace OpenSim.Services.Connectors.Simulation
79 return "agent/"; 79 return "agent/";
80 } 80 }
81 81
82 protected virtual void PackData(OSDMap args, AgentCircuitData aCircuit, GridRegion destination, uint flags)
83 {
84 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
85 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
86 args["destination_name"] = OSD.FromString(destination.RegionName);
87 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
88 args["teleport_flags"] = OSD.FromString(flags.ToString());
89 }
90
82 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) 91 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
83 { 92 {
84 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateAgent start"); 93 string tmp = String.Empty;
85 94 return CreateAgent(destination, aCircuit, flags, out tmp, out reason);
95 }
96
97 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason)
98 {
99 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI);
86 reason = String.Empty; 100 reason = String.Empty;
101 myipaddress = String.Empty;
102
87 if (destination == null) 103 if (destination == null)
88 { 104 {
89 reason = "Destination not found"; 105 reason = "Destination not found";
@@ -96,12 +112,7 @@ namespace OpenSim.Services.Connectors.Simulation
96 try 112 try
97 { 113 {
98 OSDMap args = aCircuit.PackAgentCircuitData(); 114 OSDMap args = aCircuit.PackAgentCircuitData();
99 115 PackData(args, aCircuit, destination, flags);
100 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
101 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
102 args["destination_name"] = OSD.FromString(destination.RegionName);
103 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
104 args["teleport_flags"] = OSD.FromString(flags.ToString());
105 116
106 OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000); 117 OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000);
107 bool success = result["success"].AsBoolean(); 118 bool success = result["success"].AsBoolean();
@@ -111,6 +122,7 @@ namespace OpenSim.Services.Connectors.Simulation
111 122
112 reason = data["reason"].AsString(); 123 reason = data["reason"].AsString();
113 success = data["success"].AsBoolean(); 124 success = data["success"].AsBoolean();
125 myipaddress = data["your_ip"].AsString();
114 return success; 126 return success;
115 } 127 }
116 128
@@ -125,6 +137,7 @@ namespace OpenSim.Services.Connectors.Simulation
125 137
126 reason = data["reason"].AsString(); 138 reason = data["reason"].AsString();
127 success = data["success"].AsBoolean(); 139 success = data["success"].AsBoolean();
140 myipaddress = data["your_ip"].AsString();
128 m_log.WarnFormat( 141 m_log.WarnFormat(
129 "[REMOTE SIMULATION CONNECTOR]: Remote simulator {0} did not accept compressed transfer, suggest updating it.", destination.RegionName); 142 "[REMOTE SIMULATION CONNECTOR]: Remote simulator {0} did not accept compressed transfer, suggest updating it.", destination.RegionName);
130 return success; 143 return success;
@@ -229,7 +242,7 @@ namespace OpenSim.Services.Connectors.Simulation
229 /// </summary> 242 /// </summary>
230 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData, int timeout) 243 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData, int timeout)
231 { 244 {
232 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent start"); 245 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent in {0}", destination.ServerURI);
233 246
234 // Eventually, we want to use a caps url instead of the agentID 247 // Eventually, we want to use a caps url instead of the agentID
235 string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; 248 string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/";
@@ -259,41 +272,6 @@ namespace OpenSim.Services.Connectors.Simulation
259 return false; 272 return false;
260 } 273 }
261 274
262 /// <summary>
263 /// Not sure what sequence causes this function to be invoked. The only calling
264 /// path is through the GET method
265 /// </summary>
266 public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent)
267 {
268 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: RetrieveAgent start");
269
270 agent = null;
271
272 // Eventually, we want to use a caps url instead of the agentID
273 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
274
275 try
276 {
277 OSDMap result = WebUtil.GetFromService(uri, 10000);
278 if (result["Success"].AsBoolean())
279 {
280 // OSDMap args = Util.GetOSDMap(result["_RawResult"].AsString());
281 OSDMap args = (OSDMap)result["_Result"];
282 if (args != null)
283 {
284 agent = new CompleteAgentData();
285 agent.Unpack(args, null);
286 return true;
287 }
288 }
289 }
290 catch (Exception e)
291 {
292 m_log.Warn("[REMOTE SIMULATION CONNECTOR]: UpdateAgent failed with exception: " + e.ToString());
293 }
294
295 return false;
296 }
297 275
298 /// <summary> 276 /// <summary>
299 /// </summary> 277 /// </summary>
@@ -392,35 +370,25 @@ namespace OpenSim.Services.Connectors.Simulation
392 return true; 370 return true;
393 } 371 }
394 372
395 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) 373 /// <summary>
374 /// </summary>
375 public bool CloseAgent(GridRegion destination, UUID id, string auth_code)
396 { 376 {
397// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); 377 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/?auth=" + auth_code;
398 Util.FireAndForget(x => { 378 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent {0}", uri);
399 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
400 379
401 try 380 try
402 { 381 {
403 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); 382 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false);
404 } 383 }
405 catch (Exception e) 384 catch (Exception e)
406 { 385 {
407 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}",e.ToString()); 386 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}",e.ToString());
408 } 387 }
409 });
410 388
411 return true; 389 return true;
412 } 390 }
413 391
414 public bool CloseChildAgent(GridRegion destination, UUID id)
415 {
416 return CloseAgent(destination, id, true);
417 }
418
419 public bool CloseAgent(GridRegion destination, UUID id)
420 {
421 return CloseAgent(destination, id, false);
422 }
423
424 #endregion Agents 392 #endregion Agents
425 393
426 #region Objects 394 #region Objects