diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index d8cbeac..41fb376 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | |||
@@ -59,6 +59,8 @@ using System.IO; | |||
59 | using System.Text; | 59 | using System.Text; |
60 | using HttpServer; | 60 | using HttpServer; |
61 | using OpenMetaverse; | 61 | using OpenMetaverse; |
62 | using System.Reflection; | ||
63 | using log4net; | ||
62 | 64 | ||
63 | namespace OpenSim.Framework.Servers.HttpServer | 65 | namespace OpenSim.Framework.Servers.HttpServer |
64 | { | 66 | { |
@@ -66,6 +68,10 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
66 | 68 | ||
67 | public class PollServiceWorkerThread | 69 | public class PollServiceWorkerThread |
68 | { | 70 | { |
71 | private static readonly ILog m_log = | ||
72 | LogManager.GetLogger( | ||
73 | MethodBase.GetCurrentMethod().DeclaringType); | ||
74 | |||
69 | public event ReQueuePollServiceItem ReQueue; | 75 | public event ReQueuePollServiceItem ReQueue; |
70 | 76 | ||
71 | private readonly BaseHttpServer m_server; | 77 | private readonly BaseHttpServer m_server; |
@@ -92,31 +98,36 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
92 | while (m_running) | 98 | while (m_running) |
93 | { | 99 | { |
94 | PollServiceHttpRequest req = m_request.Dequeue(); | 100 | PollServiceHttpRequest req = m_request.Dequeue(); |
95 | if (req.PollServiceArgs.HasEvents(req.PollServiceArgs.Id)) | 101 | try |
96 | { | 102 | { |
97 | StreamReader str = new StreamReader(req.Request.Body); | 103 | if (req.PollServiceArgs.HasEvents(req.PollServiceArgs.Id)) |
98 | |||
99 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd()); | ||
100 | m_server.DoHTTPGruntWork(responsedata, | ||
101 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); | ||
102 | } | ||
103 | else | ||
104 | { | ||
105 | if ((Environment.TickCount - req.RequestTime) > m_timeout) | ||
106 | { | 104 | { |
107 | m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), | 105 | StreamReader str = new StreamReader(req.Request.Body); |
106 | |||
107 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd()); | ||
108 | m_server.DoHTTPGruntWork(responsedata, | ||
108 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); | 109 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); |
109 | } | 110 | } |
110 | else | 111 | else |
111 | { | 112 | { |
112 | ReQueuePollServiceItem reQueueItem = ReQueue; | 113 | if ((Environment.TickCount - req.RequestTime) > m_timeout) |
113 | if (reQueueItem != null) | 114 | { |
114 | reQueueItem(req); | 115 | m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), |
116 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | ReQueuePollServiceItem reQueueItem = ReQueue; | ||
121 | if (reQueueItem != null) | ||
122 | reQueueItem(req); | ||
123 | } | ||
115 | } | 124 | } |
116 | } | 125 | } |
126 | catch (Exception e) | ||
127 | { | ||
128 | m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); | ||
129 | } | ||
117 | } | 130 | } |
118 | |||
119 | |||
120 | } | 131 | } |
121 | 132 | ||
122 | internal void Enqueue(PollServiceHttpRequest pPollServiceHttpRequest) | 133 | internal void Enqueue(PollServiceHttpRequest pPollServiceHttpRequest) |