aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-06-13 00:03:44 +0100
committerJustin Clark-Casey (justincc)2012-06-13 00:03:44 +0100
commitc6e375291a8fa3dbdcbd25cfb64bf0d536707fb0 (patch)
tree1d86b771a74c688932ea51160cd648cfe9b45829 /OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
parentRemove accidental timeout left in during earlier debugging. Has been in sinc... (diff)
downloadopensim-SC_OLD-c6e375291a8fa3dbdcbd25cfb64bf0d536707fb0.zip
opensim-SC_OLD-c6e375291a8fa3dbdcbd25cfb64bf0d536707fb0.tar.gz
opensim-SC_OLD-c6e375291a8fa3dbdcbd25cfb64bf0d536707fb0.tar.bz2
opensim-SC_OLD-c6e375291a8fa3dbdcbd25cfb64bf0d536707fb0.tar.xz
Don't include time to transmit response back to requester when assessing slow handling of requests.
This is to avoid logging a 'slow' request when the source of delay is the viewer in processing a response. This is not something we can do much about on the server end - it's server-side delay that we're interested in. To ensure consistency, this commit also had to refactor and simplify inbound non-poll network request handling, though there should be no functional change. IOSHttpResponse no longer exposes the Send() method, only classes in OpenSim.Framework.Servers.HttpServer should be doing this. Only the GetTextureHandler was sending its own response. Now it leaves this to BaseHttpServer, like all other core handlers.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs53
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