aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs59
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs2
2 files changed, 61 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 415c6ea..d25a766 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -411,6 +411,65 @@ namespace OpenSim.Services.Connectors.Simulation
411 return false; 411 return false;
412 } 412 }
413 413
414 public bool QueryAccess(GridRegion destination, UUID id)
415 {
416 IPEndPoint ext = destination.ExternalEndPoint;
417 if (ext == null) return false;
418 // Eventually, we want to use a caps url instead of the agentID
419 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
420
421 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
422 request.Method = "QUERYACCESS";
423 request.Timeout = 10000;
424 //request.Headers.Add("authorization", ""); // coming soon
425
426 HttpWebResponse webResponse = null;
427 string reply = string.Empty;
428 StreamReader sr = null;
429 try
430 {
431 webResponse = (HttpWebResponse)request.GetResponse();
432 if (webResponse == null)
433 {
434 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on agent query ");
435 }
436
437 sr = new StreamReader(webResponse.GetResponseStream());
438 reply = sr.ReadToEnd().Trim();
439
440
441 }
442 catch (WebException ex)
443 {
444 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent query {0}", ex.Message);
445 // ignore, really
446 return false;
447 }
448 finally
449 {
450 if (sr != null)
451 sr.Close();
452 }
453
454 if (webResponse.StatusCode == HttpStatusCode.OK)
455 {
456 try
457 {
458 bool result;
459
460 result = bool.Parse(reply);
461
462 return result;
463 }
464 catch
465 {
466 return false;
467 }
468 }
469
470 return false;
471 }
472
414 public bool ReleaseAgent(UUID origin, UUID id, string uri) 473 public bool ReleaseAgent(UUID origin, UUID id, string uri)
415 { 474 {
416 WebRequest request = WebRequest.Create(uri); 475 WebRequest request = WebRequest.Create(uri);
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 33d6fde..1f8474c 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -60,6 +60,8 @@ namespace OpenSim.Services.Interfaces
60 60
61 bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); 61 bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
62 62
63 bool QueryAccess(GridRegion destination, UUID id);
64
63 /// <summary> 65 /// <summary>
64 /// Message from receiving region to departing region, telling it got contacted by the client. 66 /// Message from receiving region to departing region, telling it got contacted by the client.
65 /// When sent over REST, it invokes the opaque uri. 67 /// When sent over REST, it invokes the opaque uri.