From 1b7b664c8696531fec26378d1386362d8a3da55e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 15 Jul 2013 23:22:39 +0100 Subject: Add request received/handling stats for caps which are served by http poll handlers. This adds explicit cap poll handler supporting to the Caps classes rather than relying on callers to do the complicated coding. Other refactoring was required to get logic into the right places to support this. --- .../Linden/Caps/WebFetchInvDescModule.cs | 66 ++++++++++------------ 1 file changed, 31 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index b90df17..86a0298 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -77,7 +77,6 @@ namespace OpenSim.Region.ClientStack.Linden private static WebFetchInvDescHandler m_webFetchHandler; - private Dictionary m_capsDict = new Dictionary(); private static Thread[] m_workerThreads = null; private static DoubleQueue m_queue = @@ -114,7 +113,6 @@ namespace OpenSim.Region.ClientStack.Linden return; m_scene.EventManager.OnRegisterCaps -= RegisterCaps; - m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; foreach (Thread t in m_workerThreads) Watchdog.AbortThread(t.ManagedThreadId); @@ -134,7 +132,6 @@ namespace OpenSim.Region.ClientStack.Linden m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); m_scene.EventManager.OnRegisterCaps += RegisterCaps; - m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; if (m_workerThreads == null) { @@ -177,8 +174,8 @@ namespace OpenSim.Region.ClientStack.Linden private Scene m_scene; - public PollServiceInventoryEventArgs(Scene scene, UUID pId) : - base(null, null, null, null, pId, int.MaxValue) + public PollServiceInventoryEventArgs(Scene scene, string url, UUID pId) : + base(null, url, null, null, null, pId, int.MaxValue) { m_scene = scene; @@ -308,40 +305,39 @@ namespace OpenSim.Region.ClientStack.Linden if (m_fetchInventoryDescendents2Url == "") return; - string capUrl = "/CAPS/" + UUID.Random() + "/"; - // Register this as a poll service - PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(m_scene, agentID); - + PollServiceInventoryEventArgs args + = new PollServiceInventoryEventArgs(m_scene, "/CAPS/" + UUID.Random() + "/", agentID); args.Type = PollServiceEventArgs.EventType.Inventory; - MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); - - string hostName = m_scene.RegionInfo.ExternalHostName; - uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; - string protocol = "http"; - - if (MainServer.Instance.UseSSL) - { - hostName = MainServer.Instance.SSLCommonName; - port = MainServer.Instance.SSLPort; - protocol = "https"; - } - - caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); - m_capsDict[agentID] = capUrl; + caps.RegisterPollHandler("FetchInventoryDescendents2", args); + +// MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); +// +// string hostName = m_scene.RegionInfo.ExternalHostName; +// uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; +// string protocol = "http"; +// +// if (MainServer.Instance.UseSSL) +// { +// hostName = MainServer.Instance.SSLCommonName; +// port = MainServer.Instance.SSLPort; +// protocol = "https"; +// } +// +// caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); } - private void DeregisterCaps(UUID agentID, Caps caps) - { - string capUrl; - - if (m_capsDict.TryGetValue(agentID, out capUrl)) - { - MainServer.Instance.RemoveHTTPHandler("", capUrl); - m_capsDict.Remove(agentID); - } - } +// private void DeregisterCaps(UUID agentID, Caps caps) +// { +// string capUrl; +// +// if (m_capsDict.TryGetValue(agentID, out capUrl)) +// { +// MainServer.Instance.RemoveHTTPHandler("", capUrl); +// m_capsDict.Remove(agentID); +// } +// } private void DoInventoryRequests() { @@ -355,4 +351,4 @@ namespace OpenSim.Region.ClientStack.Linden } } } -} +} \ No newline at end of file -- cgit v1.1