http send is blocking, so we need we need to do it async in all cases. - this will need revision after server changes
parent
d1810866b3
commit
f636ef037a
|
@ -461,7 +461,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
|
|
||||||
OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context);
|
OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context);
|
||||||
resp.ReuseContext = true;
|
// resp.ReuseContext = true;
|
||||||
|
resp.ReuseContext = false;
|
||||||
HandleRequest(req, resp);
|
HandleRequest(req, resp);
|
||||||
|
|
||||||
// !!!HACK ALERT!!!
|
// !!!HACK ALERT!!!
|
||||||
|
@ -1954,7 +1955,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
// Long Poll Service Manager with 3 worker threads a 25 second timeout for no events
|
// Long Poll Service Manager with 3 worker threads a 25 second timeout for no events
|
||||||
|
|
||||||
PollServiceRequestManager = new PollServiceRequestManager(this, performPollResponsesAsync, 3, 25000);
|
PollServiceRequestManager = new PollServiceRequestManager(this, performPollResponsesAsync, 2, 25000);
|
||||||
PollServiceRequestManager.Start();
|
PollServiceRequestManager.Start();
|
||||||
|
|
||||||
HTTPDRunning = true;
|
HTTPDRunning = true;
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
STPStartInfo startInfo = new STPStartInfo();
|
STPStartInfo startInfo = new STPStartInfo();
|
||||||
startInfo.IdleTimeout = 30000;
|
startInfo.IdleTimeout = 30000;
|
||||||
startInfo.MaxWorkerThreads = 15;
|
startInfo.MaxWorkerThreads = 20;
|
||||||
startInfo.MinWorkerThreads = 1;
|
startInfo.MinWorkerThreads = 1;
|
||||||
startInfo.ThreadPriority = ThreadPriority.Normal;
|
startInfo.ThreadPriority = ThreadPriority.Normal;
|
||||||
startInfo.StartSuspended = true;
|
startInfo.StartSuspended = true;
|
||||||
|
@ -160,7 +160,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void EnqueueInt(PollServiceHttpRequest req)
|
public void EnqueueInt(PollServiceHttpRequest req)
|
||||||
{
|
{
|
||||||
if (m_running)
|
if (m_running)
|
||||||
|
@ -272,20 +271,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id);
|
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id);
|
||||||
|
|
||||||
if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LongPoll) // This is the event queue
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
req.DoHTTPGruntWork(m_server, responsedata);
|
|
||||||
byContextDequeue(req);
|
|
||||||
}
|
|
||||||
catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
|
|
||||||
{
|
|
||||||
// Ignore it, no need to reply
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_threadPool.QueueWorkItem(x =>
|
m_threadPool.QueueWorkItem(x =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -297,19 +282,28 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
// Ignore it, no need to reply
|
// Ignore it, no need to reply
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}, null);
|
}, null);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
|
if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
|
||||||
|
{
|
||||||
|
m_threadPool.QueueWorkItem(x =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
req.DoHTTPGruntWork(m_server,
|
req.DoHTTPGruntWork(m_server,
|
||||||
req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
|
req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
|
||||||
byContextDequeue(req);
|
byContextDequeue(req);
|
||||||
}
|
}
|
||||||
|
catch (ObjectDisposedException)
|
||||||
|
{
|
||||||
|
// Ignore it, no need to reply
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ReQueueEvent(req);
|
ReQueueEvent(req);
|
||||||
|
|
Loading…
Reference in New Issue