aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2018-01-22 18:37:39 +0000
committerUbitUmarov2018-01-22 18:37:39 +0000
commitefc74803424a5e12ce780ecdd839d144123ae79e (patch)
tree50f1e052da7188d5fc4db40983a0a34716a7ce7f /OpenSim
parentmissing files.. (diff)
downloadopensim-SC-efc74803424a5e12ce780ecdd839d144123ae79e.zip
opensim-SC-efc74803424a5e12ce780ecdd839d144123ae79e.tar.gz
opensim-SC-efc74803424a5e12ce780ecdd839d144123ae79e.tar.bz2
opensim-SC-efc74803424a5e12ce780ecdd839d144123ae79e.tar.xz
throtle datasnapshot gen
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs14
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs13
2 files changed, 22 insertions, 5 deletions
diff --git a/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs
index 5a01fa9..fb60e9e 100644
--- a/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs
@@ -63,18 +63,24 @@ namespace OpenSim.Region.DataSnapshot
63 63
64 public Hashtable OnGetSnapshot(Hashtable keysvals) 64 public Hashtable OnGetSnapshot(Hashtable keysvals)
65 { 65 {
66 m_log.Debug("[DATASNAPSHOT] Received collection request"); 66 string snapObj = (string)keysvals["region"];
67 m_log.DebugFormat("[DATASNAPSHOT] Received collection request for {0}", snapObj);
67 Hashtable reply = new Hashtable(); 68 Hashtable reply = new Hashtable();
68 int statuscode = 200; 69 int statuscode = 200;
69 70
70 string snapObj = (string)keysvals["region"];
71
72 XmlDocument response = m_externalData.GetSnapshot(snapObj); 71 XmlDocument response = m_externalData.GetSnapshot(snapObj);
72 if(response == null)
73 {
74 reply["str_response_string"] = string.Empty;
75 reply["int_response_code"] = 503;
76 reply["content_type"] = "text";
77 m_log.Debug("[DATASNAPSHOT] Collection request reply try later");
78 return reply;
79 }
73 80
74 reply["str_response_string"] = response.OuterXml; 81 reply["str_response_string"] = response.OuterXml;
75 reply["int_response_code"] = statuscode; 82 reply["int_response_code"] = statuscode;
76 reply["content_type"] = "text/xml"; 83 reply["content_type"] = "text/xml";
77
78 return reply; 84 return reply;
79 } 85 }
80 86
diff --git a/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs
index 0436f96..88fa1ae 100644
--- a/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs
@@ -32,6 +32,7 @@ using System.IO;
32using System.Linq; 32using System.Linq;
33using System.Net; 33using System.Net;
34using System.Reflection; 34using System.Reflection;
35using System.Threading;
35using System.Text; 36using System.Text;
36using System.Xml; 37using System.Xml;
37using log4net; 38using log4net;
@@ -64,6 +65,7 @@ namespace OpenSim.Region.DataSnapshot
64 //Various internal objects 65 //Various internal objects
65 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 66 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
66 internal object m_syncInit = new object(); 67 internal object m_syncInit = new object();
68 private object m_serializeGen = new object();
67 69
68 //DataServices and networking 70 //DataServices and networking
69 private string m_dataServices = "noservices"; 71 private string m_dataServices = "noservices";
@@ -321,6 +323,11 @@ namespace OpenSim.Region.DataSnapshot
321 */ 323 */
322 public XmlDocument GetSnapshot(string regionName) 324 public XmlDocument GetSnapshot(string regionName)
323 { 325 {
326 if(!Monitor.TryEnter(m_serializeGen,30000))
327 {
328 return null;
329 }
330
324 CheckStale(); 331 CheckStale();
325 332
326 XmlDocument requestedSnap = new XmlDocument(); 333 XmlDocument requestedSnap = new XmlDocument();
@@ -360,9 +367,13 @@ namespace OpenSim.Region.DataSnapshot
360 m_log.Warn("[DATASNAPSHOT]: Caught unknown exception while trying to load snapshot: " + e.StackTrace); 367 m_log.Warn("[DATASNAPSHOT]: Caught unknown exception while trying to load snapshot: " + e.StackTrace);
361 requestedSnap = GetErrorMessage(regionName, e); 368 requestedSnap = GetErrorMessage(regionName, e);
362 } 369 }
363 370 finally
371 {
372 Monitor.Exit(m_serializeGen);
373 }
364 374
365 return requestedSnap; 375 return requestedSnap;
376
366 } 377 }
367 378
368 private XmlDocument GetErrorMessage(string regionName, Exception e) 379 private XmlDocument GetErrorMessage(string regionName, Exception e)