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