From 8c71954e0892958da444ef5c82173262daa3f46c Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 3 Nov 2008 18:33:35 +0000 Subject: * Use nini to pass config information to the client stack, rather than the ClientStackUserSettings class * This conforms better to other module usage --- OpenSim/Framework/Servers/RestSessionService.cs | 1 - OpenSim/Region/Application/OpenSimBase.cs | 18 +++++++++--------- OpenSim/Region/ClientStack/ClientStackManager.cs | 15 +++++++-------- OpenSim/Region/ClientStack/IClientNetworkServer.cs | 3 ++- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 1 - OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | 6 ++++++ OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 13 +++++++++---- .../ClientStack/LindenUDP/Tests/BasicCircuitTests.cs | 4 +++- OpenSim/Region/ClientStack/RegionApplicationBase.cs | 10 ++++++---- 9 files changed, 42 insertions(+), 29 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/RestSessionService.cs b/OpenSim/Framework/Servers/RestSessionService.cs index 1cfb425..eaeda62 100644 --- a/OpenSim/Framework/Servers/RestSessionService.cs +++ b/OpenSim/Framework/Servers/RestSessionService.cs @@ -77,7 +77,6 @@ namespace OpenSim.Framework.Servers public class RestSessionObjectPosterResponse { - public ReturnResponse ResponseCallback; public void BeginPostObject(string requestUrl, TRequest obj, string sid, string aid) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 2bb4b57..ebcea28 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -208,13 +208,13 @@ namespace OpenSim /// public static IConfigSource DefaultConfig() { - IConfigSource DefaultConfig = new IniConfigSource(); + IConfigSource defaultConfig = new IniConfigSource(); { - IConfig config = DefaultConfig.Configs["Startup"]; + IConfig config = defaultConfig.Configs["Startup"]; if (null == config) - config = DefaultConfig.AddConfig("Startup"); + config = defaultConfig.AddConfig("Startup"); config.Set("gridmode", false); config.Set("physics", "basicphysics"); @@ -233,10 +233,10 @@ namespace OpenSim } { - IConfig config = DefaultConfig.Configs["StandAlone"]; + IConfig config = defaultConfig.Configs["StandAlone"]; if (null == config) - config = DefaultConfig.AddConfig("StandAlone"); + config = defaultConfig.AddConfig("StandAlone"); config.Set("accounts_authenticate", false); config.Set("welcome_message", "Welcome to OpenSimulator"); @@ -250,10 +250,10 @@ namespace OpenSim } { - IConfig config = DefaultConfig.Configs["Network"]; + IConfig config = defaultConfig.Configs["Network"]; if (null == config) - config = DefaultConfig.AddConfig("Network"); + config = defaultConfig.AddConfig("Network"); config.Set("default_location_x", 1000); config.Set("default_location_y", 1000); @@ -270,7 +270,7 @@ namespace OpenSim config.Set("secure_inventory_server", "true"); } - return DefaultConfig; + return defaultConfig; } protected virtual void ReadConfigSettings() @@ -495,7 +495,7 @@ namespace OpenSim } IClientNetworkServer clientServer; - Scene scene = SetupScene(regionInfo, proxyOffset, null, out clientServer); + Scene scene = SetupScene(regionInfo, proxyOffset, m_config.Source, out clientServer); m_log.Info("[MODULES]: Loading Region's modules"); diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs index 2751e0a..5723739 100644 --- a/OpenSim/Region/ClientStack/ClientStackManager.cs +++ b/OpenSim/Region/ClientStack/ClientStackManager.cs @@ -29,6 +29,7 @@ using System; using System.Net; using System.Reflection; using log4net; +using Nini.Config; using OpenSim.Framework; using OpenSim.Region.ClientStack; using OpenSim.Framework.Communications; @@ -91,26 +92,24 @@ namespace OpenSim.Region.Environment /// /// /// - /// + /// /// Can be null, in which case default values are used /// /// /// /// public IClientNetworkServer CreateServer( - IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, ClientStackUserSettings settings, + IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource, AssetCache assetCache, AgentCircuitManager authenticateClass) - { - if (null == settings) - settings = new ClientStackUserSettings(); - + { if (plugin != null) { IClientNetworkServer server = - (IClientNetworkServer) Activator.CreateInstance(pluginAssembly.GetType(plugin.ToString())); + (IClientNetworkServer)Activator.CreateInstance(pluginAssembly.GetType(plugin.ToString())); server.Initialise( - _listenIP, ref port, proxyPortOffset, allow_alternate_port, settings, assetCache, authenticateClass); + _listenIP, ref port, proxyPortOffset, allow_alternate_port, + configSource, assetCache, authenticateClass); return server; } diff --git a/OpenSim/Region/ClientStack/IClientNetworkServer.cs b/OpenSim/Region/ClientStack/IClientNetworkServer.cs index fcec1b8..2d0630b 100644 --- a/OpenSim/Region/ClientStack/IClientNetworkServer.cs +++ b/OpenSim/Region/ClientStack/IClientNetworkServer.cs @@ -27,6 +27,7 @@ using System.Net; using System.Net.Sockets; +using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Environment.Scenes; using OpenSim.Framework.Communications.Cache; @@ -36,7 +37,7 @@ namespace OpenSim.Region.ClientStack public interface IClientNetworkServer { void Initialise( - IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, ClientStackUserSettings settings, + IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AssetCache assetCache, AgentCircuitManager authenticateClass); Socket Server { get; } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d272667..dee5d80 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -1961,7 +1961,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle) { - m_activeGroupID = activegroupid; m_activeGroupName = groupname; m_activeGroupPowers = grouppowers; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs index bf95045..9abde5d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs @@ -322,6 +322,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); ResendThrottle.AddBytes(qpack.Packet.ToBytes().Length); } + if (LandThrottle.UnderLimit() && LandOutgoingPacketQueue.Count > 0) { LLQueItem qpack = LandOutgoingPacketQueue.Dequeue(); @@ -330,6 +331,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); LandThrottle.AddBytes(qpack.Packet.ToBytes().Length); } + if (WindThrottle.UnderLimit() && WindOutgoingPacketQueue.Count > 0) { LLQueItem qpack = WindOutgoingPacketQueue.Dequeue(); @@ -338,6 +340,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); WindThrottle.AddBytes(qpack.Packet.ToBytes().Length); } + if (CloudThrottle.UnderLimit() && CloudOutgoingPacketQueue.Count > 0) { LLQueItem qpack = CloudOutgoingPacketQueue.Dequeue(); @@ -346,6 +349,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); CloudThrottle.AddBytes(qpack.Packet.ToBytes().Length); } + if (TaskThrottle.UnderLimit() && (TaskOutgoingPacketQueue.Count > 0 || TaskLowpriorityPacketQueue.Count > 0)) { LLQueItem qpack; @@ -362,6 +366,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); TaskThrottle.AddBytes(qpack.Packet.ToBytes().Length); } + if (TextureThrottle.UnderLimit() && TextureOutgoingPacketQueue.Count > 0) { LLQueItem qpack = TextureOutgoingPacketQueue.Dequeue(); @@ -370,6 +375,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TotalThrottle.AddBytes(qpack.Packet.ToBytes().Length); TextureThrottle.AddBytes(qpack.Packet.ToBytes().Length); } + if (AssetThrottle.UnderLimit() && AssetOutgoingPacketQueue.Count > 0) { LLQueItem qpack = AssetOutgoingPacketQueue.Dequeue(); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index ba4e18b..cbe6eff 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -33,6 +33,7 @@ using System.Net.Sockets; using System.Reflection; using OpenMetaverse.Packets; using log4net; +using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Region.Environment.Scenes; @@ -127,10 +128,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP } public LLUDPServer( - IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, ClientStackUserSettings userSettings, + IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource, AssetCache assetCache, AgentCircuitManager authenticateClass) { - Initialise(_listenIP, ref port, proxyPortOffset, allow_alternate_port, userSettings, assetCache, authenticateClass); + Initialise(_listenIP, ref port, proxyPortOffset, allow_alternate_port, configSource, assetCache, authenticateClass); } /// @@ -140,13 +141,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// /// - /// + /// /// /// public void Initialise( - IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, ClientStackUserSettings userSettings, + IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AssetCache assetCache, AgentCircuitManager circuitManager) { + // XXX Temporary until we start unpacking the config source + // TODO: Don't forget to account for the null possibility + ClientStackUserSettings userSettings = new ClientStackUserSettings(); + proxyPortOffset = proxyPortOffsetParm; listenPort = (uint) (port + proxyPortOffsetParm); listenIP = _listenIP; diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs index 352f697..d55f423 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs @@ -27,6 +27,7 @@ using System.Net; using log4net; +using Nini.Config; using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; using OpenMetaverse; @@ -68,12 +69,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests IScene scene, out TestLLUDPServer testLLUDPServer, out TestLLPacketServer testPacketServer, out AgentCircuitManager acm) { + IConfigSource configSource = new IniConfigSource(); ClientStackUserSettings userSettings = new ClientStackUserSettings(); testLLUDPServer = new TestLLUDPServer(); acm = new AgentCircuitManager(); uint port = 666; - testLLUDPServer.Initialise(null, ref port, 0, false, userSettings, null, acm); + testLLUDPServer.Initialise(null, ref port, 0, false, configSource, null, acm); testPacketServer = new TestLLPacketServer(testLLUDPServer, userSettings); testLLUDPServer.LocalScene = scene; } diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 4006066..b671fc5 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -122,14 +122,16 @@ namespace OpenSim.Region.ClientStack /// /// Create a scene and its initial base structures. /// + /// TODO: Really configSource shouldn't be passed in here, but should be moved up to BaseOpenSimServer and + /// made common to all the servers. + /// /// /// - /// + /// /// /// protected Scene SetupScene( - RegionInfo regionInfo, int proxyOffset, ClientStackUserSettings clientStackUserSettings, - out IClientNetworkServer clientServer) + RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out IClientNetworkServer clientServer) { AgentCircuitManager circuitManager = new AgentCircuitManager(); IPAddress listenIP = regionInfo.InternalEndPoint.Address; @@ -140,7 +142,7 @@ namespace OpenSim.Region.ClientStack clientServer = m_clientStackManager.CreateServer( - listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, clientStackUserSettings, + listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, m_assetCache, circuitManager); regionInfo.InternalEndPoint.Port = (int)port; -- cgit v1.1