Fix bugs in EventQueueGetModule.ClientClosed() and BaseHttpServer.RemovePollServerHTTPHandler() that stopped existing code in ClientClosed() from actually tearing down the poll handler
Actually doing the tear down appear to have no ill effects with region crossing and teleport.remove-scene-viewer
parent
79d5bc9beb
commit
9ec672c70b
|
@ -1815,9 +1815,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
lock (m_pollHandlers)
|
lock (m_pollHandlers)
|
||||||
{
|
{
|
||||||
if (m_pollHandlers.ContainsKey(httpMethod))
|
if (m_pollHandlers.ContainsKey(path))
|
||||||
{
|
{
|
||||||
m_pollHandlers.Remove(httpMethod);
|
m_pollHandlers.Remove(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,16 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Reflection;
|
||||||
|
using log4net;
|
||||||
using HttpServer;
|
using HttpServer;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Servers.HttpServer
|
namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
public class PollServiceRequestManager
|
public class PollServiceRequestManager
|
||||||
{
|
{
|
||||||
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private readonly BaseHttpServer m_server;
|
private readonly BaseHttpServer m_server;
|
||||||
private static Queue m_requests = Queue.Synchronized(new Queue());
|
private static Queue m_requests = Queue.Synchronized(new Queue());
|
||||||
private uint m_WorkerThreadCount = 0;
|
private uint m_WorkerThreadCount = 0;
|
||||||
|
@ -42,8 +46,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
private Thread m_watcherThread;
|
private Thread m_watcherThread;
|
||||||
private bool m_running = true;
|
private bool m_running = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
|
public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
|
||||||
{
|
{
|
||||||
m_server = pSrv;
|
m_server = pSrv;
|
||||||
|
@ -61,7 +63,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
m_workerThreads[i].Name = String.Format("PollServiceWorkerThread{0}",i);
|
m_workerThreads[i].Name = String.Format("PollServiceWorkerThread{0}",i);
|
||||||
//Can't add to thread Tracker here Referencing OpenSim.Framework creates circular reference
|
//Can't add to thread Tracker here Referencing OpenSim.Framework creates circular reference
|
||||||
m_workerThreads[i].Start();
|
m_workerThreads[i].Start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//start watcher threads
|
//start watcher threads
|
||||||
|
@ -98,7 +99,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
if (m_requests.Count == 0)
|
if (m_requests.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[POLL SERVICE REQUEST MANAGER]: Processing {0} requests", m_requests.Count);
|
||||||
|
|
||||||
int reqperthread = (int) (m_requests.Count/m_WorkerThreadCount) + 1;
|
int reqperthread = (int) (m_requests.Count/m_WorkerThreadCount) + 1;
|
||||||
|
|
||||||
// For Each WorkerThread
|
// For Each WorkerThread
|
||||||
for (int tc = 0; tc < m_WorkerThreadCount && m_requests.Count > 0; tc++)
|
for (int tc = 0; tc < m_WorkerThreadCount && m_requests.Count > 0; tc++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -204,7 +204,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
private void ClientClosed(UUID AgentID, Scene scene)
|
private void ClientClosed(UUID AgentID, Scene scene)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName);
|
// m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5)
|
while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5)
|
||||||
|
@ -216,11 +216,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
{
|
{
|
||||||
queues.Remove(AgentID);
|
queues.Remove(AgentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<UUID> removeitems = new List<UUID>();
|
List<UUID> removeitems = new List<UUID>();
|
||||||
lock (m_AvatarQueueUUIDMapping)
|
lock (m_AvatarQueueUUIDMapping)
|
||||||
{
|
{
|
||||||
foreach (UUID ky in m_AvatarQueueUUIDMapping.Keys)
|
foreach (UUID ky in m_AvatarQueueUUIDMapping.Keys)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[EVENTQUEUE]: Found key {0} in m_AvatarQueueUUIDMapping while looking for {1}", ky, AgentID);
|
||||||
if (ky == AgentID)
|
if (ky == AgentID)
|
||||||
{
|
{
|
||||||
removeitems.Add(ky);
|
removeitems.Add(ky);
|
||||||
|
@ -229,11 +231,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
foreach (UUID ky in removeitems)
|
foreach (UUID ky in removeitems)
|
||||||
{
|
{
|
||||||
|
UUID eventQueueGetUuid = m_AvatarQueueUUIDMapping[ky];
|
||||||
m_AvatarQueueUUIDMapping.Remove(ky);
|
m_AvatarQueueUUIDMapping.Remove(ky);
|
||||||
MainServer.Instance.RemovePollServiceHTTPHandler("","/CAPS/EQG/" + ky.ToString() + "/");
|
|
||||||
|
MainServer.Instance.RemovePollServiceHTTPHandler("","/CAPS/EQG/" + eventQueueGetUuid.ToString() + "/");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
UUID searchval = UUID.Zero;
|
UUID searchval = UUID.Zero;
|
||||||
|
|
||||||
removeitems.Clear();
|
removeitems.Clear();
|
||||||
|
@ -252,7 +256,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
foreach (UUID ky in removeitems)
|
foreach (UUID ky in removeitems)
|
||||||
m_QueueUUIDAvatarMapping.Remove(ky);
|
m_QueueUUIDAvatarMapping.Remove(ky);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,5 +74,20 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
|
||||||
// TODO: Add more assertions for the other aspects of event queues
|
// TODO: Add more assertions for the other aspects of event queues
|
||||||
Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(1));
|
Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void RemoveForClient()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
UUID spId = TestHelpers.ParseTail(0x1);
|
||||||
|
|
||||||
|
SceneHelpers.AddScenePresence(m_scene, spId);
|
||||||
|
m_scene.IncomingCloseAgent(spId);
|
||||||
|
|
||||||
|
// TODO: Add more assertions for the other aspects of event queues
|
||||||
|
Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue