From dac8edd5dddb5f3d2a2447fb479144429e32ea68 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 3 Sep 2015 15:59:06 -0700 Subject: Transformed the LLUDP ad-hoc plugin into a region module. It works. --- OpenSim/Region/Application/OpenSimBackground.cs | 2 +- OpenSim/Region/Application/OpenSimBase.cs | 151 ++++++++++----------- .../Region/Application/RegionApplicationBase.cs | 104 ++++++++++++++ OpenSim/Region/ClientStack/ClientStackManager.cs | 147 -------------------- OpenSim/Region/ClientStack/IClientNetworkServer.cs | 59 -------- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 49 ++++++- .../Linden/UDP/Properties/AssemblyInfo.cs | 3 + .../Region/ClientStack/RegionApplicationBase.cs | 107 --------------- 8 files changed, 222 insertions(+), 400 deletions(-) create mode 100644 OpenSim/Region/Application/RegionApplicationBase.cs delete mode 100644 OpenSim/Region/ClientStack/ClientStackManager.cs delete mode 100644 OpenSim/Region/ClientStack/IClientNetworkServer.cs delete mode 100644 OpenSim/Region/ClientStack/RegionApplicationBase.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/OpenSimBackground.cs b/OpenSim/Region/Application/OpenSimBackground.cs index 008c6b0..15d9065 100644 --- a/OpenSim/Region/Application/OpenSimBackground.cs +++ b/OpenSim/Region/Application/OpenSimBackground.cs @@ -55,7 +55,7 @@ namespace OpenSim base.Startup(); m_log.InfoFormat("[OPENSIM MAIN]: Startup complete, serving {0} region{1}", - m_clientServers.Count.ToString(), m_clientServers.Count > 1 ? "s" : ""); + SceneManager.Scenes.Count, SceneManager.Scenes.Count > 1 ? "s" : ""); WorldHasComeToAnEnd.WaitOne(); WorldHasComeToAnEnd.Close(); diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 980fa85..6e984d8 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -41,7 +41,6 @@ using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Monitoring; -using OpenSim.Region.ClientStack; using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; @@ -117,19 +116,12 @@ namespace OpenSim /// public OpenSimConfigSource ConfigSource { get; private set; } - public List ClientServers - { - get { return m_clientServers; } - } - protected EnvConfigSource m_EnvConfigSource = new EnvConfigSource(); public EnvConfigSource envConfigSource { get { return m_EnvConfigSource; } } - - protected List m_clientServers = new List(); public uint HttpServerPort { @@ -359,9 +351,9 @@ namespace OpenSim /// /// /// - public List CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) + public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) { - return CreateRegion(regionInfo, portadd_flag, false, out scene); + CreateRegion(regionInfo, portadd_flag, false, out scene); } /// @@ -369,9 +361,9 @@ namespace OpenSim /// /// /// - public List CreateRegion(RegionInfo regionInfo, out IScene scene) + public void CreateRegion(RegionInfo regionInfo, out IScene scene) { - return CreateRegion(regionInfo, false, true, out scene); + CreateRegion(regionInfo, false, true, out scene); } /// @@ -381,7 +373,7 @@ namespace OpenSim /// /// /// - public List CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) + public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) { int port = regionInfo.InternalEndPoint.Port; @@ -406,8 +398,7 @@ namespace OpenSim Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); } - List clientServers; - Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServers); + Scene scene = SetupScene(regionInfo, proxyOffset, Config); m_log.Info("[MODULES]: Loading Region's modules (old style)"); @@ -455,20 +446,20 @@ namespace OpenSim SceneManager.Add(scene); - if (m_autoCreateClientStack) - { - foreach (IClientNetworkServer clientserver in clientServers) - { - m_clientServers.Add(clientserver); - clientserver.Start(); - } - } + //if (m_autoCreateClientStack) + //{ + // foreach (IClientNetworkServer clientserver in clientServers) + // { + // m_clientServers.Add(clientserver); + // clientserver.Start(); + // } + //} scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; mscene = scene; - return clientServers; + //return clientServers; } /// @@ -602,7 +593,7 @@ namespace OpenSim scene.DeleteAllSceneObjects(); SceneManager.CloseScene(scene); - ShutdownClientServer(scene.RegionInfo); + //ShutdownClientServer(scene.RegionInfo); if (!cleanup) return; @@ -663,7 +654,7 @@ namespace OpenSim } SceneManager.CloseScene(scene); - ShutdownClientServer(scene.RegionInfo); + //ShutdownClientServer(scene.RegionInfo); } /// @@ -684,9 +675,9 @@ namespace OpenSim /// /// /// - protected Scene SetupScene(RegionInfo regionInfo, out List clientServer) + protected Scene SetupScene(RegionInfo regionInfo) { - return SetupScene(regionInfo, 0, null, out clientServer); + return SetupScene(regionInfo, 0, null); } /// @@ -697,51 +688,45 @@ namespace OpenSim /// /// /// - protected Scene SetupScene( - RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out List clientServer) + protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, IConfigSource configSource) { - List clientNetworkServers = null; + //List clientNetworkServers = null; AgentCircuitManager circuitManager = new AgentCircuitManager(); - IPAddress listenIP = regionInfo.InternalEndPoint.Address; - //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) - // listenIP = IPAddress.Parse("0.0.0.0"); + //IPAddress listenIP = regionInfo.InternalEndPoint.Address; + ////if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) + //// listenIP = IPAddress.Parse("0.0.0.0"); - uint port = (uint) regionInfo.InternalEndPoint.Port; + //uint port = (uint) regionInfo.InternalEndPoint.Port; - if (m_autoCreateClientStack) - { - clientNetworkServers = m_clientStackManager.CreateServers( - listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, - circuitManager); - } - else - { - clientServer = null; - } + //if (m_autoCreateClientStack) + //{ + // clientNetworkServers = m_clientStackManager.CreateServers( + // listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, + // circuitManager); + //} + //else + //{ + // clientServer = null; + //} - regionInfo.InternalEndPoint.Port = (int) port; + //regionInfo.InternalEndPoint.Port = (int) port; Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager); - if (m_autoCreateClientStack) - { - foreach (IClientNetworkServer clientnetserver in clientNetworkServers) - { - clientnetserver.AddScene(scene); - } - } - clientServer = clientNetworkServers; + //if (m_autoCreateClientStack) + //{ + // foreach (IClientNetworkServer clientnetserver in clientNetworkServers) + // { + // clientnetserver.AddScene(scene); + // } + //} + //clientServer = clientNetworkServers; scene.LoadWorldMap(); return scene; } - protected override ClientStackManager CreateClientStackManager() - { - return new ClientStackManager(m_configSettings.ClientstackDll); - } - protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager) { @@ -751,29 +736,29 @@ namespace OpenSim Config, m_version); } - protected void ShutdownClientServer(RegionInfo whichRegion) - { - // Close and remove the clientserver for a region - bool foundClientServer = false; - int clientServerElement = 0; - Location location = new Location(whichRegion.RegionHandle); - - for (int i = 0; i < m_clientServers.Count; i++) - { - if (m_clientServers[i].HandlesRegion(location)) - { - clientServerElement = i; - foundClientServer = true; - break; - } - } - - if (foundClientServer) - { - m_clientServers[clientServerElement].Stop(); - m_clientServers.RemoveAt(clientServerElement); - } - } + //protected void ShutdownClientServer(RegionInfo whichRegion) + //{ + // // Close and remove the clientserver for a region + // bool foundClientServer = false; + // int clientServerElement = 0; + // Location location = new Location(whichRegion.RegionHandle); + + // for (int i = 0; i < m_clientServers.Count; i++) + // { + // if (m_clientServers[i].HandlesRegion(location)) + // { + // clientServerElement = i; + // foundClientServer = true; + // break; + // } + // } + + // if (foundClientServer) + // { + // m_clientServers[clientServerElement].Stop(); + // m_clientServers.RemoveAt(clientServerElement); + // } + //} protected virtual void HandleRestartRegion(RegionInfo whichRegion) { @@ -781,7 +766,7 @@ namespace OpenSim "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})", whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY); - ShutdownClientServer(whichRegion); + //ShutdownClientServer(whichRegion); IScene scene; CreateRegion(whichRegion, true, out scene); scene.Start(); diff --git a/OpenSim/Region/Application/RegionApplicationBase.cs b/OpenSim/Region/Application/RegionApplicationBase.cs new file mode 100644 index 0000000..b58c998 --- /dev/null +++ b/OpenSim/Region/Application/RegionApplicationBase.cs @@ -0,0 +1,104 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System.Collections.Generic; +using System.Net; +using System.Reflection; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Services.Interfaces; + +namespace OpenSim +{ + public abstract class RegionApplicationBase : BaseOpenSimServer + { + private static readonly ILog m_log + = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected Dictionary m_clientCircuits = new Dictionary(); + protected NetworkServersInfo m_networkServersInfo; + protected uint m_httpServerPort; + protected ISimulationDataService m_simulationDataService; + protected IEstateDataService m_estateDataService; + + public SceneManager SceneManager { get; protected set; } + public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } } + public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } } + public IEstateDataService EstateDataService { get { return m_estateDataService; } } + + protected abstract void Initialize(); + + protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); + + protected override void StartupSpecific() + { + SceneManager = SceneManager.Instance; + + Initialize(); + + m_httpServer + = new BaseHttpServer( + m_httpServerPort, m_networkServersInfo.HttpUsesSSL, m_networkServersInfo.httpSSLPort, + m_networkServersInfo.HttpSSLCN); + + if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)) + { + m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); + } + + m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort); + m_httpServer.Start(); + + MainServer.AddHttpServer(m_httpServer); + MainServer.Instance = m_httpServer; + + // "OOB" Server + if (m_networkServersInfo.ssl_listener) + { + BaseHttpServer server = new BaseHttpServer( + m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, + m_networkServersInfo.cert_pass); + + m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); + MainServer.AddHttpServer(server); + server.Start(); + } + + base.StartupSpecific(); + } + + } +} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs deleted file mode 100644 index 3ec968f..0000000 --- a/OpenSim/Region/ClientStack/ClientStackManager.cs +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Net; -using System.Reflection; -using log4net; -using Nini.Config; -using OpenSim.Framework; - -namespace OpenSim.Region.ClientStack -{ - public class ClientStackManager - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private List plugin = new List(); - private List pluginAssembly = new List(); - - public ClientStackManager(string pDllName) - { - List clientstacks = new List(); - if (pDllName.Contains(",")) - { - clientstacks = new List(pDllName.Split(',')); - } - else - { - clientstacks.Add(pDllName); - } - foreach (string dllName in clientstacks) - { - m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName); - - try - { - //plugin = null; - Assembly itemAssembly = Assembly.LoadFrom(dllName); - pluginAssembly.Add(itemAssembly); - - foreach (Type pluginType in itemAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - Type typeInterface = pluginType.GetInterface("IClientNetworkServer"); - - if (typeInterface != null) - { - m_log.Info("[CLIENTSTACK]: Added IClientNetworkServer Interface"); - plugin.Add(pluginType); - break; - } - } - } - } - catch (ReflectionTypeLoadException e) - { - foreach (Exception e2 in e.LoaderExceptions) - { - m_log.Error(e2.ToString()); - } - throw e; - } - } - } - - /// - /// Create a server that can set up sessions for virtual world client <-> server communications - /// - /// - /// - /// - /// - /// - /// - /// - public List CreateServers( - IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, - AgentCircuitManager authenticateClass) - { - return CreateServers( - _listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass); - } - - /// - /// Create a server that can set up sessions for virtual world client <-> server communications - /// - /// - /// - /// - /// - /// - /// Can be null, in which case default values are used - /// - /// - /// - /// - public List CreateServers( - IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource, - AgentCircuitManager authenticateClass) - { - List servers = new List(); - if (plugin != null) - { - for (int i = 0; i < plugin.Count; i++) - { - IClientNetworkServer server = - (IClientNetworkServer) Activator.CreateInstance(pluginAssembly[i].GetType(plugin[i].ToString())); - - server.Initialise( - _listenIP, ref port, proxyPortOffset, allow_alternate_port, - configSource, authenticateClass); - servers.Add(server); - } - return servers; - } - - m_log.Error("[CLIENTSTACK]: Couldn't initialize a new server"); - return null; - } - } -} diff --git a/OpenSim/Region/ClientStack/IClientNetworkServer.cs b/OpenSim/Region/ClientStack/IClientNetworkServer.cs deleted file mode 100644 index bb7e6d0..0000000 --- a/OpenSim/Region/ClientStack/IClientNetworkServer.cs +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Net; -using System.Net.Sockets; -using Nini.Config; -using OpenSim.Framework; - -namespace OpenSim.Region.ClientStack -{ - public interface IClientNetworkServer - { - void Initialise( - IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, - AgentCircuitManager authenticateClass); - - bool HandlesRegion(Location x); - - /// - /// Add the given scene to be handled by this IClientNetworkServer. - /// - /// - void AddScene(IScene scene); - - /// - /// Start sending and receiving data. - /// - void Start(); - - /// - /// Stop sending and receiving data. - /// - void Stop(); - } -} diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 76be91a..4528714 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -40,8 +40,9 @@ using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; using OpenMetaverse; - +using Mono.Addins; using TokenBucket = OpenSim.Region.ClientStack.LindenUDP.TokenBucket; namespace OpenSim.Region.ClientStack.LindenUDP @@ -49,14 +50,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// A shim around LLUDPServer that implements the IClientNetworkServer interface /// - public sealed class LLUDPServerShim : IClientNetworkServer + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LLUDPServerShim")] + public sealed class LLUDPServerShim : INonSharedRegionModule { + private bool m_Enabled = true; + private IConfigSource m_Config; LLUDPServer m_udpServer; - public LLUDPServerShim() + #region INonSharedRegionModule + public string Name + { + get { return "LLUDPServerShim"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + m_Config = source; + } + + public void Close() + { + } + + public void AddRegion(Scene scene) { + uint port = (uint)scene.RegionInfo.InternalEndPoint.Port; + + IPAddress listenIP = scene.RegionInfo.InternalEndPoint.Address; + Initialise(listenIP, ref port, scene.RegionInfo.ProxyOffset, scene.RegionInfo.m_allow_alternate_ports, m_Config, scene.AuthenticateHandler); + scene.RegionInfo.InternalEndPoint.Port = (int)port; + + AddScene(scene); } + public void RemoveRegion(Scene scene) + { + Stop(); + } + + public void RegionLoaded(Scene scene) + { + Start(); + } + #endregion + public void Initialise(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) { m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager); @@ -200,6 +242,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_udpServer.Stop(); } + } /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs index 8795c0c..a1ff69e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs @@ -1,6 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using Mono.Addins; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -31,3 +32,5 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("0.8.2.*")] +[assembly: Addin("LindenUDP", OpenSim.VersionInfo.VersionNumber)] +[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs deleted file mode 100644 index 343780b..0000000 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using System.Net; -using System.Reflection; -using log4net; -using Nini.Config; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Region.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModules.SharedBase; -using OpenSim.Services.Interfaces; - -namespace OpenSim.Region.ClientStack -{ - public abstract class RegionApplicationBase : BaseOpenSimServer - { - private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected Dictionary m_clientCircuits = new Dictionary(); - protected NetworkServersInfo m_networkServersInfo; - protected uint m_httpServerPort; - protected ISimulationDataService m_simulationDataService; - protected IEstateDataService m_estateDataService; - protected ClientStackManager m_clientStackManager; - - public SceneManager SceneManager { get; protected set; } - public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } } - public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } } - public IEstateDataService EstateDataService { get { return m_estateDataService; } } - - protected abstract void Initialize(); - - protected abstract ClientStackManager CreateClientStackManager(); - protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); - - protected override void StartupSpecific() - { - SceneManager = SceneManager.Instance; - m_clientStackManager = CreateClientStackManager(); - - Initialize(); - - m_httpServer - = new BaseHttpServer( - m_httpServerPort, m_networkServersInfo.HttpUsesSSL, m_networkServersInfo.httpSSLPort, - m_networkServersInfo.HttpSSLCN); - - if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)) - { - m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); - } - - m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort); - m_httpServer.Start(); - - MainServer.AddHttpServer(m_httpServer); - MainServer.Instance = m_httpServer; - - // "OOB" Server - if (m_networkServersInfo.ssl_listener) - { - BaseHttpServer server = new BaseHttpServer( - m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, - m_networkServersInfo.cert_pass); - - m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); - MainServer.AddHttpServer(server); - server.Start(); - } - - base.StartupSpecific(); - } - - } -} \ No newline at end of file -- cgit v1.1