diff options
author | UbitUmarov | 2018-01-21 21:02:07 +0000 |
---|---|---|
committer | UbitUmarov | 2018-01-21 21:02:07 +0000 |
commit | 855dcda9c358d2688d749d1571f8edc473d4b851 (patch) | |
tree | 713d66f1ecbb63a9ea4722bc7e752e026c30bcf7 /OpenSim/Framework/Servers | |
parent | give concurrentqueue another chance (diff) | |
download | opensim-SC-855dcda9c358d2688d749d1571f8edc473d4b851.zip opensim-SC-855dcda9c358d2688d749d1571f8edc473d4b851.tar.gz opensim-SC-855dcda9c358d2688d749d1571f8edc473d4b851.tar.bz2 opensim-SC-855dcda9c358d2688d749d1571f8edc473d4b851.tar.xz |
give BlockingCollection another chance
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index bbfab64..3f43149 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
44 | private readonly BaseHttpServer m_server; | 44 | private readonly BaseHttpServer m_server; |
45 | 45 | ||
46 | private Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>> m_bycontext; | 46 | private Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>> m_bycontext; |
47 | private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>(); | 47 | private BlockingCollection<PollServiceHttpRequest> m_requests = new BlockingCollection<PollServiceHttpRequest>(); |
48 | private static ConcurrentQueue<PollServiceHttpRequest> m_retryRequests = new ConcurrentQueue<PollServiceHttpRequest>(); | 48 | private static ConcurrentQueue<PollServiceHttpRequest> m_retryRequests = new ConcurrentQueue<PollServiceHttpRequest>(); |
49 | 49 | ||
50 | private uint m_WorkerThreadCount = 0; | 50 | private uint m_WorkerThreadCount = 0; |
@@ -166,7 +166,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
166 | public void EnqueueInt(PollServiceHttpRequest req) | 166 | public void EnqueueInt(PollServiceHttpRequest req) |
167 | { | 167 | { |
168 | if (m_running) | 168 | if (m_running) |
169 | m_requests.Enqueue(req); | 169 | m_requests.Add(req); |
170 | } | 170 | } |
171 | 171 | ||
172 | private void CheckRetries() | 172 | private void CheckRetries() |
@@ -177,7 +177,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
177 | Thread.Sleep(100); | 177 | Thread.Sleep(100); |
178 | Watchdog.UpdateThread(); | 178 | Watchdog.UpdateThread(); |
179 | while (m_running && m_retryRequests.TryDequeue(out preq)) | 179 | while (m_running && m_retryRequests.TryDequeue(out preq)) |
180 | m_requests.Enqueue(preq); | 180 | m_requests.Add(preq); |
181 | } | 181 | } |
182 | } | 182 | } |
183 | 183 | ||
@@ -198,9 +198,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
198 | qu.Clear(); | 198 | qu.Clear(); |
199 | m_bycontext.Clear(); | 199 | m_bycontext.Clear(); |
200 | 200 | ||
201 | PollServiceHttpRequest req; | ||
201 | try | 202 | try |
202 | { | 203 | { |
203 | PollServiceHttpRequest req; | ||
204 | while(m_retryRequests.TryDequeue(out req)) | 204 | while(m_retryRequests.TryDequeue(out req)) |
205 | req.DoHTTPstop(m_server); | 205 | req.DoHTTPstop(m_server); |
206 | } | 206 | } |
@@ -208,21 +208,17 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
208 | { | 208 | { |
209 | } | 209 | } |
210 | 210 | ||
211 | PollServiceHttpRequest wreq; | 211 | try |
212 | |||
213 | while (m_requests.Count() > 0) | ||
214 | { | 212 | { |
215 | try | 213 | while(m_requests.TryTake(out req, 0)) |
216 | { | 214 | req.DoHTTPstop(m_server); |
217 | wreq = m_requests.Dequeue(0); | ||
218 | wreq.DoHTTPstop(m_server); | ||
219 | } | ||
220 | catch | ||
221 | { | ||
222 | } | ||
223 | } | 215 | } |
216 | catch | ||
217 | { | ||
218 | } | ||
219 | |||
220 | m_requests.Dispose(); | ||
224 | 221 | ||
225 | m_requests.Clear(); | ||
226 | } | 222 | } |
227 | 223 | ||
228 | // work threads | 224 | // work threads |
@@ -231,7 +227,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
231 | { | 227 | { |
232 | while (m_running) | 228 | while (m_running) |
233 | { | 229 | { |
234 | PollServiceHttpRequest req = m_requests.Dequeue(4500); | 230 | PollServiceHttpRequest req; |
231 | m_requests.TryTake(out req, 4500); | ||
235 | Watchdog.UpdateThread(); | 232 | Watchdog.UpdateThread(); |
236 | if(req == null) | 233 | if(req == null) |
237 | continue; | 234 | continue; |