From 2c34619aea074446e53dde80d397973075914bac Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 23 Oct 2009 14:22:21 -0700 Subject: * Changed various modules to not initialize timers unless the module is initialized. Ideally, the timers would not initialize unless the module was actually enabled, but Melanie's work on configuring module loading from a config file should make that unnecessary * Wrapped the Bitmap class used to generate the world map tile in a using statement to dispose of it after the JPEG2000 data is created --- .../OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 3 ++- .../Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs | 13 ++++++++----- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 11 ++++++----- 3 files changed, 16 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/OptionalModules') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index b2544fa..f24869b 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -94,7 +94,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } private Dictionary m_clientRequestIDInfo = new Dictionary(); private const int m_clientRequestIDFlushTimeOut = 300000; // Every 5 minutes - private Timer m_clientRequestIDFlushTimer = new Timer(); + private Timer m_clientRequestIDFlushTimer; // Configuration settings @@ -133,6 +133,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true); m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); + m_clientRequestIDFlushTimer = new Timer(); m_clientRequestIDFlushTimer.Interval = m_clientRequestIDFlushTimeOut; m_clientRequestIDFlushTimer.Elapsed += FlushClientRequestIDInfoCache; m_clientRequestIDFlushTimer.AutoReset = true; diff --git a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs index fc1c608..3490a8b 100644 --- a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs +++ b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs @@ -45,13 +45,13 @@ namespace OpenSim.Region.Modules.SvnSerialiser public class SvnBackupModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly List m_scenes = new List(); - private readonly Timer m_timer = new Timer(); - private bool m_enabled = false; - private bool m_installBackupOnLoad = false; + private List m_scenes; + private Timer m_timer; + private bool m_enabled; + private bool m_installBackupOnLoad; private IRegionSerialiserModule m_serialiser; - private bool m_svnAutoSave = false; + private bool m_svnAutoSave; private SvnClient m_svnClient; private string m_svndir = "SVNmodule" + Slash.DirectorySeparatorChar + "repo"; private string m_svnpass = "password"; @@ -204,6 +204,9 @@ namespace OpenSim.Region.Modules.SvnSerialiser public void Initialise(Scene scene, IConfigSource source) { + m_scenes = new List(); + m_timer = new Timer(); + try { if (!source.Configs["SVN"].GetBoolean("Enabled", false)) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 41a6255..ac39a53 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -41,12 +41,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC { // private const bool m_enabled = false; - private Mutex m_createMutex = new Mutex(false); - - private Timer m_timer = new Timer(500); + private Mutex m_createMutex; + private Timer m_timer; private Dictionary m_avatars = new Dictionary(); - private Dictionary m_appearanceCache = new Dictionary(); // Timer vars. @@ -138,10 +136,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC public void Initialise(Scene scene, IConfigSource source) { - scene.RegisterModuleInterface(this); + m_createMutex = new Mutex(false); + m_timer = new Timer(500); m_timer.Elapsed += m_timer_Elapsed; m_timer.Start(); + + scene.RegisterModuleInterface(this); } void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) -- cgit v1.1