* An attempt to fix mantis #3953

trunk
Teravus Ovares 2009-07-29 20:32:54 +00:00
parent cbeebc209d
commit f727f26bcc
8 changed files with 36 additions and 8 deletions

View File

@ -274,7 +274,7 @@ namespace OpenSim.Framework.Servers.HttpServer
public void OnHandleRequestIOThread(IHttpClientContext context, IHttpRequest request) public void OnHandleRequestIOThread(IHttpClientContext context, IHttpRequest request)
{ {
OSHttpRequest req = new OSHttpRequest(context, request); OSHttpRequest req = new OSHttpRequest(context, request);
OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request)); OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context);
//resp.KeepAlive = req.KeepAlive; //resp.KeepAlive = req.KeepAlive;
//m_log.Info("[Debug BASE HTTP SERVER]: Got Request"); //m_log.Info("[Debug BASE HTTP SERVER]: Got Request");
//HttpServerContextObj objstate= new HttpServerContextObj(req,resp); //HttpServerContextObj objstate= new HttpServerContextObj(req,resp);
@ -444,6 +444,7 @@ namespace OpenSim.Framework.Servers.HttpServer
try try
{ {
response.Send(); response.Send();
response.FreeContext();
} }
catch (SocketException e) catch (SocketException e)
{ {
@ -746,6 +747,7 @@ namespace OpenSim.Framework.Servers.HttpServer
try try
{ {
response.Send(); response.Send();
response.FreeContext();
} }
catch (SocketException e) catch (SocketException e)
{ {
@ -778,6 +780,7 @@ namespace OpenSim.Framework.Servers.HttpServer
try try
{ {
response.Send(); response.Send();
response.FreeContext();
} }
catch (SocketException e) catch (SocketException e)
{ {
@ -888,6 +891,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
response.Send(); response.Send();
response.OutputStream.Flush(); response.OutputStream.Flush();
response.FreeContext();
//response.OutputStream.Close(); //response.OutputStream.Close();
} }
catch (IOException e) catch (IOException e)
@ -1103,6 +1107,7 @@ namespace OpenSim.Framework.Servers.HttpServer
try try
{ {
response.Send(); response.Send();
response.FreeContext();
} }
catch (SocketException f) catch (SocketException f)
{ {
@ -1377,7 +1382,11 @@ namespace OpenSim.Framework.Servers.HttpServer
//response.OutputStream.Close(); //response.OutputStream.Close();
try try
{ {
response.OutputStream.Flush();
response.Send(); response.Send();
if (!response.KeepAlive)
response.FreeContext();
} }
catch (SocketException e) catch (SocketException e)
{ {
@ -1414,6 +1423,7 @@ namespace OpenSim.Framework.Servers.HttpServer
try try
{ {
response.Send(); response.Send();
response.FreeContext();
} }
catch (SocketException e) catch (SocketException e)
{ {
@ -1449,6 +1459,7 @@ namespace OpenSim.Framework.Servers.HttpServer
try try
{ {
response.Send(); response.Send();
response.FreeContext();
} }
catch (SocketException e) catch (SocketException e)
{ {

View File

@ -258,6 +258,7 @@ namespace OpenSim.Framework.Servers.HttpServer
protected IHttpResponse _httpResponse; protected IHttpResponse _httpResponse;
private IHttpClientContext _httpClientContext;
public OSHttpResponse() {} public OSHttpResponse() {}
@ -275,6 +276,12 @@ namespace OpenSim.Framework.Servers.HttpServer
public OSHttpResponse(OSHttpRequest req) public OSHttpResponse(OSHttpRequest req)
{ {
_httpResponse = new HttpResponse(req.IHttpClientContext, req.IHttpRequest); _httpResponse = new HttpResponse(req.IHttpClientContext, req.IHttpRequest);
_httpClientContext = req.IHttpClientContext;
}
public OSHttpResponse(HttpResponse resp, IHttpClientContext clientContext)
{
_httpResponse = resp;
_httpClientContext = clientContext;
} }
/// <summary> /// <summary>
@ -298,5 +305,11 @@ namespace OpenSim.Framework.Servers.HttpServer
_httpResponse.Send(); _httpResponse.Send();
} }
public void FreeContext()
{
if (_httpClientContext != null)
_httpClientContext.Close();
}
} }
} }

View File

@ -130,7 +130,7 @@ namespace OpenSim.Framework.Servers.HttpServer
foreach (object o in m_requests) foreach (object o in m_requests)
{ {
PollServiceHttpRequest req = (PollServiceHttpRequest) o; PollServiceHttpRequest req = (PollServiceHttpRequest) o;
m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request))); m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));
} }
m_requests.Clear(); m_requests.Clear();

View File

@ -44,7 +44,7 @@ namespace OpenSim.Framework.Servers.HttpServer
private readonly BaseHttpServer m_server; private readonly BaseHttpServer m_server;
private BlockingQueue<PollServiceHttpRequest> m_request; private BlockingQueue<PollServiceHttpRequest> m_request;
private bool m_running = true; private bool m_running = true;
private int m_timeout = 25000; private int m_timeout = 250;
@ -71,14 +71,14 @@ namespace OpenSim.Framework.Servers.HttpServer
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd()); Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd());
m_server.DoHTTPGruntWork(responsedata, m_server.DoHTTPGruntWork(responsedata,
new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request))); new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
} }
else else
{ {
if ((Environment.TickCount - req.RequestTime) > m_timeout) if ((Environment.TickCount - req.RequestTime) > m_timeout)
{ {
m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(),
new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request))); new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
} }
else else
{ {

View File

@ -1618,6 +1618,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
agentData.lastname = m_lastName; agentData.lastname = m_lastName;
ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>(); ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>();
if (capsModule == null) // can happen when shutting down.
return agentData;
agentData.CapsPath = capsModule.GetCapsPath(m_agentId); agentData.CapsPath = capsModule.GetCapsPath(m_agentId);
agentData.ChildrenCapSeeds = new Dictionary<ulong,string>(capsModule.GetChildrenSeeds(m_agentId)); agentData.ChildrenCapSeeds = new Dictionary<ulong,string>(capsModule.GetChildrenSeeds(m_agentId));

View File

@ -375,7 +375,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
Hashtable responsedata = new Hashtable(); Hashtable responsedata = new Hashtable();
responsedata["int_response_code"] = 200; responsedata["int_response_code"] = 200;
responsedata["content_type"] = "application/xml"; responsedata["content_type"] = "application/xml";
responsedata["keepalive"] = false; responsedata["keepalive"] = true;
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events); responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
return responsedata; return responsedata;
//m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]); //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
@ -386,7 +386,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
Hashtable responsedata = new Hashtable(); Hashtable responsedata = new Hashtable();
responsedata["int_response_code"] = 502; responsedata["int_response_code"] = 502;
responsedata["content_type"] = "text/plain"; responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false; responsedata["keepalive"] = true;
responsedata["str_response_string"] = "Upstream error: "; responsedata["str_response_string"] = "Upstream error: ";
responsedata["error_status_text"] = "Upstream error:"; responsedata["error_status_text"] = "Upstream error:";
responsedata["http_protocol_version"] = "HTTP/1.0"; responsedata["http_protocol_version"] = "HTTP/1.0";

Binary file not shown.

Binary file not shown.