use the pollEvent timeout paramenter on pooling

avinationmerge
UbitUmarov 2012-07-04 17:58:32 +01:00
parent 02cb0bf80a
commit bc5d554f54
1 changed files with 7 additions and 4 deletions

View File

@ -182,7 +182,7 @@ namespace OpenSim.Framework.Servers.HttpServer
private bool m_running = true; private bool m_running = true;
private int m_timeout = 1000; // increase timeout 250; // private int m_timeout = 1000; // increase timeout 250; now use the event one
public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
{ {
@ -245,7 +245,7 @@ namespace OpenSim.Framework.Servers.HttpServer
~PollServiceRequestManager() ~PollServiceRequestManager()
{ {
m_running = false; m_running = false;
m_timeout = -10000; // cause all to expire // m_timeout = -10000; // cause all to expire
Thread.Sleep(1000); // let the world move Thread.Sleep(1000); // let the world move
foreach (Thread t in m_workerThreads) foreach (Thread t in m_workerThreads)
@ -299,7 +299,8 @@ namespace OpenSim.Framework.Servers.HttpServer
PollServiceHttpRequest req; PollServiceHttpRequest req;
StreamReader str; StreamReader str;
while (true) // while (true)
while (m_running)
{ {
req = m_requests.Dequeue(5000); req = m_requests.Dequeue(5000);
@ -338,7 +339,9 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
else else
{ {
if ((Environment.TickCount - req.RequestTime) > m_timeout) // if ((Environment.TickCount - req.RequestTime) > m_timeout)
if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
{ {
m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id),
new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));