aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs33
1 files changed, 17 insertions, 16 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index 81170b8..0c4e227 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -75,17 +75,15 @@ namespace OpenSim.Region.ClientStack.Linden
75 private IAssetService m_assetService = null; 75 private IAssetService m_assetService = null;
76 76
77 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); 77 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
78 private Thread[] m_workerThreads = null; 78 private static Thread[] m_workerThreads = null;
79 79 private static int m_NumberScenes = 0;
80 private string m_Url = "localhost";
81
82 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = 80 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
83 new OpenMetaverse.BlockingQueue<aPollRequest>(); 81 new OpenMetaverse.BlockingQueue<aPollRequest>();
84 82
85 private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>(); 83 private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>();
86 84
87 private bool m_IsRunning = false; 85 private string m_Url = "localhost";
88 private string m_SceneName = ""; 86
89 #region ISharedRegionModule Members 87 #region ISharedRegionModule Members
90 88
91 public void Initialise(IConfigSource source) 89 public void Initialise(IConfigSource source)
@@ -117,6 +115,7 @@ namespace OpenSim.Region.ClientStack.Linden
117 m_scene.EventManager.OnRegisterCaps -= RegisterCaps; 115 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
118 m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; 116 m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
119 m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate; 117 m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate;
118 m_NumberScenes--;
120 m_scene = null; 119 m_scene = null;
121 } 120 }
122 121
@@ -129,8 +128,7 @@ namespace OpenSim.Region.ClientStack.Linden
129 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; 128 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
130 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate; 129 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
131 130
132 m_SceneName = m_scene.Name; 131 m_NumberScenes++;
133 m_IsRunning = true;
134 132
135 if (m_workerThreads == null) 133 if (m_workerThreads == null)
136 { 134 {
@@ -139,7 +137,7 @@ namespace OpenSim.Region.ClientStack.Linden
139 for (uint i = 0; i < 2; i++) 137 for (uint i = 0; i < 2; i++)
140 { 138 {
141 m_workerThreads[i] = WorkManager.StartThread(DoTextureRequests, 139 m_workerThreads[i] = WorkManager.StartThread(DoTextureRequests,
142 String.Format("GetTextureWorker[{0}]{1}",m_SceneName, i), 140 String.Format("GetTextureWorker{0}", i),
143 ThreadPriority.Normal, 141 ThreadPriority.Normal,
144 false, 142 false,
145 false, 143 false,
@@ -194,14 +192,15 @@ namespace OpenSim.Region.ClientStack.Linden
194 192
195 public void Close() 193 public void Close()
196 { 194 {
197 if(m_IsRunning && m_workerThreads != null) 195 if(m_NumberScenes <= 0 && m_workerThreads != null)
198 { 196 {
199 m_log.DebugFormat("[GetTextureModule] Closing {0}", m_SceneName); 197 m_log.DebugFormat("[GetTextureModule] Closing");
200 m_IsRunning = false; 198
201 foreach (Thread t in m_workerThreads) 199 foreach (Thread t in m_workerThreads)
202 Watchdog.AbortThread(t.ManagedThreadId); 200 Watchdog.AbortThread(t.ManagedThreadId);
201
202 m_queue.Clear();
203 } 203 }
204 m_queue.Clear();
205 } 204 }
206 205
207 public string Name { get { return "GetTextureModule"; } } 206 public string Name { get { return "GetTextureModule"; } }
@@ -302,11 +301,13 @@ namespace OpenSim.Region.ClientStack.Linden
302 301
303 UUID requestID = requestinfo.reqID; 302 UUID requestID = requestinfo.reqID;
304 303
304 if(m_scene.ShuttingDown)
305 return;
306
305 if (requestinfo.send503) 307 if (requestinfo.send503)
306 { 308 {
307 response = new Hashtable(); 309 response = new Hashtable();
308 310
309
310 response["int_response_code"] = 503; 311 response["int_response_code"] = 503;
311 response["str_response_string"] = "Throttled"; 312 response["str_response_string"] = "Throttled";
312 response["content_type"] = "text/plain"; 313 response["content_type"] = "text/plain";
@@ -408,9 +409,9 @@ namespace OpenSim.Region.ClientStack.Linden
408 } 409 }
409 } 410 }
410 411
411 private void DoTextureRequests() 412 private static void DoTextureRequests()
412 { 413 {
413 while (m_IsRunning) 414 while (true)
414 { 415 {
415 aPollRequest poolreq = m_queue.Dequeue(); 416 aPollRequest poolreq = m_queue.Dequeue();
416 Watchdog.UpdateThread(); 417 Watchdog.UpdateThread();