* Use nini to pass config information to the client stack, rather than the ClientStackUserSettings class

* This conforms better to other module usage
0.6.0-stable
Justin Clarke Casey 2008-11-03 18:33:35 +00:00
parent add42f5e9b
commit 8c71954e08
10 changed files with 43 additions and 29 deletions

View File

@ -77,7 +77,6 @@ namespace OpenSim.Framework.Servers
public class RestSessionObjectPosterResponse<TRequest, TResponse>
{
public ReturnResponse<TResponse> ResponseCallback;
public void BeginPostObject(string requestUrl, TRequest obj, string sid, string aid)

View File

@ -208,13 +208,13 @@ namespace OpenSim
/// <returns></returns>
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");

View File

@ -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
/// <param name="port"></param>
/// <param name="proxyPortOffset"></param>
/// <param name="allow_alternate_port"></param>
/// <param name="settings">
/// <param name="configSource">
/// Can be null, in which case default values are used
/// </param>
/// <param name="assetCache"></param>
/// <param name="authenticateClass"></param>
/// <returns></returns>
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;
}

View File

@ -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; }

View File

@ -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;

View File

@ -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();

View File

@ -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);
}
/// <summary>
@ -140,13 +141,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="port"></param>
/// <param name="proxyPortOffsetParm"></param>
/// <param name="allow_alternate_port"></param>
/// <param name="userSettings"></param>
/// <param name="configSource"></param>
/// <param name="assetCache"></param>
/// <param name="circuitManager"></param>
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;

View File

@ -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;
}

View File

@ -122,14 +122,16 @@ namespace OpenSim.Region.ClientStack
/// <summary>
/// Create a scene and its initial base structures.
/// </summary>
/// TODO: Really configSource shouldn't be passed in here, but should be moved up to BaseOpenSimServer and
/// made common to all the servers.
///
/// <param name="regionInfo"></param>
/// <param name="proxyOffset"></param>
/// <param name="clientStackUserSettings"></param>
/// <param name="configSource"></param>
/// <param name="clientServer"> </param>
/// <returns></returns>
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;

View File

@ -996,6 +996,7 @@
<ReferencePath>../../../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="log4net.dll"/>
<Reference name="Nini.dll" />
<Reference name="nunit.framework.dll" />
<Reference name="OpenMetaverse.dll"/>
<Reference name="OpenMetaverseTypes.dll"/>