* 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)
{
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;
//m_log.Info("[Debug BASE HTTP SERVER]: Got Request");
//HttpServerContextObj objstate= new HttpServerContextObj(req,resp);
@ -444,6 +444,7 @@ namespace OpenSim.Framework.Servers.HttpServer
try
{
response.Send();
response.FreeContext();
}
catch (SocketException e)
{
@ -746,6 +747,7 @@ namespace OpenSim.Framework.Servers.HttpServer
try
{
response.Send();
response.FreeContext();
}
catch (SocketException e)
{
@ -778,6 +780,7 @@ namespace OpenSim.Framework.Servers.HttpServer
try
{
response.Send();
response.FreeContext();
}
catch (SocketException e)
{
@ -888,6 +891,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
response.Send();
response.OutputStream.Flush();
response.FreeContext();
//response.OutputStream.Close();
}
catch (IOException e)
@ -1103,6 +1107,7 @@ namespace OpenSim.Framework.Servers.HttpServer
try
{
response.Send();
response.FreeContext();
}
catch (SocketException f)
{
@ -1377,7 +1382,11 @@ namespace OpenSim.Framework.Servers.HttpServer
//response.OutputStream.Close();
try
{
response.OutputStream.Flush();
response.Send();
if (!response.KeepAlive)
response.FreeContext();
}
catch (SocketException e)
{
@ -1414,6 +1423,7 @@ namespace OpenSim.Framework.Servers.HttpServer
try
{
response.Send();
response.FreeContext();
}
catch (SocketException e)
{
@ -1449,6 +1459,7 @@ namespace OpenSim.Framework.Servers.HttpServer
try
{
response.Send();
response.FreeContext();
}
catch (SocketException e)
{

View File

@ -258,6 +258,7 @@ namespace OpenSim.Framework.Servers.HttpServer
protected IHttpResponse _httpResponse;
private IHttpClientContext _httpClientContext;
public OSHttpResponse() {}
@ -275,6 +276,12 @@ namespace OpenSim.Framework.Servers.HttpServer
public OSHttpResponse(OSHttpRequest req)
{
_httpResponse = new HttpResponse(req.IHttpClientContext, req.IHttpRequest);
_httpClientContext = req.IHttpClientContext;
}
public OSHttpResponse(HttpResponse resp, IHttpClientContext clientContext)
{
_httpResponse = resp;
_httpClientContext = clientContext;
}
/// <summary>
@ -298,5 +305,11 @@ namespace OpenSim.Framework.Servers.HttpServer
_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)
{
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();

View File

@ -44,7 +44,7 @@ namespace OpenSim.Framework.Servers.HttpServer
private readonly BaseHttpServer m_server;
private BlockingQueue<PollServiceHttpRequest> m_request;
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());
m_server.DoHTTPGruntWork(responsedata,
new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request)));
new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
}
else
{
if ((Environment.TickCount - req.RequestTime) > m_timeout)
{
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
{

View File

@ -1616,8 +1616,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
agentData.child = false;
agentData.firstname = m_firstName;
agentData.lastname = m_lastName;
ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>();
if (capsModule == null) // can happen when shutting down.
return agentData;
agentData.CapsPath = capsModule.GetCapsPath(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();
responsedata["int_response_code"] = 200;
responsedata["content_type"] = "application/xml";
responsedata["keepalive"] = false;
responsedata["keepalive"] = true;
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
return responsedata;
//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();
responsedata["int_response_code"] = 502;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["keepalive"] = true;
responsedata["str_response_string"] = "Upstream error: ";
responsedata["error_status_text"] = "Upstream error:";
responsedata["http_protocol_version"] = "HTTP/1.0";

Binary file not shown.

Binary file not shown.