aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
authorDiva Canto2013-07-19 13:17:15 -0700
committerDiva Canto2013-07-21 08:59:48 -0700
commitedafea6ae6dd3617520d989fb2fe748e3f0de1b3 (patch)
tree88b9c89f0d6a87070ebabb6224ffd9c8256fd05f /OpenSim/Framework/Servers
parentfurhter shorten CheckAgentUpdateSignificance(). No real perf impact. (diff)
downloadopensim-SC_OLD-edafea6ae6dd3617520d989fb2fe748e3f0de1b3.zip
opensim-SC_OLD-edafea6ae6dd3617520d989fb2fe748e3f0de1b3.tar.gz
opensim-SC_OLD-edafea6ae6dd3617520d989fb2fe748e3f0de1b3.tar.bz2
opensim-SC_OLD-edafea6ae6dd3617520d989fb2fe748e3f0de1b3.tar.xz
PollServiceRequestManager: changed the long poll from a Queue to a List. No need to dequeue and enqueue items every 1sec.
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs30
1 files changed, 17 insertions, 13 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index 727dbe5..309b71f 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Framework.Servers.HttpServer
47 private readonly BaseHttpServer m_server; 47 private readonly BaseHttpServer m_server;
48 48
49 private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>(); 49 private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>();
50 private static Queue<PollServiceHttpRequest> m_longPollRequests = new Queue<PollServiceHttpRequest>(); 50 private static List<PollServiceHttpRequest> m_longPollRequests = new List<PollServiceHttpRequest>();
51 51
52 private uint m_WorkerThreadCount = 0; 52 private uint m_WorkerThreadCount = 0;
53 private Thread[] m_workerThreads; 53 private Thread[] m_workerThreads;
@@ -116,7 +116,7 @@ namespace OpenSim.Framework.Servers.HttpServer
116 if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LongPoll) 116 if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LongPoll)
117 { 117 {
118 lock (m_longPollRequests) 118 lock (m_longPollRequests)
119 m_longPollRequests.Enqueue(req); 119 m_longPollRequests.Add(req);
120 } 120 }
121 else 121 else
122 m_requests.Enqueue(req); 122 m_requests.Enqueue(req);
@@ -139,18 +139,21 @@ namespace OpenSim.Framework.Servers.HttpServer
139 List<PollServiceHttpRequest> not_ready = new List<PollServiceHttpRequest>(); 139 List<PollServiceHttpRequest> not_ready = new List<PollServiceHttpRequest>();
140 lock (m_longPollRequests) 140 lock (m_longPollRequests)
141 { 141 {
142 while (m_longPollRequests.Count > 0 && m_running) 142 if (m_longPollRequests.Count > 0 && m_running)
143 { 143 {
144 PollServiceHttpRequest req = m_longPollRequests.Dequeue(); 144 List<PollServiceHttpRequest> ready = m_longPollRequests.FindAll(req =>
145 if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id) || // there are events in this EQ 145 (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id) || // there are events in this EQ
146 (Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) // no events, but timeout 146 (Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) // no events, but timeout
147 m_requests.Enqueue(req); 147 );
148 else
149 not_ready.Add(req);
150 }
151 148
152 foreach (PollServiceHttpRequest req in not_ready) 149 ready.ForEach(req =>
153 m_longPollRequests.Enqueue(req); 150 {
151 m_log.DebugFormat("[YYY]: --> Enqueuing");
152 m_requests.Enqueue(req);
153 m_longPollRequests.Remove(req);
154 });
155
156 }
154 157
155 } 158 }
156 } 159 }
@@ -169,8 +172,8 @@ namespace OpenSim.Framework.Servers.HttpServer
169 172
170 lock (m_longPollRequests) 173 lock (m_longPollRequests)
171 { 174 {
172 while (m_longPollRequests.Count > 0 && m_running) 175 if (m_longPollRequests.Count > 0 && m_running)
173 m_requests.Enqueue(m_longPollRequests.Dequeue()); 176 m_longPollRequests.ForEach(req => m_requests.Enqueue(req));
174 } 177 }
175 178
176 while (m_requests.Count() > 0) 179 while (m_requests.Count() > 0)
@@ -186,6 +189,7 @@ namespace OpenSim.Framework.Servers.HttpServer
186 } 189 }
187 } 190 }
188 191
192 m_longPollRequests.Clear();
189 m_requests.Clear(); 193 m_requests.Clear();
190 } 194 }
191 195