diff options
author | Justin Clark-Casey (justincc) | 2011-10-24 23:16:03 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-24 23:16:03 +0100 |
commit | 9ec672c70b28b8c1d6d81bab7744fcf7bf9b83c7 (patch) | |
tree | 6a91df6f558370682a0a3c0f7c9a59ff85302d3e | |
parent | separate out future common setup code from EventQueueTests.AddForClient() (diff) | |
download | opensim-SC_OLD-9ec672c70b28b8c1d6d81bab7744fcf7bf9b83c7.zip opensim-SC_OLD-9ec672c70b28b8c1d6d81bab7744fcf7bf9b83c7.tar.gz opensim-SC_OLD-9ec672c70b28b8c1d6d81bab7744fcf7bf9b83c7.tar.bz2 opensim-SC_OLD-9ec672c70b28b8c1d6d81bab7744fcf7bf9b83c7.tar.xz |
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.
4 files changed, 31 insertions, 9 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index fefa242..7ec813f 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -1815,9 +1815,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1815 | { | 1815 | { |
1816 | lock (m_pollHandlers) | 1816 | lock (m_pollHandlers) |
1817 | { | 1817 | { |
1818 | if (m_pollHandlers.ContainsKey(httpMethod)) | 1818 | if (m_pollHandlers.ContainsKey(path)) |
1819 | { | 1819 | { |
1820 | m_pollHandlers.Remove(httpMethod); | 1820 | m_pollHandlers.Remove(path); |
1821 | } | 1821 | } |
1822 | } | 1822 | } |
1823 | 1823 | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index e7a64f7..0840a9d 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -28,12 +28,16 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Threading; | 30 | using System.Threading; |
31 | using System.Reflection; | ||
32 | using log4net; | ||
31 | using HttpServer; | 33 | using HttpServer; |
32 | 34 | ||
33 | namespace OpenSim.Framework.Servers.HttpServer | 35 | namespace OpenSim.Framework.Servers.HttpServer |
34 | { | 36 | { |
35 | public class PollServiceRequestManager | 37 | public class PollServiceRequestManager |
36 | { | 38 | { |
39 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
40 | |||
37 | private readonly BaseHttpServer m_server; | 41 | private readonly BaseHttpServer m_server; |
38 | private static Queue m_requests = Queue.Synchronized(new Queue()); | 42 | private static Queue m_requests = Queue.Synchronized(new Queue()); |
39 | private uint m_WorkerThreadCount = 0; | 43 | private uint m_WorkerThreadCount = 0; |
@@ -42,8 +46,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
42 | private Thread m_watcherThread; | 46 | private Thread m_watcherThread; |
43 | private bool m_running = true; | 47 | private bool m_running = true; |
44 | 48 | ||
45 | |||
46 | |||
47 | public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) | 49 | public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) |
48 | { | 50 | { |
49 | m_server = pSrv; | 51 | m_server = pSrv; |
@@ -61,7 +63,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
61 | m_workerThreads[i].Name = String.Format("PollServiceWorkerThread{0}",i); | 63 | m_workerThreads[i].Name = String.Format("PollServiceWorkerThread{0}",i); |
62 | //Can't add to thread Tracker here Referencing OpenSim.Framework creates circular reference | 64 | //Can't add to thread Tracker here Referencing OpenSim.Framework creates circular reference |
63 | m_workerThreads[i].Start(); | 65 | m_workerThreads[i].Start(); |
64 | |||
65 | } | 66 | } |
66 | 67 | ||
67 | //start watcher threads | 68 | //start watcher threads |
@@ -98,7 +99,10 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
98 | if (m_requests.Count == 0) | 99 | if (m_requests.Count == 0) |
99 | return; | 100 | return; |
100 | 101 | ||
102 | // m_log.DebugFormat("[POLL SERVICE REQUEST MANAGER]: Processing {0} requests", m_requests.Count); | ||
103 | |||
101 | int reqperthread = (int) (m_requests.Count/m_WorkerThreadCount) + 1; | 104 | int reqperthread = (int) (m_requests.Count/m_WorkerThreadCount) + 1; |
105 | |||
102 | // For Each WorkerThread | 106 | // For Each WorkerThread |
103 | for (int tc = 0; tc < m_WorkerThreadCount && m_requests.Count > 0; tc++) | 107 | for (int tc = 0; tc < m_WorkerThreadCount && m_requests.Count > 0; tc++) |
104 | { | 108 | { |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 3eb2b5e..7d73b3e 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | |||
@@ -204,7 +204,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
204 | 204 | ||
205 | private void ClientClosed(UUID AgentID, Scene scene) | 205 | private void ClientClosed(UUID AgentID, Scene scene) |
206 | { | 206 | { |
207 | //m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName); | 207 | // m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName); |
208 | 208 | ||
209 | int count = 0; | 209 | int count = 0; |
210 | while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5) | 210 | while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5) |
@@ -216,11 +216,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
216 | { | 216 | { |
217 | queues.Remove(AgentID); | 217 | queues.Remove(AgentID); |
218 | } | 218 | } |
219 | |||
219 | List<UUID> removeitems = new List<UUID>(); | 220 | List<UUID> removeitems = new List<UUID>(); |
220 | lock (m_AvatarQueueUUIDMapping) | 221 | lock (m_AvatarQueueUUIDMapping) |
221 | { | 222 | { |
222 | foreach (UUID ky in m_AvatarQueueUUIDMapping.Keys) | 223 | foreach (UUID ky in m_AvatarQueueUUIDMapping.Keys) |
223 | { | 224 | { |
225 | // m_log.DebugFormat("[EVENTQUEUE]: Found key {0} in m_AvatarQueueUUIDMapping while looking for {1}", ky, AgentID); | ||
224 | if (ky == AgentID) | 226 | if (ky == AgentID) |
225 | { | 227 | { |
226 | removeitems.Add(ky); | 228 | removeitems.Add(ky); |
@@ -229,11 +231,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
229 | 231 | ||
230 | foreach (UUID ky in removeitems) | 232 | foreach (UUID ky in removeitems) |
231 | { | 233 | { |
234 | UUID eventQueueGetUuid = m_AvatarQueueUUIDMapping[ky]; | ||
232 | m_AvatarQueueUUIDMapping.Remove(ky); | 235 | m_AvatarQueueUUIDMapping.Remove(ky); |
233 | MainServer.Instance.RemovePollServiceHTTPHandler("","/CAPS/EQG/" + ky.ToString() + "/"); | ||
234 | } | ||
235 | 236 | ||
237 | MainServer.Instance.RemovePollServiceHTTPHandler("","/CAPS/EQG/" + eventQueueGetUuid.ToString() + "/"); | ||
238 | } | ||
236 | } | 239 | } |
240 | |||
237 | UUID searchval = UUID.Zero; | 241 | UUID searchval = UUID.Zero; |
238 | 242 | ||
239 | removeitems.Clear(); | 243 | removeitems.Clear(); |
@@ -252,7 +256,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
252 | 256 | ||
253 | foreach (UUID ky in removeitems) | 257 | foreach (UUID ky in removeitems) |
254 | m_QueueUUIDAvatarMapping.Remove(ky); | 258 | m_QueueUUIDAvatarMapping.Remove(ky); |
255 | |||
256 | } | 259 | } |
257 | } | 260 | } |
258 | 261 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs index ec8a414..2ca02c5 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs | |||
@@ -74,5 +74,20 @@ namespace OpenSim.Region.ClientStack.Linden.Tests | |||
74 | // TODO: Add more assertions for the other aspects of event queues | 74 | // TODO: Add more assertions for the other aspects of event queues |
75 | Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(1)); | 75 | Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(1)); |
76 | } | 76 | } |
77 | |||
78 | [Test] | ||
79 | public void RemoveForClient() | ||
80 | { | ||
81 | TestHelpers.InMethod(); | ||
82 | // log4net.Config.XmlConfigurator.Configure(); | ||
83 | |||
84 | UUID spId = TestHelpers.ParseTail(0x1); | ||
85 | |||
86 | SceneHelpers.AddScenePresence(m_scene, spId); | ||
87 | m_scene.IncomingCloseAgent(spId); | ||
88 | |||
89 | // TODO: Add more assertions for the other aspects of event queues | ||
90 | Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0)); | ||
91 | } | ||
77 | } | 92 | } |
78 | } \ No newline at end of file | 93 | } \ No newline at end of file |