Explicitly stop PollServiceRequestManager() rather than relying on its destructor.
Hopes to address occasional shutdown failures from http://opensimulator.org/mantis/view.php?id=6503avinationmerge
parent
27e2ec177a
commit
3eee991935
|
@ -1731,6 +1731,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
|
||||||
m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000);
|
m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000);
|
||||||
|
m_PollServiceManager.Start();
|
||||||
HTTPDRunning = true;
|
HTTPDRunning = true;
|
||||||
|
|
||||||
//HttpListenerContext context;
|
//HttpListenerContext context;
|
||||||
|
@ -1781,6 +1782,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
HTTPDRunning = false;
|
HTTPDRunning = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
m_PollServiceManager.Stop();
|
||||||
|
|
||||||
m_httpListener2.ExceptionThrown -= httpServerException;
|
m_httpListener2.ExceptionThrown -= httpServerException;
|
||||||
//m_httpListener2.DisconnectHandler = null;
|
//m_httpListener2.DisconnectHandler = null;
|
||||||
|
|
||||||
|
|
|
@ -45,19 +45,26 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
private uint m_WorkerThreadCount = 0;
|
private uint m_WorkerThreadCount = 0;
|
||||||
private Thread[] m_workerThreads;
|
private Thread[] m_workerThreads;
|
||||||
private PollServiceWorkerThread[] m_PollServiceWorkerThreads;
|
private PollServiceWorkerThread[] m_PollServiceWorkerThreads;
|
||||||
private bool m_running = true;
|
private volatile bool m_running = true;
|
||||||
|
private int m_pollTimeout;
|
||||||
|
|
||||||
public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
|
public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
|
||||||
{
|
{
|
||||||
m_server = pSrv;
|
m_server = pSrv;
|
||||||
m_WorkerThreadCount = pWorkerThreadCount;
|
m_WorkerThreadCount = pWorkerThreadCount;
|
||||||
|
m_pollTimeout = pTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
m_running = true;
|
||||||
m_workerThreads = new Thread[m_WorkerThreadCount];
|
m_workerThreads = new Thread[m_WorkerThreadCount];
|
||||||
m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];
|
m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];
|
||||||
|
|
||||||
//startup worker threads
|
//startup worker threads
|
||||||
for (uint i = 0; i < m_WorkerThreadCount; i++)
|
for (uint i = 0; i < m_WorkerThreadCount; i++)
|
||||||
{
|
{
|
||||||
m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, pTimeout);
|
m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, m_pollTimeout);
|
||||||
m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;
|
m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;
|
||||||
|
|
||||||
m_workerThreads[i]
|
m_workerThreads[i]
|
||||||
|
@ -136,8 +143,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~PollServiceRequestManager()
|
public void Stop()
|
||||||
{
|
{
|
||||||
|
m_running = false;
|
||||||
|
|
||||||
foreach (object o in m_requests)
|
foreach (object o in m_requests)
|
||||||
{
|
{
|
||||||
PollServiceHttpRequest req = (PollServiceHttpRequest) o;
|
PollServiceHttpRequest req = (PollServiceHttpRequest) o;
|
||||||
|
@ -151,8 +160,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
t.Abort();
|
t.Abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_running = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue