From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 19 May 2019 21:24:15 +1000 Subject: Dump OpenSim 0.9.0.1 into it's own branch. --- OpenSim/Capabilities/Caps.cs | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'OpenSim/Capabilities/Caps.cs') diff --git a/OpenSim/Capabilities/Caps.cs b/OpenSim/Capabilities/Caps.cs index 049afab..7492602 100644 --- a/OpenSim/Capabilities/Caps.cs +++ b/OpenSim/Capabilities/Caps.cs @@ -30,6 +30,7 @@ using System.Collections; using System.Collections.Generic; using System.IO; using System.Reflection; +using System.Threading; using log4net; using Nini.Config; using OpenMetaverse; @@ -63,7 +64,7 @@ namespace OpenSim.Framework.Capabilities private CapsHandlers m_capsHandlers; - private Dictionary m_pollServiceHandlers + private Dictionary m_pollServiceHandlers = new Dictionary(); private Dictionary m_externalCapsHandlers = new Dictionary(); @@ -71,6 +72,7 @@ namespace OpenSim.Framework.Capabilities private IHttpServer m_httpListener; private UUID m_agentID; private string m_regionName; + private ManualResetEvent m_capsActive = new ManualResetEvent(false); public UUID AgentID { @@ -134,8 +136,14 @@ namespace OpenSim.Framework.Capabilities } m_agentID = agent; - m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL); + m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort); m_regionName = regionName; + m_capsActive.Reset(); + } + + ~Caps() + { + m_capsActive.Dispose(); } /// @@ -152,7 +160,7 @@ namespace OpenSim.Framework.Capabilities public void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler) { // m_log.DebugFormat( -// "[CAPS]: Registering handler with name {0}, url {1} for {2}", +// "[CAPS]: Registering handler with name {0}, url {1} for {2}", // capName, pollServiceHandler.Url, m_agentID, m_regionName); m_pollServiceHandlers.Add(capName, pollServiceHandler); @@ -162,7 +170,7 @@ namespace OpenSim.Framework.Capabilities // uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; // string protocol = "http"; // string hostName = m_httpListenerHostName; -// +// // if (MainServer.Instance.UseSSL) // { // hostName = MainServer.Instance.SSLCommonName; @@ -230,7 +238,7 @@ namespace OpenSim.Framework.Capabilities string hostName = m_httpListenerHostName; uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port; string protocol = "http"; - + if (MainServer.Instance.UseSSL) { hostName = MainServer.Instance.SSLCommonName; @@ -255,5 +263,16 @@ namespace OpenSim.Framework.Capabilities return caps; } + + public void Activate() + { + m_capsActive.Set(); + } + + public bool WaitForActivation() + { + // Wait for 30s. If that elapses, return false and run without caps + return m_capsActive.WaitOne(120000); + } } } \ No newline at end of file -- cgit v1.1