From 654dd289f263a4eef4f2aa70a1cb8d289ec7e04c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Sep 2012 03:05:27 +0100 Subject: more changes to PollService --- .../Servers/HttpServer/PollServiceEventArgs.cs | 1 + .../HttpServer/PollServiceRequestManager.cs | 41 +++++++++------------- 2 files changed, 18 insertions(+), 24 deletions(-) (limited to 'OpenSim/Framework/Servers/HttpServer') 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 public UUID Id; public int TimeOutms; public EventType Type; + public bool GetEventsNeedsRequest = true; public enum EventType : int { 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 String.Format("PollServiceWorkerThread{0}", i), ThreadPriority.Normal, false, - true, + false, null, int.MaxValue); } @@ -344,35 +344,36 @@ namespace OpenSim.Framework.Servers.HttpServer { if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) { - try + string strreq = ""; + if (req.PollServiceArgs.GetEventsNeedsRequest) { - str = new StreamReader(req.Request.Body); + try + { + str = new StreamReader(req.Request.Body); + strreq = str.ReadToEnd(); + str.Close(); + } + catch + { + continue; + } } - catch (System.ArgumentException) - { - // Stream was not readable means a child agent - // was closed due to logout, leaving the - // Event Queue request orphaned. + + Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, strreq); + + if (responsedata == null) continue; - } - // "Normal" means the viewer evebt queue. We need to push these out fast. - // Process them inline. The rest go to the thread pool. if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) { try { - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); DoHTTPGruntWork(m_server, req, responsedata); } catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream { // Ignore it, no need to reply } - finally - { - str.Close(); - } } else { @@ -380,27 +381,19 @@ namespace OpenSim.Framework.Servers.HttpServer { try { - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); DoHTTPGruntWork(m_server, req, responsedata); } catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream { // Ignore it, no need to reply } - finally - { - str.Close(); - } return null; }, null); } - } else { -// if ((Environment.TickCount - req.RequestTime) > m_timeout) - if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) { DoHTTPGruntWork(m_server, req, -- cgit v1.1