diff options
Diffstat (limited to '')
3 files changed, 98 insertions, 82 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 3f43149..db445fa 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -225,13 +225,16 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
225 | 225 | ||
226 | private void PoolWorkerJob() | 226 | private void PoolWorkerJob() |
227 | { | 227 | { |
228 | PollServiceHttpRequest req; | ||
228 | while (m_running) | 229 | while (m_running) |
229 | { | 230 | { |
230 | PollServiceHttpRequest req; | 231 | if(!m_requests.TryTake(out req, 4500) || req == null) |
231 | m_requests.TryTake(out req, 4500); | 232 | { |
232 | Watchdog.UpdateThread(); | 233 | Watchdog.UpdateThread(); |
233 | if(req == null) | ||
234 | continue; | 234 | continue; |
235 | } | ||
236 | |||
237 | Watchdog.UpdateThread(); | ||
235 | 238 | ||
236 | try | 239 | try |
237 | { | 240 | { |
@@ -256,17 +259,18 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
256 | 259 | ||
257 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) | 260 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) |
258 | { | 261 | { |
262 | PollServiceHttpRequest nreq = req; | ||
259 | m_threadPool.QueueWorkItem(x => | 263 | m_threadPool.QueueWorkItem(x => |
260 | { | 264 | { |
261 | try | 265 | try |
262 | { | 266 | { |
263 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); | 267 | Hashtable responsedata = nreq.PollServiceArgs.GetEvents(nreq.RequestID, nreq.PollServiceArgs.Id); |
264 | req.DoHTTPGruntWork(m_server, responsedata); | 268 | nreq.DoHTTPGruntWork(m_server, responsedata); |
265 | } | 269 | } |
266 | catch (ObjectDisposedException) { } | 270 | catch (ObjectDisposedException) { } |
267 | finally | 271 | finally |
268 | { | 272 | { |
269 | byContextDequeue(req); | 273 | byContextDequeue(nreq); |
270 | } | 274 | } |
271 | return null; | 275 | return null; |
272 | }, null); | 276 | }, null); |
@@ -275,17 +279,18 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
275 | { | 279 | { |
276 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) | 280 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) |
277 | { | 281 | { |
282 | PollServiceHttpRequest nreq = req; | ||
278 | m_threadPool.QueueWorkItem(x => | 283 | m_threadPool.QueueWorkItem(x => |
279 | { | 284 | { |
280 | try | 285 | try |
281 | { | 286 | { |
282 | req.DoHTTPGruntWork(m_server, | 287 | nreq.DoHTTPGruntWork(m_server, |
283 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | 288 | nreq.PollServiceArgs.NoEvents(nreq.RequestID, nreq.PollServiceArgs.Id)); |
284 | } | 289 | } |
285 | catch (ObjectDisposedException) {} | 290 | catch (ObjectDisposedException) {} |
286 | finally | 291 | finally |
287 | { | 292 | { |
288 | byContextDequeue(req); | 293 | byContextDequeue(nreq); |
289 | } | 294 | } |
290 | return null; | 295 | return null; |
291 | }, null); | 296 | }, null); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 87ded7b..5be75fa 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | |||
@@ -28,17 +28,14 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Collections.Specialized; | 31 | using System.Collections.Concurrent; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.IO; | ||
34 | using System.Threading; | 33 | using System.Threading; |
35 | using System.Web; | ||
36 | using Mono.Addins; | 34 | using Mono.Addins; |
37 | using OpenSim.Framework.Monitoring; | 35 | using OpenSim.Framework.Monitoring; |
38 | using log4net; | 36 | using log4net; |
39 | using Nini.Config; | 37 | using Nini.Config; |
40 | using OpenMetaverse; | 38 | using OpenMetaverse; |
41 | using OpenMetaverse.StructuredData; | ||
42 | using OpenSim.Capabilities.Handlers; | 39 | using OpenSim.Capabilities.Handlers; |
43 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
44 | using OpenSim.Framework.Servers; | 41 | using OpenSim.Framework.Servers; |
@@ -57,7 +54,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
57 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
58 | 55 | ||
59 | private Scene m_scene; | 56 | private Scene m_scene; |
60 | private IAssetService m_AssetService; | ||
61 | private bool m_Enabled = true; | 57 | private bool m_Enabled = true; |
62 | private string m_URL; | 58 | private string m_URL; |
63 | 59 | ||
@@ -65,20 +61,19 @@ namespace OpenSim.Region.ClientStack.Linden | |||
65 | private string m_RedirectURL = null; | 61 | private string m_RedirectURL = null; |
66 | private string m_RedirectURL2 = null; | 62 | private string m_RedirectURL2 = null; |
67 | 63 | ||
68 | struct aPollRequest | 64 | class APollRequest |
69 | { | 65 | { |
70 | public PollServiceMeshEventArgs thepoll; | 66 | public PollServiceMeshEventArgs thepoll; |
71 | public UUID reqID; | 67 | public UUID reqID; |
72 | public Hashtable request; | 68 | public Hashtable request; |
73 | } | 69 | } |
74 | 70 | ||
75 | public class aPollResponse | 71 | public class APollResponse |
76 | { | 72 | { |
77 | public Hashtable response; | 73 | public Hashtable response; |
78 | public int bytes; | 74 | public int bytes; |
79 | } | 75 | } |
80 | 76 | ||
81 | |||
82 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 77 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
83 | 78 | ||
84 | private static GetMeshHandler m_getMeshHandler; | 79 | private static GetMeshHandler m_getMeshHandler; |
@@ -88,8 +83,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
88 | private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); | 83 | private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); |
89 | private static Thread[] m_workerThreads = null; | 84 | private static Thread[] m_workerThreads = null; |
90 | private static int m_NumberScenes = 0; | 85 | private static int m_NumberScenes = 0; |
91 | private static OpenSim.Framework.BlockingQueue<aPollRequest> m_queue = | 86 | private static BlockingCollection<APollRequest> m_queue = new BlockingCollection<APollRequest>(); |
92 | new OpenSim.Framework.BlockingQueue<aPollRequest>(); | ||
93 | 87 | ||
94 | private Dictionary<UUID, PollServiceMeshEventArgs> m_pollservices = new Dictionary<UUID, PollServiceMeshEventArgs>(); | 88 | private Dictionary<UUID, PollServiceMeshEventArgs> m_pollservices = new Dictionary<UUID, PollServiceMeshEventArgs>(); |
95 | 89 | ||
@@ -131,33 +125,35 @@ namespace OpenSim.Region.ClientStack.Linden | |||
131 | return; | 125 | return; |
132 | 126 | ||
133 | m_scene = pScene; | 127 | m_scene = pScene; |
134 | |||
135 | m_assetService = pScene.AssetService; | ||
136 | } | 128 | } |
137 | 129 | ||
138 | public void RemoveRegion(Scene scene) | 130 | public void RemoveRegion(Scene s) |
139 | { | 131 | { |
140 | if (!m_Enabled) | 132 | if (!m_Enabled) |
141 | return; | 133 | return; |
142 | 134 | ||
143 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | 135 | s.EventManager.OnRegisterCaps -= RegisterCaps; |
144 | m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; | 136 | s.EventManager.OnDeregisterCaps -= DeregisterCaps; |
145 | m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate; | 137 | s.EventManager.OnThrottleUpdate -= ThrottleUpdate; |
146 | m_NumberScenes--; | 138 | m_NumberScenes--; |
147 | m_scene = null; | 139 | m_scene = null; |
148 | } | 140 | } |
149 | 141 | ||
150 | public void RegionLoaded(Scene scene) | 142 | public void RegionLoaded(Scene s) |
151 | { | 143 | { |
152 | if (!m_Enabled) | 144 | if (!m_Enabled) |
153 | return; | 145 | return; |
154 | 146 | ||
155 | m_AssetService = m_scene.RequestModuleInterface<IAssetService>(); | 147 | if(m_assetService == null) |
156 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | 148 | { |
157 | // We'll reuse the same handler for all requests. | 149 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); |
158 | m_getMeshHandler = new GetMeshHandler(m_assetService); | 150 | // We'll reuse the same handler for all requests. |
159 | m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; | 151 | m_getMeshHandler = new GetMeshHandler(m_assetService); |
160 | m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate; | 152 | } |
153 | |||
154 | s.EventManager.OnRegisterCaps += RegisterCaps; | ||
155 | s.EventManager.OnDeregisterCaps += DeregisterCaps; | ||
156 | s.EventManager.OnThrottleUpdate += ThrottleUpdate; | ||
161 | 157 | ||
162 | m_NumberScenes++; | 158 | m_NumberScenes++; |
163 | 159 | ||
@@ -189,7 +185,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
189 | // Prevent red ink. | 185 | // Prevent red ink. |
190 | try | 186 | try |
191 | { | 187 | { |
192 | m_queue.Clear(); | 188 | m_queue.Dispose(); |
193 | } | 189 | } |
194 | catch {} | 190 | catch {} |
195 | } | 191 | } |
@@ -201,14 +197,18 @@ namespace OpenSim.Region.ClientStack.Linden | |||
201 | 197 | ||
202 | private static void DoMeshRequests() | 198 | private static void DoMeshRequests() |
203 | { | 199 | { |
204 | while(true) | 200 | while (m_NumberScenes > 0) |
205 | { | 201 | { |
206 | aPollRequest poolreq = m_queue.Dequeue(4500); | 202 | APollRequest poolreq; |
207 | Watchdog.UpdateThread(); | 203 | if(m_queue.TryTake(out poolreq, 4500)) |
208 | if(m_NumberScenes <= 0) | 204 | { |
209 | return; | 205 | if(m_NumberScenes <= 0) |
210 | if(poolreq.reqID != UUID.Zero) | 206 | break; |
211 | poolreq.thepoll.Process(poolreq); | 207 | |
208 | if(poolreq.reqID != UUID.Zero) | ||
209 | poolreq.thepoll.Process(poolreq); | ||
210 | } | ||
211 | Watchdog.UpdateThread(); | ||
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
@@ -228,8 +228,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
228 | { | 228 | { |
229 | private List<Hashtable> requests = | 229 | private List<Hashtable> requests = |
230 | new List<Hashtable>(); | 230 | new List<Hashtable>(); |
231 | private Dictionary<UUID, aPollResponse> responses = | 231 | private Dictionary<UUID, APollResponse> responses = |
232 | new Dictionary<UUID, aPollResponse>(); | 232 | new Dictionary<UUID, APollResponse>(); |
233 | private HashSet<UUID> dropedResponses = new HashSet<UUID>(); | 233 | private HashSet<UUID> dropedResponses = new HashSet<UUID>(); |
234 | 234 | ||
235 | private Scene m_scene; | 235 | private Scene m_scene; |
@@ -278,12 +278,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
278 | // x is request id, y is request data hashtable | 278 | // x is request id, y is request data hashtable |
279 | Request = (x, y) => | 279 | Request = (x, y) => |
280 | { | 280 | { |
281 | aPollRequest reqinfo = new aPollRequest(); | 281 | APollRequest reqinfo = new APollRequest(); |
282 | reqinfo.thepoll = this; | 282 | reqinfo.thepoll = this; |
283 | reqinfo.reqID = x; | 283 | reqinfo.reqID = x; |
284 | reqinfo.request = y; | 284 | reqinfo.request = y; |
285 | 285 | ||
286 | m_queue.Enqueue(reqinfo); | 286 | m_queue.Add(reqinfo); |
287 | m_throttler.PassTime(); | 287 | m_throttler.PassTime(); |
288 | }; | 288 | }; |
289 | 289 | ||
@@ -309,7 +309,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
309 | }; | 309 | }; |
310 | } | 310 | } |
311 | 311 | ||
312 | public void Process(aPollRequest requestinfo) | 312 | public void Process(APollRequest requestinfo) |
313 | { | 313 | { |
314 | Hashtable response; | 314 | Hashtable response; |
315 | 315 | ||
@@ -338,7 +338,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
338 | response["str_response_string"] = "Script timeout"; | 338 | response["str_response_string"] = "Script timeout"; |
339 | response["content_type"] = "text/plain"; | 339 | response["content_type"] = "text/plain"; |
340 | response["keepalive"] = false; | 340 | response["keepalive"] = false; |
341 | responses[requestID] = new aPollResponse() { bytes = 0, response = response}; | 341 | responses[requestID] = new APollResponse() { bytes = 0, response = response}; |
342 | 342 | ||
343 | return; | 343 | return; |
344 | } | 344 | } |
@@ -357,7 +357,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | responses[requestID] = new aPollResponse() | 360 | responses[requestID] = new APollResponse() |
361 | { | 361 | { |
362 | bytes = (int)response["int_bytes"], | 362 | bytes = (int)response["int_bytes"], |
363 | response = response | 363 | response = response |
@@ -437,7 +437,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
437 | lastTimeElapsed = Util.GetTimeStampMS(); | 437 | lastTimeElapsed = Util.GetTimeStampMS(); |
438 | } | 438 | } |
439 | 439 | ||
440 | public bool hasEvents(UUID key, Dictionary<UUID, aPollResponse> responses) | 440 | public bool hasEvents(UUID key, Dictionary<UUID, APollResponse> responses) |
441 | { | 441 | { |
442 | PassTime(); | 442 | PassTime(); |
443 | // Note, this is called IN LOCK | 443 | // Note, this is called IN LOCK |
@@ -447,7 +447,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
447 | { | 447 | { |
448 | return false; | 448 | return false; |
449 | } | 449 | } |
450 | aPollResponse response; | 450 | APollResponse response; |
451 | if (responses.TryGetValue(key, out response)) | 451 | if (responses.TryGetValue(key, out response)) |
452 | { | 452 | { |
453 | // Normal | 453 | // Normal |
@@ -472,7 +472,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
472 | return; | 472 | return; |
473 | int add = (int)(ThrottleBytes * timeElapsed * 0.001); | 473 | int add = (int)(ThrottleBytes * timeElapsed * 0.001); |
474 | if (add >= 1000) | 474 | if (add >= 1000) |
475 | { | 475 | { |
476 | lastTimeElapsed = currenttime; | 476 | lastTimeElapsed = currenttime; |
477 | BytesSent -= add; | 477 | BytesSent -= add; |
478 | if (BytesSent < 0) BytesSent = 0; | 478 | if (BytesSent < 0) BytesSent = 0; |
@@ -480,6 +480,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
480 | } | 480 | } |
481 | 481 | ||
482 | public int ThrottleBytes; | 482 | public int ThrottleBytes; |
483 | } | 483 | } |
484 | } | 484 | } |
485 | } | 485 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 9a561ea..736e18f 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Collections.Concurrent; | ||
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using System.Threading; | 33 | using System.Threading; |
33 | using log4net; | 34 | using log4net; |
@@ -51,7 +52,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
51 | public class GetTextureModule : INonSharedRegionModule | 52 | public class GetTextureModule : INonSharedRegionModule |
52 | { | 53 | { |
53 | 54 | ||
54 | struct aPollRequest | 55 | class APollRequest |
55 | { | 56 | { |
56 | public PollServiceTextureEventArgs thepoll; | 57 | public PollServiceTextureEventArgs thepoll; |
57 | public UUID reqID; | 58 | public UUID reqID; |
@@ -59,7 +60,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
59 | public bool send503; | 60 | public bool send503; |
60 | } | 61 | } |
61 | 62 | ||
62 | public class aPollResponse | 63 | public class APollResponse |
63 | { | 64 | { |
64 | public Hashtable response; | 65 | public Hashtable response; |
65 | public int bytes; | 66 | public int bytes; |
@@ -77,8 +78,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
77 | private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); | 78 | private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); |
78 | private static Thread[] m_workerThreads = null; | 79 | private static Thread[] m_workerThreads = null; |
79 | private static int m_NumberScenes = 0; | 80 | private static int m_NumberScenes = 0; |
80 | private static OpenSim.Framework.BlockingQueue<aPollRequest> m_queue = | 81 | private static BlockingCollection<APollRequest> m_queue = new BlockingCollection<APollRequest>(); |
81 | new OpenSim.Framework.BlockingQueue<aPollRequest>(); | ||
82 | 82 | ||
83 | private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>(); | 83 | private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>(); |
84 | 84 | ||
@@ -107,26 +107,29 @@ namespace OpenSim.Region.ClientStack.Linden | |||
107 | public void AddRegion(Scene s) | 107 | public void AddRegion(Scene s) |
108 | { | 108 | { |
109 | m_scene = s; | 109 | m_scene = s; |
110 | m_assetService = s.AssetService; | ||
111 | } | 110 | } |
112 | 111 | ||
113 | public void RemoveRegion(Scene s) | 112 | public void RemoveRegion(Scene s) |
114 | { | 113 | { |
115 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | 114 | s.EventManager.OnRegisterCaps -= RegisterCaps; |
116 | m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; | 115 | s.EventManager.OnDeregisterCaps -= DeregisterCaps; |
117 | m_scene.EventManager.OnThrottleUpdate -= ThrottleUpdate; | 116 | s.EventManager.OnThrottleUpdate -= ThrottleUpdate; |
118 | m_NumberScenes--; | 117 | m_NumberScenes--; |
119 | m_scene = null; | 118 | m_scene = null; |
120 | } | 119 | } |
121 | 120 | ||
122 | public void RegionLoaded(Scene s) | 121 | public void RegionLoaded(Scene s) |
123 | { | 122 | { |
124 | // We'll reuse the same handler for all requests. | 123 | if(m_assetService == null) |
125 | m_getTextureHandler = new GetTextureHandler(m_assetService); | 124 | { |
125 | m_assetService = s.RequestModuleInterface<IAssetService>(); | ||
126 | // We'll reuse the same handler for all requests. | ||
127 | m_getTextureHandler = new GetTextureHandler(m_assetService); | ||
128 | } | ||
126 | 129 | ||
127 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | 130 | s.EventManager.OnRegisterCaps += RegisterCaps; |
128 | m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; | 131 | s.EventManager.OnDeregisterCaps += DeregisterCaps; |
129 | m_scene.EventManager.OnThrottleUpdate += ThrottleUpdate; | 132 | s.EventManager.OnThrottleUpdate += ThrottleUpdate; |
130 | 133 | ||
131 | m_NumberScenes++; | 134 | m_NumberScenes++; |
132 | 135 | ||
@@ -173,7 +176,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
173 | foreach (Thread t in m_workerThreads) | 176 | foreach (Thread t in m_workerThreads) |
174 | Watchdog.AbortThread(t.ManagedThreadId); | 177 | Watchdog.AbortThread(t.ManagedThreadId); |
175 | 178 | ||
176 | m_queue.Clear(); | 179 | m_queue.Dispose(); |
177 | } | 180 | } |
178 | } | 181 | } |
179 | 182 | ||
@@ -190,8 +193,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
190 | { | 193 | { |
191 | private List<Hashtable> requests = | 194 | private List<Hashtable> requests = |
192 | new List<Hashtable>(); | 195 | new List<Hashtable>(); |
193 | private Dictionary<UUID, aPollResponse> responses = | 196 | private Dictionary<UUID, APollResponse> responses = |
194 | new Dictionary<UUID, aPollResponse>(); | 197 | new Dictionary<UUID, APollResponse>(); |
195 | private HashSet<UUID> dropedResponses = new HashSet<UUID>(); | 198 | private HashSet<UUID> dropedResponses = new HashSet<UUID>(); |
196 | 199 | ||
197 | private Scene m_scene; | 200 | private Scene m_scene; |
@@ -239,7 +242,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
239 | // x is request id, y is request data hashtable | 242 | // x is request id, y is request data hashtable |
240 | Request = (x, y) => | 243 | Request = (x, y) => |
241 | { | 244 | { |
242 | aPollRequest reqinfo = new aPollRequest(); | 245 | APollRequest reqinfo = new APollRequest(); |
243 | reqinfo.thepoll = this; | 246 | reqinfo.thepoll = this; |
244 | reqinfo.reqID = x; | 247 | reqinfo.reqID = x; |
245 | reqinfo.request = y; | 248 | reqinfo.request = y; |
@@ -249,14 +252,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
249 | { | 252 | { |
250 | if (responses.Count > 0) | 253 | if (responses.Count > 0) |
251 | { | 254 | { |
252 | if (m_queue.Count() >= 4) | 255 | if (m_queue.Count >= 4) |
253 | { | 256 | { |
254 | // Never allow more than 4 fetches to wait | 257 | // Never allow more than 4 fetches to wait |
255 | reqinfo.send503 = true; | 258 | reqinfo.send503 = true; |
256 | } | 259 | } |
257 | } | 260 | } |
258 | } | 261 | } |
259 | m_queue.Enqueue(reqinfo); | 262 | m_queue.Add(reqinfo); |
260 | m_throttler.PassTime(); | 263 | m_throttler.PassTime(); |
261 | }; | 264 | }; |
262 | 265 | ||
@@ -282,7 +285,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
282 | }; | 285 | }; |
283 | } | 286 | } |
284 | 287 | ||
285 | public void Process(aPollRequest requestinfo) | 288 | public void Process(APollRequest requestinfo) |
286 | { | 289 | { |
287 | Hashtable response; | 290 | Hashtable response; |
288 | 291 | ||
@@ -316,7 +319,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
316 | headers["Retry-After"] = 30; | 319 | headers["Retry-After"] = 30; |
317 | response["headers"] = headers; | 320 | response["headers"] = headers; |
318 | 321 | ||
319 | responses[requestID] = new aPollResponse() {bytes = 0, response = response}; | 322 | responses[requestID] = new APollResponse() {bytes = 0, response = response}; |
320 | 323 | ||
321 | return; | 324 | return; |
322 | } | 325 | } |
@@ -332,7 +335,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
332 | response["keepalive"] = false; | 335 | response["keepalive"] = false; |
333 | response["reusecontext"] = false; | 336 | response["reusecontext"] = false; |
334 | 337 | ||
335 | responses[requestID] = new aPollResponse() {bytes = 0, response = response}; | 338 | responses[requestID] = new APollResponse() {bytes = 0, response = response}; |
336 | 339 | ||
337 | return; | 340 | return; |
338 | } | 341 | } |
@@ -351,7 +354,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
351 | return; | 354 | return; |
352 | } | 355 | } |
353 | } | 356 | } |
354 | responses[requestID] = new aPollResponse() | 357 | responses[requestID] = new APollResponse() |
355 | { | 358 | { |
356 | bytes = (int) response["int_bytes"], | 359 | bytes = (int) response["int_bytes"], |
357 | response = response | 360 | response = response |
@@ -420,12 +423,20 @@ namespace OpenSim.Region.ClientStack.Linden | |||
420 | 423 | ||
421 | private static void DoTextureRequests() | 424 | private static void DoTextureRequests() |
422 | { | 425 | { |
423 | while (true) | 426 | APollRequest poolreq; |
427 | while (m_NumberScenes > 0) | ||
424 | { | 428 | { |
425 | aPollRequest poolreq = m_queue.Dequeue(4500); | 429 | poolreq = null; |
426 | Watchdog.UpdateThread(); | 430 | if(!m_queue.TryTake(out poolreq, 4500) || poolreq == null) |
431 | { | ||
432 | Watchdog.UpdateThread(); | ||
433 | continue; | ||
434 | } | ||
435 | |||
427 | if(m_NumberScenes <= 0) | 436 | if(m_NumberScenes <= 0) |
428 | return; | 437 | break; |
438 | |||
439 | Watchdog.UpdateThread(); | ||
429 | if(poolreq.reqID != UUID.Zero) | 440 | if(poolreq.reqID != UUID.Zero) |
430 | poolreq.thepoll.Process(poolreq); | 441 | poolreq.thepoll.Process(poolreq); |
431 | } | 442 | } |
@@ -442,7 +453,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
442 | ThrottleBytes = pBytes; | 453 | ThrottleBytes = pBytes; |
443 | lastTimeElapsed = Util.GetTimeStampMS(); | 454 | lastTimeElapsed = Util.GetTimeStampMS(); |
444 | } | 455 | } |
445 | public bool hasEvents(UUID key, Dictionary<UUID, GetTextureModule.aPollResponse> responses) | 456 | public bool hasEvents(UUID key, Dictionary<UUID, GetTextureModule.APollResponse> responses) |
446 | { | 457 | { |
447 | PassTime(); | 458 | PassTime(); |
448 | // Note, this is called IN LOCK | 459 | // Note, this is called IN LOCK |
@@ -451,7 +462,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
451 | { | 462 | { |
452 | return false; | 463 | return false; |
453 | } | 464 | } |
454 | GetTextureModule.aPollResponse response; | 465 | GetTextureModule.APollResponse response; |
455 | if (responses.TryGetValue(key, out response)) | 466 | if (responses.TryGetValue(key, out response)) |
456 | { | 467 | { |
457 | // This is any error response | 468 | // This is any error response |