diff --git a/OpenSim/Region/Application/OpenSimBackground.cs b/OpenSim/Region/Application/OpenSimBackground.cs index 008c6b07b5..15d9065af3 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 980fa8508b..6e984d8f8e 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); + //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; - } - } + // 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); - } - } + // 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/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/Application/RegionApplicationBase.cs similarity index 95% rename from OpenSim/Region/ClientStack/RegionApplicationBase.cs rename to OpenSim/Region/Application/RegionApplicationBase.cs index 343780b56d..b58c99832a 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/Application/RegionApplicationBase.cs @@ -41,7 +41,7 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; -namespace OpenSim.Region.ClientStack +namespace OpenSim { public abstract class RegionApplicationBase : BaseOpenSimServer { @@ -53,7 +53,6 @@ namespace OpenSim.Region.ClientStack 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; } } @@ -62,13 +61,11 @@ namespace OpenSim.Region.ClientStack 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(); diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs deleted file mode 100644 index 3ec968f706..0000000000 --- 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 bb7e6d0e6f..0000000000 --- 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 76be91a40b..45287148cd 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 8795c0c07a..a1ff69e115 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/prebuild.xml b/prebuild.xml index 0550211d3f..06310f9c55 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1375,41 +1375,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - @@ -1440,13 +1405,13 @@ - + @@ -1902,7 +1867,6 @@ - @@ -1936,7 +1900,6 @@ - @@ -1972,7 +1935,6 @@ - @@ -2006,7 +1968,6 @@ - @@ -3206,7 +3167,6 @@ - @@ -3304,7 +3264,6 @@ -