aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs45
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs54
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs68
3 files changed, 87 insertions, 80 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
index b5a70040..95d9c99 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Region.ClientStack.Linden
88 88
89 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); 89 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
90 private static Thread[] m_workerThreads = null; 90 private static Thread[] m_workerThreads = null;
91 91 private static int m_NumberScenes = 0;
92 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = 92 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
93 new OpenMetaverse.BlockingQueue<aPollRequest>(); 93 new OpenMetaverse.BlockingQueue<aPollRequest>();
94 94
@@ -97,13 +97,6 @@ namespace OpenSim.Region.ClientStack.Linden
97 97
98 #region Region Module interfaceBase Members 98 #region Region Module interfaceBase Members
99 99
100 ~GetMeshModule()
101 {
102 foreach (Thread t in m_workerThreads)
103 Watchdog.AbortThread(t.ManagedThreadId);
104
105 }
106
107 public Type ReplaceableInterface 100 public Type ReplaceableInterface
108 { 101 {
109 get { return null; } 102 get { return null; }
@@ -151,7 +144,7 @@ namespace OpenSim.Region.ClientStack.Linden
151 m_scene.EventManager.OnRegisterCaps -= RegisterCaps; 144 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
152 m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; 145 m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
153 m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate; 146 m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate;
154 147 m_NumberScenes--;
155 m_scene = null; 148 m_scene = null;
156 } 149 }
157 150
@@ -167,6 +160,8 @@ namespace OpenSim.Region.ClientStack.Linden
167 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; 160 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
168 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate; 161 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
169 162
163 m_NumberScenes++;
164
170 if (m_workerThreads == null) 165 if (m_workerThreads == null)
171 { 166 {
172 m_workerThreads = new Thread[2]; 167 m_workerThreads = new Thread[2];
@@ -174,7 +169,7 @@ namespace OpenSim.Region.ClientStack.Linden
174 for (uint i = 0; i < 2; i++) 169 for (uint i = 0; i < 2; i++)
175 { 170 {
176 m_workerThreads[i] = WorkManager.StartThread(DoMeshRequests, 171 m_workerThreads[i] = WorkManager.StartThread(DoMeshRequests,
177 String.Format("MeshWorkerThread{0}", i), 172 String.Format("GetMeshWorker{0}", i),
178 ThreadPriority.Normal, 173 ThreadPriority.Normal,
179 false, 174 false,
180 false, 175 false,
@@ -182,22 +177,29 @@ namespace OpenSim.Region.ClientStack.Linden
182 int.MaxValue); 177 int.MaxValue);
183 } 178 }
184 } 179 }
185
186 } 180 }
187 181
188 182 public void Close()
189 public void Close() { } 183 {
184 if(m_NumberScenes <= 0 && m_workerThreads != null)
185 {
186 m_log.DebugFormat("[GetMeshModule] Closing");
187 foreach (Thread t in m_workerThreads)
188 Watchdog.AbortThread(t.ManagedThreadId);
189 m_queue.Clear();
190 }
191 }
190 192
191 public string Name { get { return "GetMeshModule"; } } 193 public string Name { get { return "GetMeshModule"; } }
192 194
193 #endregion 195 #endregion
194 196
195 private void DoMeshRequests() 197 private static void DoMeshRequests()
196 { 198 {
197 while (true) 199 while(true)
198 { 200 {
199 aPollRequest poolreq = m_queue.Dequeue(); 201 aPollRequest poolreq = m_queue.Dequeue();
200 202 Watchdog.UpdateThread();
201 poolreq.thepoll.Process(poolreq); 203 poolreq.thepoll.Process(poolreq);
202 } 204 }
203 } 205 }
@@ -293,6 +295,9 @@ namespace OpenSim.Region.ClientStack.Linden
293 295
294 UUID requestID = requestinfo.reqID; 296 UUID requestID = requestinfo.reqID;
295 297
298 if(m_scene.ShuttingDown)
299 return;
300
296 // 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
297 if (m_scene.GetScenePresence(Id) == null) 302 if (m_scene.GetScenePresence(Id) == null)
298 { 303 {
@@ -386,7 +391,7 @@ namespace OpenSim.Region.ClientStack.Linden
386 private volatile int BytesSent = 0; 391 private volatile int BytesSent = 0;
387 private int Lod3 = 0; 392 private int Lod3 = 0;
388 private int Lod2 = 0; 393 private int Lod2 = 0;
389 private int Lod1 = 0; 394// private int Lod1 = 0;
390 private int UserSetThrottle = 0; 395 private int UserSetThrottle = 0;
391 private int UDPSetThrottle = 0; 396 private int UDPSetThrottle = 0;
392 private int CapSetThrottle = 0; 397 private int CapSetThrottle = 0;
@@ -404,7 +409,6 @@ namespace OpenSim.Region.ClientStack.Linden
404 User = puser; 409 User = puser;
405 } 410 }
406 411
407
408 public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses) 412 public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses)
409 { 413 {
410 const float ThirtyPercent = 0.30f; 414 const float ThirtyPercent = 0.30f;
@@ -486,7 +490,6 @@ namespace OpenSim.Region.ClientStack.Linden
486 PassTime(); 490 PassTime();
487 } 491 }
488 492
489
490 private void PassTime() 493 private void PassTime()
491 { 494 {
492 currenttime = Util.EnvironmentTickCount(); 495 currenttime = Util.EnvironmentTickCount();
@@ -501,10 +504,11 @@ namespace OpenSim.Region.ClientStack.Linden
501 { 504 {
502 Lod3 = 0; 505 Lod3 = 0;
503 Lod2 = 0; 506 Lod2 = 0;
504 Lod1 = 0; 507// Lod1 = 0;
505 } 508 }
506 } 509 }
507 } 510 }
511
508 private void AlterThrottle(int setting, ScenePresence p) 512 private void AlterThrottle(int setting, ScenePresence p)
509 { 513 {
510 p.ControllingClient.SetAgentThrottleSilent((int)Throttle,setting); 514 p.ControllingClient.SetAgentThrottleSilent((int)Throttle,setting);
@@ -534,6 +538,5 @@ namespace OpenSim.Region.ClientStack.Linden
534 538
535 } 539 }
536 } 540 }
537
538 } 541 }
539} 542}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index aa51a00..0c4e227 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -76,14 +76,13 @@ namespace OpenSim.Region.ClientStack.Linden
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 static 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
85 private string m_Url = "localhost";
87 86
88 #region ISharedRegionModule Members 87 #region ISharedRegionModule Members
89 88
@@ -116,6 +115,7 @@ namespace OpenSim.Region.ClientStack.Linden
116 m_scene.EventManager.OnRegisterCaps -= RegisterCaps; 115 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
117 m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; 116 m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
118 m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate; 117 m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate;
118 m_NumberScenes--;
119 m_scene = null; 119 m_scene = null;
120 } 120 }
121 121
@@ -128,6 +128,8 @@ namespace OpenSim.Region.ClientStack.Linden
128 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; 128 m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
129 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate; 129 m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate;
130 130
131 m_NumberScenes++;
132
131 if (m_workerThreads == null) 133 if (m_workerThreads == null)
132 { 134 {
133 m_workerThreads = new Thread[2]; 135 m_workerThreads = new Thread[2];
@@ -135,7 +137,7 @@ namespace OpenSim.Region.ClientStack.Linden
135 for (uint i = 0; i < 2; i++) 137 for (uint i = 0; i < 2; i++)
136 { 138 {
137 m_workerThreads[i] = WorkManager.StartThread(DoTextureRequests, 139 m_workerThreads[i] = WorkManager.StartThread(DoTextureRequests,
138 String.Format("TextureWorkerThread{0}", i), 140 String.Format("GetTextureWorker{0}", i),
139 ThreadPriority.Normal, 141 ThreadPriority.Normal,
140 false, 142 false,
141 false, 143 false,
@@ -165,17 +167,6 @@ namespace OpenSim.Region.ClientStack.Linden
165 adjData = pthrottles; 167 adjData = pthrottles;
166 } 168 }
167 169
168 // 0.125f converts from bits to bytes
169 //int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
170 //pos += 4;
171 // int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
172 //pos += 4;
173 // int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
174 // pos += 4;
175 // int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
176 // pos += 4;
177 // int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
178 // pos += 4;
179 pos = pos + 20; 170 pos = pos + 20;
180 int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); //pos += 4; 171 int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); //pos += 4;
181 //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); 172 //int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
@@ -199,7 +190,18 @@ namespace OpenSim.Region.ClientStack.Linden
199 { 190 {
200 } 191 }
201 192
202 public void Close() { } 193 public void Close()
194 {
195 if(m_NumberScenes <= 0 && m_workerThreads != null)
196 {
197 m_log.DebugFormat("[GetTextureModule] Closing");
198
199 foreach (Thread t in m_workerThreads)
200 Watchdog.AbortThread(t.ManagedThreadId);
201
202 m_queue.Clear();
203 }
204 }
203 205
204 public string Name { get { return "GetTextureModule"; } } 206 public string Name { get { return "GetTextureModule"; } }
205 207
@@ -210,13 +212,6 @@ namespace OpenSim.Region.ClientStack.Linden
210 212
211 #endregion 213 #endregion
212 214
213 ~GetTextureModule()
214 {
215 foreach (Thread t in m_workerThreads)
216 Watchdog.AbortThread(t.ManagedThreadId);
217
218 }
219
220 private class PollServiceTextureEventArgs : PollServiceEventArgs 215 private class PollServiceTextureEventArgs : PollServiceEventArgs
221 { 216 {
222 private List<Hashtable> requests = 217 private List<Hashtable> requests =
@@ -306,11 +301,13 @@ namespace OpenSim.Region.ClientStack.Linden
306 301
307 UUID requestID = requestinfo.reqID; 302 UUID requestID = requestinfo.reqID;
308 303
304 if(m_scene.ShuttingDown)
305 return;
306
309 if (requestinfo.send503) 307 if (requestinfo.send503)
310 { 308 {
311 response = new Hashtable(); 309 response = new Hashtable();
312 310
313
314 response["int_response_code"] = 503; 311 response["int_response_code"] = 503;
315 response["str_response_string"] = "Throttled"; 312 response["str_response_string"] = "Throttled";
316 response["content_type"] = "text/plain"; 313 response["content_type"] = "text/plain";
@@ -412,15 +409,16 @@ namespace OpenSim.Region.ClientStack.Linden
412 } 409 }
413 } 410 }
414 411
415 private void DoTextureRequests() 412 private static void DoTextureRequests()
416 { 413 {
417 while (true) 414 while (true)
418 { 415 {
419 aPollRequest poolreq = m_queue.Dequeue(); 416 aPollRequest poolreq = m_queue.Dequeue();
420 417 Watchdog.UpdateThread();
421 poolreq.thepoll.Process(poolreq); 418 poolreq.thepoll.Process(poolreq);
422 } 419 }
423 } 420 }
421
424 internal sealed class CapsDataThrottler 422 internal sealed class CapsDataThrottler
425 { 423 {
426 424
@@ -498,7 +496,5 @@ namespace OpenSim.Region.ClientStack.Linden
498 } 496 }
499 public int ThrottleBytes; 497 public int ThrottleBytes;
500 } 498 }
501 } 499 }
502
503
504} 500}
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 }