aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs13
-rw-r--r--OpenSim/Region/DataSnapshot/DataRequestHandler.cs52
-rw-r--r--OpenSim/Region/DataSnapshot/DataSnapshotManager.cs9
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs19
4 files changed, 53 insertions, 40 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index f6e4dbf..bef012d 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -304,6 +304,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
304 return; 304 return;
305 } 305 }
306 306
307 if (IsInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this.
308 return;
309
307 m_log.DebugFormat( 310 m_log.DebugFormat(
308 "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}", 311 "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}",
309 reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); 312 reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
@@ -1861,6 +1864,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1861 } 1864 }
1862 } 1865 }
1863 1866
1867 protected bool IsInTransit(UUID id)
1868 {
1869 lock (m_agentsInTransit)
1870 {
1871 if (m_agentsInTransit.Contains(id))
1872 return true;
1873 }
1874 return false;
1875 }
1876
1864 protected bool ResetFromTransit(UUID id) 1877 protected bool ResetFromTransit(UUID id)
1865 { 1878 {
1866 lock (m_agentsInTransit) 1879 lock (m_agentsInTransit)
diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs
index 93648d6..2f2b3e6 100644
--- a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs
+++ b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs
@@ -46,8 +46,6 @@ namespace OpenSim.Region.DataSnapshot
46 private DataSnapshotManager m_externalData = null; 46 private DataSnapshotManager m_externalData = null;
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private readonly string m_discoveryPath = "DS0001/";
50
51 public DataRequestHandler(Scene scene, DataSnapshotManager externalData) 49 public DataRequestHandler(Scene scene, DataSnapshotManager externalData)
52 { 50 {
53 m_scene = scene; 51 m_scene = scene;
@@ -58,37 +56,9 @@ namespace OpenSim.Region.DataSnapshot
58 { 56 {
59 m_log.Info("[DATASNAPSHOT]: Set up snapshot service"); 57 m_log.Info("[DATASNAPSHOT]: Set up snapshot service");
60 } 58 }
59 // Register validation callback handler
60 MainServer.Instance.AddHTTPHandler("validate", OnValidate);
61 61
62 //Register CAPS handler event
63 m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
64
65 //harbl
66 }
67
68 public void OnRegisterCaps(UUID agentID, Caps caps)
69 {
70// m_log.InfoFormat("[DATASNAPSHOT]: Registering service discovery capability for {0}", agentID);
71 string capsBase = "/CAPS/" + caps.CapsObjectPath;
72 caps.RegisterHandler("PublicSnapshotDataInfo",
73 new RestStreamHandler("POST", capsBase + m_discoveryPath, OnDiscoveryAttempt));
74 }
75
76 public string OnDiscoveryAttempt(string request, string path, string param,
77 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
78 {
79 //Very static for now, flexible enough to add new formats
80 LLSDDiscoveryResponse llsd_response = new LLSDDiscoveryResponse();
81 llsd_response.snapshot_resources = new OSDArray();
82
83 LLSDDiscoveryDataURL llsd_dataurl = new LLSDDiscoveryDataURL();
84 llsd_dataurl.snapshot_format = "os-datasnapshot-v1";
85 llsd_dataurl.snapshot_url = "http://" + m_externalData.m_hostname + ":" + m_externalData.m_listener_port + "/?method=collector";
86
87 llsd_response.snapshot_resources.Array.Add(llsd_dataurl);
88
89 string response = LLSDHelpers.SerialiseLLSDReply(llsd_response);
90
91 return response;
92 } 62 }
93 63
94 public Hashtable OnGetSnapshot(Hashtable keysvals) 64 public Hashtable OnGetSnapshot(Hashtable keysvals)
@@ -107,5 +77,23 @@ namespace OpenSim.Region.DataSnapshot
107 77
108 return reply; 78 return reply;
109 } 79 }
80
81 public Hashtable OnValidate(Hashtable keysvals)
82 {
83 m_log.Info("[DATASNAPSHOT] Received validation request");
84 Hashtable reply = new Hashtable();
85 int statuscode = 200;
86
87 string secret = (string)keysvals["secret"];
88 if (secret == m_externalData.Secret.ToString())
89 statuscode = 403;
90
91 reply["str_response_string"] = string.Empty;
92 reply["int_response_code"] = statuscode;
93 reply["content_type"] = "text/plain";
94
95 return reply;
96 }
97
110 } 98 }
111} 99}
diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
index 209fb52..5540656 100644
--- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
+++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
@@ -66,6 +66,7 @@ namespace OpenSim.Region.DataSnapshot
66 private string m_dataServices = "noservices"; 66 private string m_dataServices = "noservices";
67 public string m_listener_port = ConfigSettings.DefaultRegionHttpPort.ToString(); 67 public string m_listener_port = ConfigSettings.DefaultRegionHttpPort.ToString();
68 public string m_hostname = "127.0.0.1"; 68 public string m_hostname = "127.0.0.1";
69 private UUID m_Secret = UUID.Random();
69 70
70 //Update timers 71 //Update timers
71 private int m_period = 20; // in seconds 72 private int m_period = 20; // in seconds
@@ -85,6 +86,11 @@ namespace OpenSim.Region.DataSnapshot
85 get { return m_exposure_level; } 86 get { return m_exposure_level; }
86 } 87 }
87 88
89 public UUID Secret
90 {
91 get { return m_Secret; }
92 }
93
88 #endregion 94 #endregion
89 95
90 #region IRegionModule 96 #region IRegionModule
@@ -315,6 +321,7 @@ namespace OpenSim.Region.DataSnapshot
315 cli.AddQueryParameter("service", serviceName); 321 cli.AddQueryParameter("service", serviceName);
316 cli.AddQueryParameter("host", m_hostname); 322 cli.AddQueryParameter("host", m_hostname);
317 cli.AddQueryParameter("port", m_listener_port); 323 cli.AddQueryParameter("port", m_listener_port);
324 cli.AddQueryParameter("secret", m_Secret.ToString());
318 cli.RequestMethod = "GET"; 325 cli.RequestMethod = "GET";
319 try 326 try
320 { 327 {
@@ -341,7 +348,7 @@ namespace OpenSim.Region.DataSnapshot
341 } 348 }
342 // This is not quite working, so... 349 // This is not quite working, so...
343 // string responseStr = Util.UTF8.GetString(response); 350 // string responseStr = Util.UTF8.GetString(response);
344 m_log.Info("[DATASNAPSHOT]: data service notified: " + url); 351 m_log.Info("[DATASNAPSHOT]: data service " + url + " notified. Secret: " + m_Secret);
345 } 352 }
346 353
347 } 354 }
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 1d1f9ef..5c9be8f 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -272,23 +272,28 @@ namespace OpenSim.Server.Handlers.Simulation
272 keysvals.Add("headers", headervals); 272 keysvals.Add("headers", headervals);
273 keysvals.Add("querystringkeys", querystringkeys); 273 keysvals.Add("querystringkeys", querystringkeys);
274 274
275 Stream inputStream; 275 httpResponse.StatusCode = 200;
276 httpResponse.ContentType = "text/html";
277 httpResponse.KeepAlive = false;
278 Encoding encoding = Encoding.UTF8;
279
280 Stream inputStream = null;
276 if (httpRequest.ContentType == "application/x-gzip") 281 if (httpRequest.ContentType == "application/x-gzip")
277 inputStream = new GZipStream(request, CompressionMode.Decompress); 282 inputStream = new GZipStream(request, CompressionMode.Decompress);
278 else 283 else if (httpRequest.ContentType == "application/json")
279 inputStream = request; 284 inputStream = request;
285 else // no go
286 {
287 httpResponse.StatusCode = 406;
288 return encoding.GetBytes("false");
289 }
280 290
281 Encoding encoding = Encoding.UTF8;
282 StreamReader reader = new StreamReader(inputStream, encoding); 291 StreamReader reader = new StreamReader(inputStream, encoding);
283 292
284 string requestBody = reader.ReadToEnd(); 293 string requestBody = reader.ReadToEnd();
285 reader.Close(); 294 reader.Close();
286 keysvals.Add("body", requestBody); 295 keysvals.Add("body", requestBody);
287 296
288 httpResponse.StatusCode = 200;
289 httpResponse.ContentType = "text/html";
290 httpResponse.KeepAlive = false;
291
292 Hashtable responsedata = new Hashtable(); 297 Hashtable responsedata = new Hashtable();
293 298
294 UUID agentID; 299 UUID agentID;