diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/PriorityQueue.cs | 20 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 41 |
3 files changed, 28 insertions, 34 deletions
diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs index e7a7f7f..e4f1111 100644 --- a/OpenSim/Framework/PriorityQueue.cs +++ b/OpenSim/Framework/PriorityQueue.cs | |||
@@ -45,7 +45,8 @@ namespace OpenSim.Framework | |||
45 | /// <summary> | 45 | /// <summary> |
46 | /// Total number of queues (priorities) available | 46 | /// Total number of queues (priorities) available |
47 | /// </summary> | 47 | /// </summary> |
48 | public const uint NumberOfQueues = 12; | 48 | |
49 | public const uint NumberOfQueues = 12; // includes immediate queues, m_queueCounts need to be set acording | ||
49 | 50 | ||
50 | /// <summary> | 51 | /// <summary> |
51 | /// Number of queuest (priorities) that are processed immediately | 52 | /// Number of queuest (priorities) that are processed immediately |
@@ -60,7 +61,8 @@ namespace OpenSim.Framework | |||
60 | // each pass. weighted towards the higher priority queues | 61 | // each pass. weighted towards the higher priority queues |
61 | private uint m_nextQueue = 0; | 62 | private uint m_nextQueue = 0; |
62 | private uint m_countFromQueue = 0; | 63 | private uint m_countFromQueue = 0; |
63 | private uint[] m_queueCounts = { 8, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 1 }; | 64 | // first queues are imediate, so no counts |
65 | private uint[] m_queueCounts = {0, 0, 8, 4, 4, 2, 2, 2, 2, 1, 1, 1}; | ||
64 | 66 | ||
65 | // next request is a counter of the number of updates queued, it provides | 67 | // next request is a counter of the number of updates queued, it provides |
66 | // a total ordering on the updates coming through the queue and is more | 68 | // a total ordering on the updates coming through the queue and is more |
@@ -137,7 +139,7 @@ namespace OpenSim.Framework | |||
137 | /// </summary> | 139 | /// </summary> |
138 | public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue) | 140 | public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue) |
139 | { | 141 | { |
140 | // If there is anything in priority queue 0, return it first no | 142 | // If there is anything in imediate queues, return it first no |
141 | // matter what else. Breaks fairness. But very useful. | 143 | // matter what else. Breaks fairness. But very useful. |
142 | for (int iq = 0; iq < NumberOfImmediateQueues; iq++) | 144 | for (int iq = 0; iq < NumberOfImmediateQueues; iq++) |
143 | { | 145 | { |
@@ -172,14 +174,13 @@ namespace OpenSim.Framework | |||
172 | } | 174 | } |
173 | 175 | ||
174 | // Find the next non-immediate queue with updates in it | 176 | // Find the next non-immediate queue with updates in it |
175 | for (int i = 0; i < NumberOfQueues; ++i) | 177 | for (uint i = NumberOfImmediateQueues; i < NumberOfQueues; ++i) |
176 | { | 178 | { |
177 | m_nextQueue = (uint)((m_nextQueue + 1) % NumberOfQueues); | 179 | m_nextQueue++; |
178 | m_countFromQueue = m_queueCounts[m_nextQueue]; | 180 | if(m_nextQueue >= NumberOfQueues) |
181 | m_nextQueue = NumberOfImmediateQueues; | ||
179 | 182 | ||
180 | // if this is one of the immediate queues, just skip it | 183 | m_countFromQueue = m_queueCounts[m_nextQueue]; |
181 | if (m_nextQueue < NumberOfImmediateQueues) | ||
182 | continue; | ||
183 | 184 | ||
184 | if (m_heaps[m_nextQueue].Count > 0) | 185 | if (m_heaps[m_nextQueue].Count > 0) |
185 | { | 186 | { |
@@ -189,7 +190,6 @@ namespace OpenSim.Framework | |||
189 | m_lookupTable.Remove(item.Value.Entity.LocalId); | 190 | m_lookupTable.Remove(item.Value.Entity.LocalId); |
190 | timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); | 191 | timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); |
191 | value = item.Value; | 192 | value = item.Value; |
192 | |||
193 | return true; | 193 | return true; |
194 | } | 194 | } |
195 | } | 195 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index a80b1d7..9b27a6e 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | |||
@@ -47,6 +47,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
47 | public UUID Id; | 47 | public UUID Id; |
48 | public int TimeOutms; | 48 | public int TimeOutms; |
49 | public EventType Type; | 49 | public EventType Type; |
50 | public bool GetEventsNeedsRequest = true; | ||
50 | 51 | ||
51 | public enum EventType : int | 52 | public enum EventType : int |
52 | { | 53 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index c13c65b..c234537 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -205,7 +205,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
205 | String.Format("PollServiceWorkerThread{0}", i), | 205 | String.Format("PollServiceWorkerThread{0}", i), |
206 | ThreadPriority.Normal, | 206 | ThreadPriority.Normal, |
207 | false, | 207 | false, |
208 | true, | 208 | false, |
209 | null, | 209 | null, |
210 | int.MaxValue); | 210 | int.MaxValue); |
211 | } | 211 | } |
@@ -344,35 +344,36 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
344 | { | 344 | { |
345 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) | 345 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) |
346 | { | 346 | { |
347 | try | 347 | string strreq = ""; |
348 | if (req.PollServiceArgs.GetEventsNeedsRequest) | ||
348 | { | 349 | { |
349 | str = new StreamReader(req.Request.Body); | 350 | try |
351 | { | ||
352 | str = new StreamReader(req.Request.Body); | ||
353 | strreq = str.ReadToEnd(); | ||
354 | str.Close(); | ||
355 | } | ||
356 | catch | ||
357 | { | ||
358 | continue; | ||
359 | } | ||
350 | } | 360 | } |
351 | catch (System.ArgumentException) | 361 | |
352 | { | 362 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, strreq); |
353 | // Stream was not readable means a child agent | 363 | |
354 | // was closed due to logout, leaving the | 364 | if (responsedata == null) |
355 | // Event Queue request orphaned. | ||
356 | continue; | 365 | continue; |
357 | } | ||
358 | 366 | ||
359 | // "Normal" means the viewer evebt queue. We need to push these out fast. | ||
360 | // Process them inline. The rest go to the thread pool. | ||
361 | if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) | 367 | if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) |
362 | { | 368 | { |
363 | try | 369 | try |
364 | { | 370 | { |
365 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | ||
366 | DoHTTPGruntWork(m_server, req, responsedata); | 371 | DoHTTPGruntWork(m_server, req, responsedata); |
367 | } | 372 | } |
368 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | 373 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream |
369 | { | 374 | { |
370 | // Ignore it, no need to reply | 375 | // Ignore it, no need to reply |
371 | } | 376 | } |
372 | finally | ||
373 | { | ||
374 | str.Close(); | ||
375 | } | ||
376 | } | 377 | } |
377 | else | 378 | else |
378 | { | 379 | { |
@@ -380,27 +381,19 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
380 | { | 381 | { |
381 | try | 382 | try |
382 | { | 383 | { |
383 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | ||
384 | DoHTTPGruntWork(m_server, req, responsedata); | 384 | DoHTTPGruntWork(m_server, req, responsedata); |
385 | } | 385 | } |
386 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | 386 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream |
387 | { | 387 | { |
388 | // Ignore it, no need to reply | 388 | // Ignore it, no need to reply |
389 | } | 389 | } |
390 | finally | ||
391 | { | ||
392 | str.Close(); | ||
393 | } | ||
394 | 390 | ||
395 | return null; | 391 | return null; |
396 | }, null); | 392 | }, null); |
397 | } | 393 | } |
398 | |||
399 | } | 394 | } |
400 | else | 395 | else |
401 | { | 396 | { |
402 | // if ((Environment.TickCount - req.RequestTime) > m_timeout) | ||
403 | |||
404 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) | 397 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) |
405 | { | 398 | { |
406 | DoHTTPGruntWork(m_server, req, | 399 | DoHTTPGruntWork(m_server, req, |