aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs49
1 files changed, 45 insertions, 4 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
index 7cd27e5..1e3fbf0 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
@@ -94,8 +94,7 @@ namespace OpenSim.Framework.Servers.HttpServer
94 try 94 try
95 { 95 {
96 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); 96 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
97 m_server.DoHTTPGruntWork(responsedata, 97 DoHTTPGruntWork(m_server, req, responsedata);
98 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
99 } 98 }
100 catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream 99 catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
101 { 100 {
@@ -106,8 +105,10 @@ namespace OpenSim.Framework.Servers.HttpServer
106 { 105 {
107 if ((Environment.TickCount - req.RequestTime) > m_timeout) 106 if ((Environment.TickCount - req.RequestTime) > m_timeout)
108 { 107 {
109 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), 108 DoHTTPGruntWork(
110 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); 109 m_server,
110 req,
111 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
111 } 112 }
112 else 113 else
113 { 114 {
@@ -128,6 +129,46 @@ namespace OpenSim.Framework.Servers.HttpServer
128 { 129 {
129 m_request.Enqueue(pPollServiceHttpRequest); 130 m_request.Enqueue(pPollServiceHttpRequest);
130 } 131 }
132
133 /// <summary>
134 /// FIXME: This should be part of BaseHttpServer
135 /// </summary>
136 internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata)
137 {
138 OSHttpResponse response
139 = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext);
140
141 byte[] buffer = server.DoHTTPGruntWork(responsedata, response);
142
143 response.SendChunked = false;
144 response.ContentLength64 = buffer.Length;
145 response.ContentEncoding = Encoding.UTF8;
146
147 try
148 {
149 response.OutputStream.Write(buffer, 0, buffer.Length);
150 }
151 catch (Exception ex)
152 {
153 m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex));
154 }
155 finally
156 {
157 //response.OutputStream.Close();
158 try
159 {
160 response.OutputStream.Flush();
161 response.Send();
162
163 //if (!response.KeepAlive && response.ReuseContext)
164 // response.FreeContext();
165 }
166 catch (Exception e)
167 {
168 m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e));
169 }
170 }
171 }
131 } 172 }
132} 173}
133*/ \ No newline at end of file 174*/ \ No newline at end of file