From 48c6d052d94a7ab57c5264f09e989fa717c730f5 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 7 Nov 2008 05:48:44 +0000 Subject: Attachments, attachments, and, did I say attachments? Too many fixes to list. --- OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | 71 +++++++++------------- OpenSim/Region/DataSnapshot/ObjectSnapshot.cs | 2 +- 2 files changed, 29 insertions(+), 44 deletions(-) (limited to 'OpenSim/Region/DataSnapshot') diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index 3f934c9..782b431 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs @@ -32,7 +32,6 @@ using System.IO; using System.Net; using System.Reflection; using System.Text; -using System.Timers; using System.Xml; using OpenMetaverse; using log4net; @@ -71,12 +70,10 @@ namespace OpenSim.Region.DataSnapshot public string m_hostname = "127.0.0.1"; //Update timers - private Timer m_periodic = null; private int m_period = 20; // in seconds private int m_maxStales = 500; private int m_stales = 0; - private Timer m_passedCheck = null; - private bool m_periodPassed = false; + private int m_lastUpdate = 0; //Program objects private SnapshotStore m_snapStore = null; @@ -126,6 +123,7 @@ namespace OpenSim.Region.DataSnapshot { m_disabledModules.Add(bloody_wanker); } + m_lastUpdate = System.Environment.TickCount; } catch (Exception) { @@ -137,17 +135,6 @@ namespace OpenSim.Region.DataSnapshot if (m_enabled) { - //Create update timer - m_periodic = new Timer(); - m_periodic.Interval = m_period * 1000; - m_periodic.Elapsed += SnapshotTimerCallback; - - //Create update eligibility timer - m_passedCheck = new Timer(); - m_passedCheck.Interval = m_period * 1000; - m_passedCheck.Elapsed += UpdateEligibilityCallback; - m_passedCheck.Start(); - //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer new DataRequestHandler(scene, this); @@ -253,6 +240,8 @@ namespace OpenSim.Region.DataSnapshot */ public XmlDocument GetSnapshot(string regionName) { + CheckStale(); + XmlDocument requestedSnap = new XmlDocument(); requestedSnap.AppendChild(requestedSnap.CreateXmlDeclaration("1.0", null, null)); requestedSnap.AppendChild(requestedSnap.CreateWhitespace("\r\n")); @@ -369,38 +358,34 @@ namespace OpenSim.Region.DataSnapshot //Behavior here: Wait m_period seconds, then update if there has not been a request in m_period seconds //or m_maxStales has been exceeded m_stales++; - - if ((m_stales >= m_maxStales) && m_periodPassed) - SnapshotTimerCallback(m_periodic, null); - else if (m_periodic.Enabled == false) - m_periodic.Start(); - else - { - m_periodic.Stop(); - m_periodic.Start(); - } } - private void SnapshotTimerCallback(object timer, ElapsedEventArgs args) + private void CheckStale() { - m_log.Debug("[DATASNAPSHOT]: Marking scenes for snapshot updates."); - - //Finally generate those snapshot updates - MakeEverythingStale(); - - //Stop the update delay timer - m_periodic.Stop(); - - //Reset the eligibility flag and timer - m_periodPassed = false; - m_passedCheck.Stop(); - m_passedCheck.Start(); - } + // Wrap check + if (System.Environment.TickCount < m_lastUpdate) + { + m_lastUpdate = System.Environment.TickCount; + } - private void UpdateEligibilityCallback(object timer, ElapsedEventArgs args) - { - //Set eligibility, so we can start making updates - m_periodPassed = true; + if (m_stales >= m_maxStales) + { + if (System.Environment.TickCount - m_lastUpdate >= 20000) + { + m_stales = 0; + m_lastUpdate = System.Environment.TickCount; + MakeEverythingStale(); + } + } + else + { + if (m_lastUpdate + 1000 * m_period < System.Environment.TickCount) + { + m_stales = 0; + m_lastUpdate = System.Environment.TickCount; + MakeEverythingStale(); + } + } } public void MakeEverythingStale() diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs index c77de96..12e0f0f 100644 --- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs @@ -70,7 +70,7 @@ namespace OpenSim.Region.DataSnapshot.Providers client.OnGrabUpdate += delegate(UUID objectID, Vector3 offset, Vector3 grapPos, IClientAPI remoteClient, List surfaceArgs) { this.Stale = true; }; client.OnObjectAttach += delegate(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, - Quaternion rot) { this.Stale = true; }; + Quaternion rot, bool silent) { this.Stale = true; }; client.OnObjectDuplicate += delegate(uint localID, Vector3 offset, uint dupeFlags, UUID AgentID, UUID GroupID) { this.Stale = true; }; client.OnObjectDuplicateOnRay += delegate(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID, -- cgit v1.1