aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs34
1 files changed, 22 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
index 4d7538c..cf41754 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
66 66
67 private int m_refreshtime = 0; 67 private int m_refreshtime = 0;
68 private int m_lastrefresh = 0; 68 private int m_lastrefresh = 0;
69 private System.Timers.Timer m_refreshTimer = new System.Timers.Timer(); 69 private System.Timers.Timer m_refreshTimer;
70 70
71 #region ISharedRegionModule 71 #region ISharedRegionModule
72 72
@@ -94,14 +94,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
94 return; 94 return;
95 95
96 int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime")); 96 int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime"));
97 if (refreshminutes <= 0) 97
98 // if refresh is less than zero, disable the module
99 if (refreshminutes < 0)
98 { 100 {
99 m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: No refresh time given in config. Module disabled."); 101 m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Negative refresh time given in config. Module disabled.");
100 return; 102 return;
101 } 103 }
102 104
103 m_refreshtime = refreshminutes * 60 * 1000; // convert from minutes to ms
104
105 string service = config.GetString("LocalServiceModule", string.Empty); 105 string service = config.GetString("LocalServiceModule", string.Empty);
106 if (service == string.Empty) 106 if (service == string.Empty)
107 { 107 {
@@ -116,15 +116,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
116 m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Unable to load LocalServiceModule from {0}. MapService module disabled. Please fix the configuration.", service); 116 m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Unable to load LocalServiceModule from {0}. MapService module disabled. Please fix the configuration.", service);
117 return; 117 return;
118 } 118 }
119
120 // we don't want the timer if the interval is zero, but we still want this module enables
121 if(refreshminutes > 0)
122 {
123 m_refreshtime = refreshminutes * 60 * 1000; // convert from minutes to ms
124
125 m_refreshTimer = new System.Timers.Timer();
126 m_refreshTimer.Enabled = true;
127 m_refreshTimer.AutoReset = true;
128 m_refreshTimer.Interval = m_refreshtime;
129 m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh);
119 130
120 m_refreshTimer.Enabled = true; 131 m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0} min and service object {1}",
121 m_refreshTimer.AutoReset = true;
122 m_refreshTimer.Interval = m_refreshtime;
123 m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh);
124
125 m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0}min and service object {1}",
126 refreshminutes, service); 132 refreshminutes, service);
127 133 }
134 else
135 {
136 m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with no refresh and service object {0}", service);
137 }
128 m_enabled = true; 138 m_enabled = true;
129 } 139 }
130 140