diff options
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | 53 |
1 files changed, 48 insertions, 5 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index 5e171f0..2995421 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | |||
@@ -90,15 +90,16 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
90 | } | 90 | } |
91 | 91 | ||
92 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | 92 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); |
93 | m_server.DoHTTPGruntWork(responsedata, | 93 | DoHTTPGruntWork(m_server, req, responsedata); |
94 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); | ||
95 | } | 94 | } |
96 | else | 95 | else |
97 | { | 96 | { |
98 | if ((Environment.TickCount - req.RequestTime) > m_timeout) | 97 | if ((Environment.TickCount - req.RequestTime) > m_timeout) |
99 | { | 98 | { |
100 | m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), | 99 | DoHTTPGruntWork( |
101 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); | 100 | m_server, |
101 | req, | ||
102 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||
102 | } | 103 | } |
103 | else | 104 | else |
104 | { | 105 | { |
@@ -119,5 +120,47 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
119 | { | 120 | { |
120 | m_request.Enqueue(pPollServiceHttpRequest); | 121 | m_request.Enqueue(pPollServiceHttpRequest); |
121 | } | 122 | } |
123 | |||
124 | /// <summary> | ||
125 | /// FIXME: This should be part of BaseHttpServer | ||
126 | /// </summary> | ||
127 | internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata) | ||
128 | { | ||
129 | OSHttpResponse response | ||
130 | = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext); | ||
131 | |||
132 | byte[] buffer | ||
133 | = server.DoHTTPGruntWork( | ||
134 | responsedata, new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); | ||
135 | |||
136 | response.SendChunked = false; | ||
137 | response.ContentLength64 = buffer.Length; | ||
138 | response.ContentEncoding = Encoding.UTF8; | ||
139 | |||
140 | try | ||
141 | { | ||
142 | response.OutputStream.Write(buffer, 0, buffer.Length); | ||
143 | } | ||
144 | catch (Exception ex) | ||
145 | { | ||
146 | m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex)); | ||
147 | } | ||
148 | finally | ||
149 | { | ||
150 | //response.OutputStream.Close(); | ||
151 | try | ||
152 | { | ||
153 | response.OutputStream.Flush(); | ||
154 | response.Send(); | ||
155 | |||
156 | //if (!response.KeepAlive && response.ReuseContext) | ||
157 | // response.FreeContext(); | ||
158 | } | ||
159 | catch (Exception e) | ||
160 | { | ||
161 | m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e)); | ||
162 | } | ||
163 | } | ||
164 | } | ||
122 | } | 165 | } |
123 | } | 166 | } \ No newline at end of file |