diff options
Merge branch 'ubitwork' into avination
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index af40185..a3bd330 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -288,9 +288,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
288 | { | 288 | { |
289 | foreach (PollServiceHttpRequest req in m_retryRequests) | 289 | foreach (PollServiceHttpRequest req in m_retryRequests) |
290 | { | 290 | { |
291 | m_server.DoHTTPGruntWork( | 291 | DoHTTPGruntWork(m_server,req, |
292 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), | 292 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); |
293 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); | ||
294 | } | 293 | } |
295 | } | 294 | } |
296 | catch | 295 | catch |
@@ -311,9 +310,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
311 | try | 310 | try |
312 | { | 311 | { |
313 | wreq = m_requests.Dequeue(0); | 312 | wreq = m_requests.Dequeue(0); |
314 | m_server.DoHTTPGruntWork( | 313 | DoHTTPGruntWork(m_server,wreq, |
315 | wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id), | 314 | wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id)); |
316 | new OSHttpResponse(new HttpResponse(wreq.HttpContext, wreq.Request), wreq.HttpContext)); | ||
317 | } | 315 | } |
318 | catch | 316 | catch |
319 | { | 317 | { |
@@ -357,8 +355,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
357 | try | 355 | try |
358 | { | 356 | { |
359 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | 357 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); |
360 | m_server.DoHTTPGruntWork(responsedata, | 358 | DoHTTPGruntWork(m_server, req, responsedata); |
361 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); | ||
362 | } | 359 | } |
363 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | 360 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream |
364 | { | 361 | { |
@@ -374,8 +371,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
374 | 371 | ||
375 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) | 372 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) |
376 | { | 373 | { |
377 | m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), | 374 | DoHTTPGruntWork(m_server, req, |
378 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); | 375 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); |
379 | } | 376 | } |
380 | else | 377 | else |
381 | { | 378 | { |
@@ -390,6 +387,46 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
390 | } | 387 | } |
391 | } | 388 | } |
392 | } | 389 | } |
390 | |||
391 | // DoHTTPGruntWork changed, not sending response | ||
392 | // do the same work around as core | ||
393 | |||
394 | internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata) | ||
395 | { | ||
396 | OSHttpResponse response | ||
397 | = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext); | ||
398 | |||
399 | byte[] buffer = server.DoHTTPGruntWork(responsedata, response); | ||
400 | |||
401 | response.SendChunked = false; | ||
402 | response.ContentLength64 = buffer.Length; | ||
403 | response.ContentEncoding = Encoding.UTF8; | ||
404 | |||
405 | try | ||
406 | { | ||
407 | response.OutputStream.Write(buffer, 0, buffer.Length); | ||
408 | } | ||
409 | catch (Exception ex) | ||
410 | { | ||
411 | m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex)); | ||
412 | } | ||
413 | finally | ||
414 | { | ||
415 | //response.OutputStream.Close(); | ||
416 | try | ||
417 | { | ||
418 | response.OutputStream.Flush(); | ||
419 | response.Send(); | ||
420 | |||
421 | //if (!response.KeepAlive && response.ReuseContext) | ||
422 | // response.FreeContext(); | ||
423 | } | ||
424 | catch (Exception e) | ||
425 | { | ||
426 | m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e)); | ||
427 | } | ||
428 | } | ||
429 | } | ||
393 | } | 430 | } |
394 | } | 431 | } |
395 | 432 | ||