diff options
author | Justin Clark-Casey (justincc) | 2013-07-15 23:22:39 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-07-15 23:27:46 +0100 |
commit | 1b7b664c8696531fec26378d1386362d8a3da55e (patch) | |
tree | 1bdf9c56b647c7d5fa47289ec8323c4d35ae09ca /OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |
parent | Reinsert PhysicsActor variable back into SOP.SubscribeForCollisionEvents() in... (diff) | |
download | opensim-SC_OLD-1b7b664c8696531fec26378d1386362d8a3da55e.zip opensim-SC_OLD-1b7b664c8696531fec26378d1386362d8a3da55e.tar.gz opensim-SC_OLD-1b7b664c8696531fec26378d1386362d8a3da55e.tar.bz2 opensim-SC_OLD-1b7b664c8696531fec26378d1386362d8a3da55e.tar.xz |
Add request received/handling stats for caps which are served by http poll handlers.
This adds explicit cap poll handler supporting to the Caps classes rather than relying on callers to do the complicated coding.
Other refactoring was required to get logic into the right places to support this.
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 58 |
1 files changed, 8 insertions, 50 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index aee3e3c..1b9010a 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -157,8 +157,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
157 | { | 157 | { |
158 | foreach (PollServiceHttpRequest req in m_retryRequests) | 158 | foreach (PollServiceHttpRequest req in m_retryRequests) |
159 | { | 159 | { |
160 | DoHTTPGruntWork(m_server,req, | 160 | req.DoHTTPGruntWork(m_server, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); |
161 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||
162 | } | 161 | } |
163 | } | 162 | } |
164 | catch | 163 | catch |
@@ -179,8 +178,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
179 | try | 178 | try |
180 | { | 179 | { |
181 | wreq = m_requests.Dequeue(0); | 180 | wreq = m_requests.Dequeue(0); |
182 | DoHTTPGruntWork(m_server,wreq, | 181 | wreq.DoHTTPGruntWork( |
183 | wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id)); | 182 | m_server, wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id)); |
184 | } | 183 | } |
185 | catch | 184 | catch |
186 | { | 185 | { |
@@ -214,7 +213,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
214 | { | 213 | { |
215 | try | 214 | try |
216 | { | 215 | { |
217 | DoHTTPGruntWork(m_server, req, responsedata); | 216 | req.DoHTTPGruntWork(m_server, responsedata); |
218 | } | 217 | } |
219 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | 218 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream |
220 | { | 219 | { |
@@ -227,7 +226,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
227 | { | 226 | { |
228 | try | 227 | try |
229 | { | 228 | { |
230 | DoHTTPGruntWork(m_server, req, responsedata); | 229 | req.DoHTTPGruntWork(m_server, responsedata); |
231 | } | 230 | } |
232 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | 231 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream |
233 | { | 232 | { |
@@ -242,8 +241,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
242 | { | 241 | { |
243 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) | 242 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) |
244 | { | 243 | { |
245 | DoHTTPGruntWork(m_server, req, | 244 | req.DoHTTPGruntWork( |
246 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | 245 | m_server, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); |
247 | } | 246 | } |
248 | else | 247 | else |
249 | { | 248 | { |
@@ -258,46 +257,5 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
258 | } | 257 | } |
259 | } | 258 | } |
260 | } | 259 | } |
261 | |||
262 | // DoHTTPGruntWork changed, not sending response | ||
263 | // do the same work around as core | ||
264 | |||
265 | internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata) | ||
266 | { | ||
267 | OSHttpResponse response | ||
268 | = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext); | ||
269 | |||
270 | byte[] buffer = server.DoHTTPGruntWork(responsedata, response); | ||
271 | |||
272 | response.SendChunked = false; | ||
273 | response.ContentLength64 = buffer.Length; | ||
274 | response.ContentEncoding = Encoding.UTF8; | ||
275 | |||
276 | try | ||
277 | { | ||
278 | response.OutputStream.Write(buffer, 0, buffer.Length); | ||
279 | } | ||
280 | catch (Exception ex) | ||
281 | { | ||
282 | m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex)); | ||
283 | } | ||
284 | finally | ||
285 | { | ||
286 | //response.OutputStream.Close(); | ||
287 | try | ||
288 | { | ||
289 | response.OutputStream.Flush(); | ||
290 | response.Send(); | ||
291 | |||
292 | //if (!response.KeepAlive && response.ReuseContext) | ||
293 | // response.FreeContext(); | ||
294 | } | ||
295 | catch (Exception e) | ||
296 | { | ||
297 | m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e)); | ||
298 | } | ||
299 | } | ||
300 | } | ||
301 | } | 260 | } |
302 | } | 261 | } \ No newline at end of file |
303 | |||