aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs30
1 files changed, 14 insertions, 16 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
index f5b439b..95d9c99 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
@@ -57,10 +57,8 @@ namespace OpenSim.Region.ClientStack.Linden
57// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 57// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58 58
59 private Scene m_scene; 59 private Scene m_scene;
60 private string m_SceneName = "";
61 private IAssetService m_AssetService; 60 private IAssetService m_AssetService;
62 private bool m_Enabled = true; 61 private bool m_Enabled = true;
63 private bool m_IsRunning = false;
64 private string m_URL; 62 private string m_URL;
65 63
66 private string m_URL2; 64 private string m_URL2;
@@ -89,8 +87,8 @@ namespace OpenSim.Region.ClientStack.Linden
89 private IAssetService m_assetService = null; 87 private IAssetService m_assetService = null;
90 88
91 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); 89 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
92 private Thread[] m_workerThreads = null; 90 private static Thread[] m_workerThreads = null;
93 91 private static int m_NumberScenes = 0;
94 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = 92 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
95 new OpenMetaverse.BlockingQueue<aPollRequest>(); 93 new OpenMetaverse.BlockingQueue<aPollRequest>();
96 94
@@ -146,7 +144,7 @@ namespace OpenSim.Region.ClientStack.Linden
146 m_scene.EventManager.OnRegisterCaps -= RegisterCaps; 144 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
147 m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; 145 m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
148 m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate; 146 m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate;
149 147 m_NumberScenes--;
150 m_scene = null; 148 m_scene = null;
151 } 149 }
152 150
@@ -162,8 +160,7 @@ namespace OpenSim.Region.ClientStack.Linden
162 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; 160 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
163 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate; 161 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
164 162
165 m_IsRunning = true; 163 m_NumberScenes++;
166 m_SceneName = m_scene.Name;
167 164
168 if (m_workerThreads == null) 165 if (m_workerThreads == null)
169 { 166 {
@@ -172,7 +169,7 @@ namespace OpenSim.Region.ClientStack.Linden
172 for (uint i = 0; i < 2; i++) 169 for (uint i = 0; i < 2; i++)
173 { 170 {
174 m_workerThreads[i] = WorkManager.StartThread(DoMeshRequests, 171 m_workerThreads[i] = WorkManager.StartThread(DoMeshRequests,
175 String.Format("GetMeshWorker[{0}]{1}",m_SceneName, i), 172 String.Format("GetMeshWorker{0}", i),
176 ThreadPriority.Normal, 173 ThreadPriority.Normal,
177 false, 174 false,
178 false, 175 false,
@@ -184,23 +181,22 @@ namespace OpenSim.Region.ClientStack.Linden
184 181
185 public void Close() 182 public void Close()
186 { 183 {
187 if(m_IsRunning && m_workerThreads != null) 184 if(m_NumberScenes <= 0 && m_workerThreads != null)
188 { 185 {
189 m_log.DebugFormat("[GetMeshModule] Closing{0}", m_SceneName); 186 m_log.DebugFormat("[GetMeshModule] Closing");
190 m_IsRunning = false;
191 foreach (Thread t in m_workerThreads) 187 foreach (Thread t in m_workerThreads)
192 Watchdog.AbortThread(t.ManagedThreadId); 188 Watchdog.AbortThread(t.ManagedThreadId);
189 m_queue.Clear();
193 } 190 }
194 m_queue.Clear();
195 } 191 }
196 192
197 public string Name { get { return "GetMeshModule"; } } 193 public string Name { get { return "GetMeshModule"; } }
198 194
199 #endregion 195 #endregion
200 196
201 private void DoMeshRequests() 197 private static void DoMeshRequests()
202 { 198 {
203 while (m_IsRunning) 199 while(true)
204 { 200 {
205 aPollRequest poolreq = m_queue.Dequeue(); 201 aPollRequest poolreq = m_queue.Dequeue();
206 Watchdog.UpdateThread(); 202 Watchdog.UpdateThread();
@@ -299,6 +295,9 @@ namespace OpenSim.Region.ClientStack.Linden
299 295
300 UUID requestID = requestinfo.reqID; 296 UUID requestID = requestinfo.reqID;
301 297
298 if(m_scene.ShuttingDown)
299 return;
300
302 // If the avatar is gone, don't bother to get the texture 301 // If the avatar is gone, don't bother to get the texture
303 if (m_scene.GetScenePresence(Id) == null) 302 if (m_scene.GetScenePresence(Id) == null)
304 { 303 {
@@ -410,7 +409,6 @@ namespace OpenSim.Region.ClientStack.Linden
410 User = puser; 409 User = puser;
411 } 410 }
412 411
413
414 public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses) 412 public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses)
415 { 413 {
416 const float ThirtyPercent = 0.30f; 414 const float ThirtyPercent = 0.30f;
@@ -492,7 +490,6 @@ namespace OpenSim.Region.ClientStack.Linden
492 PassTime(); 490 PassTime();
493 } 491 }
494 492
495
496 private void PassTime() 493 private void PassTime()
497 { 494 {
498 currenttime = Util.EnvironmentTickCount(); 495 currenttime = Util.EnvironmentTickCount();
@@ -511,6 +508,7 @@ namespace OpenSim.Region.ClientStack.Linden
511 } 508 }
512 } 509 }
513 } 510 }
511
514 private void AlterThrottle(int setting, ScenePresence p) 512 private void AlterThrottle(int setting, ScenePresence p)
515 { 513 {
516 p.ControllingClient.SetAgentThrottleSilent((int)Throttle,setting); 514 p.ControllingClient.SetAgentThrottleSilent((int)Throttle,setting);