diff --git a/OpenSim/Client/MXP/MXPModule.cs b/OpenSim/Client/MXP/MXPModule.cs index 2d28b8c9b6..a6b039656c 100644 --- a/OpenSim/Client/MXP/MXPModule.cs +++ b/OpenSim/Client/MXP/MXPModule.cs @@ -52,10 +52,10 @@ namespace OpenSim.Client.MXP private IConfigSource m_config; private int m_port = 1253; + private Timer m_ticker; private readonly Dictionary m_scenes = new Dictionary(); - private readonly Timer m_ticker = new Timer(100); - private bool m_shutdown = false; + private bool m_shutdown; public void Initialise(Scene scene, IConfigSource source) { @@ -78,6 +78,7 @@ namespace OpenSim.Client.MXP m_server = new MXPPacketServer(m_port, m_scenes,m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate",true)); + m_ticker = new Timer(100); m_ticker.AutoReset = false; m_ticker.Elapsed += ticker_Elapsed; diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index 113d5c8cda..9b0d7ea571 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Reflection; -using System.Timers; using log4net; using Nini.Config; using OpenSim.Framework; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index 5fd836943a..285d36a3d6 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs @@ -98,27 +98,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap } terrainRenderer.Initialise(m_scene, m_config); - Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize); - //long t = System.Environment.TickCount; - //for (int i = 0; i < 10; ++i) { + using (Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize)) + { + //long t = System.Environment.TickCount; + //for (int i = 0; i < 10; ++i) { terrainRenderer.TerrainToBitmap(mapbmp); - //} - //t = System.Environment.TickCount - t; - //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); + //} + //t = System.Environment.TickCount - t; + //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); - if (drawPrimVolume) - { - DrawObjectVolume(m_scene, mapbmp); - } + if (drawPrimVolume) + { + DrawObjectVolume(m_scene, mapbmp); + } - try - { - imageData = OpenJPEG.EncodeFromImage(mapbmp, true); - } - catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke - { - m_log.Error("Failed generating terrain map: " + e); + try + { + imageData = OpenJPEG.EncodeFromImage(mapbmp, true); + } + catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke + { + m_log.Error("Failed generating terrain map: " + e); + } } return imageData; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a3bc04b633..47b13bd0ed 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -891,6 +891,9 @@ namespace OpenSim.Region.Framework.Scenes { m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); + m_restartTimer.Stop(); + m_restartTimer.Close(); + // Kick all ROOT agents with the message, 'The simulator is going down' ForEachScenePresence(delegate(ScenePresence avatar) { diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index b2544fac73..f24869b70d 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 fc1c608fc7..3490a8baef 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 41a6255c39..ac39a532ae 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)