diff options
Diffstat (limited to 'OpenSim/Region/ClientStack')
3 files changed, 69 insertions, 62 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); |
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(); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 61f4cd0..83f60c7 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | |||
@@ -102,6 +102,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
102 | private static DoubleQueue<aPollRequest> m_queue = | 102 | private static DoubleQueue<aPollRequest> m_queue = |
103 | new DoubleQueue<aPollRequest>(); | 103 | new DoubleQueue<aPollRequest>(); |
104 | 104 | ||
105 | private static int m_NumberScenes = 0; | ||
106 | |||
105 | #region ISharedRegionModule Members | 107 | #region ISharedRegionModule Members |
106 | 108 | ||
107 | public WebFetchInvDescModule() : this(true) {} | 109 | public WebFetchInvDescModule() : this(true) {} |
@@ -145,17 +147,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
145 | StatsManager.DeregisterStat(s_processedRequestsStat); | 147 | StatsManager.DeregisterStat(s_processedRequestsStat); |
146 | StatsManager.DeregisterStat(s_queuedRequestsStat); | 148 | StatsManager.DeregisterStat(s_queuedRequestsStat); |
147 | 149 | ||
148 | if (ProcessQueuedRequestsAsync) | 150 | m_NumberScenes--; |
149 | { | ||
150 | if (m_workerThreads != null) | ||
151 | { | ||
152 | foreach (Thread t in m_workerThreads) | ||
153 | Watchdog.AbortThread(t.ManagedThreadId); | ||
154 | |||
155 | m_workerThreads = null; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | Scene = null; | 151 | Scene = null; |
160 | } | 152 | } |
161 | 153 | ||
@@ -203,6 +195,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
203 | 195 | ||
204 | Scene.EventManager.OnRegisterCaps += RegisterCaps; | 196 | Scene.EventManager.OnRegisterCaps += RegisterCaps; |
205 | 197 | ||
198 | m_NumberScenes++; | ||
199 | |||
206 | int nworkers = 2; // was 2 | 200 | int nworkers = 2; // was 2 |
207 | if (ProcessQueuedRequestsAsync && m_workerThreads == null) | 201 | if (ProcessQueuedRequestsAsync && m_workerThreads == null) |
208 | { | 202 | { |
@@ -225,7 +219,23 @@ namespace OpenSim.Region.ClientStack.Linden | |||
225 | { | 219 | { |
226 | } | 220 | } |
227 | 221 | ||
228 | public void Close() { } | 222 | public void Close() |
223 | { | ||
224 | if (!m_Enabled) | ||
225 | return; | ||
226 | |||
227 | if (ProcessQueuedRequestsAsync) | ||
228 | { | ||
229 | if (m_NumberScenes <= 0 && m_workerThreads != null) | ||
230 | { | ||
231 | m_log.DebugFormat("[WebFetchInvDescModule] Closing"); | ||
232 | foreach (Thread t in m_workerThreads) | ||
233 | Watchdog.AbortThread(t.ManagedThreadId); | ||
234 | |||
235 | m_workerThreads = null; | ||
236 | } | ||
237 | } | ||
238 | } | ||
229 | 239 | ||
230 | public string Name { get { return "WebFetchInvDescModule"; } } | 240 | public string Name { get { return "WebFetchInvDescModule"; } } |
231 | 241 | ||
@@ -350,6 +360,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
350 | 360 | ||
351 | public void Process(aPollRequest requestinfo) | 361 | public void Process(aPollRequest requestinfo) |
352 | { | 362 | { |
363 | if(m_module == null || m_module.Scene == null || m_module.Scene.ShuttingDown) | ||
364 | return; | ||
365 | |||
353 | UUID requestID = requestinfo.reqID; | 366 | UUID requestID = requestinfo.reqID; |
354 | 367 | ||
355 | Hashtable response = new Hashtable(); | 368 | Hashtable response = new Hashtable(); |
@@ -425,31 +438,26 @@ namespace OpenSim.Region.ClientStack.Linden | |||
425 | // } | 438 | // } |
426 | // } | 439 | // } |
427 | 440 | ||
428 | private void DoInventoryRequests() | 441 | private static void DoInventoryRequests() |
429 | { | 442 | { |
430 | while (true) | 443 | while (true) |
431 | { | 444 | { |
432 | Watchdog.UpdateThread(); | 445 | Watchdog.UpdateThread(); |
433 | 446 | ||
434 | WaitProcessQueuedInventoryRequest(); | 447 | aPollRequest poolreq = m_queue.Dequeue(); |
435 | } | ||
436 | } | ||
437 | 448 | ||
438 | public void WaitProcessQueuedInventoryRequest() | 449 | if (poolreq != null && poolreq.thepoll != null) |
439 | { | ||
440 | aPollRequest poolreq = m_queue.Dequeue(); | ||
441 | |||
442 | if (poolreq != null && poolreq.thepoll != null) | ||
443 | { | ||
444 | try | ||
445 | { | 450 | { |
446 | poolreq.thepoll.Process(poolreq); | 451 | try |
447 | } | 452 | { |
448 | catch (Exception e) | 453 | poolreq.thepoll.Process(poolreq); |
449 | { | 454 | } |
450 | m_log.ErrorFormat( | 455 | catch (Exception e) |
451 | "[INVENTORY]: Failed to process queued inventory request {0} for {1} in {2}. Exception {3}", | 456 | { |
452 | poolreq.reqID, poolreq.presence != null ? poolreq.presence.Name : "unknown", Scene.Name, e); | 457 | m_log.ErrorFormat( |
458 | "[INVENTORY]: Failed to process queued inventory request {0} for {1}. Exception {3}", | ||
459 | poolreq.reqID, poolreq.presence != null ? poolreq.presence.Name : "unknown", e); | ||
460 | } | ||
453 | } | 461 | } |
454 | } | 462 | } |
455 | } | 463 | } |