aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJohan Berntsson2008-06-20 01:35:54 +0000
committerJohan Berntsson2008-06-20 01:35:54 +0000
commit20e403685345e0e85d2eb54557b61dddc0af885e (patch)
tree91651802445b37bb6d64a6277a2b4231b14673a6
parentMantis#1573. Thank you kindly, Mikem for a patch to our (diff)
downloadopensim-SC-20e403685345e0e85d2eb54557b61dddc0af885e.zip
opensim-SC-20e403685345e0e85d2eb54557b61dddc0af885e.tar.gz
opensim-SC-20e403685345e0e85d2eb54557b61dddc0af885e.tar.bz2
opensim-SC-20e403685345e0e85d2eb54557b61dddc0af885e.tar.xz
Implemented plugin support for ClientStack, with LindenUDP as the default plugin. This makes it easy for developers to experiment with alternative communication protocols
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs8
-rw-r--r--OpenSim/Region/ClientStack/ClientStackManager.cs81
-rw-r--r--OpenSim/Region/ClientStack/IClientNetworkServer.cs7
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs5
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs10
-rw-r--r--ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs2
-rw-r--r--prebuild.xml38
8 files changed, 147 insertions, 6 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 6d74903..572e98f 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -81,6 +81,7 @@ namespace OpenSim
81 protected LocalLoginService m_loginService; 81 protected LocalLoginService m_loginService;
82 82
83 protected string m_storageDll; 83 protected string m_storageDll;
84 protected string m_clientstackDll;
84 85
85 protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>(); 86 protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
86 protected List<RegionInfo> m_regionData = new List<RegionInfo>(); 87 protected List<RegionInfo> m_regionData = new List<RegionInfo>();
@@ -214,6 +215,7 @@ namespace OpenSim
214 config.Set("shutdown_console_commands_file", String.Empty); 215 config.Set("shutdown_console_commands_file", String.Empty);
215 config.Set("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); 216 config.Set("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
216 config.Set("asset_database", "sqlite"); 217 config.Set("asset_database", "sqlite");
218 config.Set("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
217 } 219 }
218 220
219 if (DefaultConfig.Configs["StandAlone"] == null) 221 if (DefaultConfig.Configs["StandAlone"] == null)
@@ -301,6 +303,7 @@ namespace OpenSim
301 303
302 m_scriptEngine = startupConfig.GetString("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); 304 m_scriptEngine = startupConfig.GetString("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
303 m_assetStorage = startupConfig.GetString("asset_database", "local"); 305 m_assetStorage = startupConfig.GetString("asset_database", "local");
306 m_clientstackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
304 } 307 }
305 308
306 IConfig standaloneConfig = m_config.Configs["StandAlone"]; 309 IConfig standaloneConfig = m_config.Configs["StandAlone"];
@@ -553,6 +556,11 @@ namespace OpenSim
553 return new StorageManager(m_storageDll, connectionstring, m_storagePersistPrimInventories); 556 return new StorageManager(m_storageDll, connectionstring, m_storagePersistPrimInventories);
554 } 557 }
555 558
559 protected override ClientStackManager CreateClientStackManager()
560 {
561 return new ClientStackManager(m_clientstackDll);
562 }
563
556 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, 564 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
557 AgentCircuitManager circuitManager) 565 AgentCircuitManager circuitManager)
558 { 566 {
diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs
new file mode 100644
index 0000000..b5cd06a
--- /dev/null
+++ b/OpenSim/Region/ClientStack/ClientStackManager.cs
@@ -0,0 +1,81 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Net;
30using System.Reflection;
31using log4net;
32using OpenSim.Framework;
33using OpenSim.Region.ClientStack;
34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Communications.Cache;
36
37namespace OpenSim.Region.Environment
38{
39 public class ClientStackManager
40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42
43 private Type plugin;
44 private Assembly pluginAssembly;
45
46 public ClientStackManager(string dllName) {
47 m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName);
48
49 plugin=null;
50 pluginAssembly = Assembly.LoadFrom(dllName);
51
52 foreach (Type pluginType in pluginAssembly.GetTypes())
53 {
54 if (pluginType.IsPublic)
55 {
56 Type typeInterface = pluginType.GetInterface("IClientNetworkServer", true);
57
58 if (typeInterface != null)
59 {
60 m_log.Info("[CLIENTSTACK]: Added IClientNetworkServer Interface");
61 plugin = pluginType;
62 return;
63 }
64 }
65 }
66 }
67
68 public IClientNetworkServer CreateServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass)
69 {
70 if (plugin != null)
71 {
72 IClientNetworkServer server =
73 (IClientNetworkServer) Activator.CreateInstance(pluginAssembly.GetType(plugin.ToString()));
74 server.Initialise(_listenIP, ref port, proxyPortOffset, allow_alternate_port, assetCache, authenticateClass);
75 return server;
76 }
77 m_log.Error("[CLIENTSTACK] Couldn't initialize a new server");
78 return null;
79 }
80 }
81}
diff --git a/OpenSim/Region/ClientStack/IClientNetworkServer.cs b/OpenSim/Region/ClientStack/IClientNetworkServer.cs
index 10da599..1743fd6 100644
--- a/OpenSim/Region/ClientStack/IClientNetworkServer.cs
+++ b/OpenSim/Region/ClientStack/IClientNetworkServer.cs
@@ -25,14 +25,19 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Net;
28using System.Net.Sockets; 29using System.Net.Sockets;
29using OpenSim.Framework; 30using OpenSim.Framework;
30using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
32using OpenSim.Framework.Communications;
33using OpenSim.Framework.Communications.Cache;
31 34
32namespace OpenSim.Region.ClientStack 35namespace OpenSim.Region.ClientStack
33{ 36{
34 public interface IClientNetworkServer 37 public interface IClientNetworkServer
35 { 38 {
39 void Initialise(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass);
40
36 Socket Server { get; } 41 Socket Server { get; }
37 bool HandlesRegion(Location x); 42 bool HandlesRegion(Location x);
38 void AddScene(Scene x); 43 void AddScene(Scene x);
@@ -40,4 +45,4 @@ namespace OpenSim.Region.ClientStack
40 void Start(); 45 void Start();
41 void Stop(); 46 void Stop();
42 } 47 }
43} \ No newline at end of file 48}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 3dddbfb..3b3ec3d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
72 // } 72 // }
73 73
74 /* static variables */ 74 /* static variables */
75 public static TerrainManager TerrainManager; 75 public static TerrainManager TerrainManager = new TerrainManager(new SecondLife());
76 76
77 public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, LLUUID agentID, ThrottleOutPacketType throttlePacketType); 77 public delegate bool SynchronizeClientHandler(IScene scene, Packet packet, LLUUID agentID, ThrottleOutPacketType throttlePacketType);
78 public static SynchronizeClientHandler SynchronizeClient = null; 78 public static SynchronizeClientHandler SynchronizeClient = null;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 4a56048..eb4b8e7 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -121,6 +121,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
121 121
122 public LLUDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass) 122 public LLUDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass)
123 { 123 {
124 Initialise(_listenIP, ref port, proxyPortOffset, allow_alternate_port, assetCache, authenticateClass);
125 }
126
127 public void Initialise(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass)
128 {
124 this.proxyPortOffset = proxyPortOffset; 129 this.proxyPortOffset = proxyPortOffset;
125 listenPort = (uint) (port + proxyPortOffset); 130 listenPort = (uint) (port + proxyPortOffset);
126 listenIP = _listenIP; 131 listenIP = _listenIP;
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index d96336a..621d0ef 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -35,7 +35,6 @@ using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Communications.Cache; 36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Region.ClientStack.LindenUDP;
39using OpenSim.Region.Environment; 38using OpenSim.Region.Environment;
40using OpenSim.Region.Environment.Scenes; 39using OpenSim.Region.Environment.Scenes;
41using OpenSim.Region.Physics.Manager; 40using OpenSim.Region.Physics.Manager;
@@ -64,6 +63,8 @@ namespace OpenSim.Region.ClientStack
64 protected StorageManager m_storageManager; 63 protected StorageManager m_storageManager;
65 protected string m_storageConnectionString; 64 protected string m_storageConnectionString;
66 65
66 protected ClientStackManager m_clientStackManager;
67
67 // An attribute to indicate whether prim inventories should be persisted. 68 // An attribute to indicate whether prim inventories should be persisted.
68 // Probably will be temporary until this stops being experimental. 69 // Probably will be temporary until this stops being experimental.
69 protected bool m_storagePersistPrimInventories; 70 protected bool m_storagePersistPrimInventories;
@@ -77,10 +78,10 @@ namespace OpenSim.Region.ClientStack
77 { 78 {
78 base.Startup(); 79 base.Startup();
79 80
80 LLClientView.TerrainManager = new TerrainManager(new SecondLife());
81
82 m_storageManager = CreateStorageManager(m_storageConnectionString); 81 m_storageManager = CreateStorageManager(m_storageConnectionString);
83 82
83 m_clientStackManager = CreateClientStackManager();
84
84 Initialize(); 85 Initialize();
85 86
86 m_httpServer = new BaseHttpServer(m_httpServerPort); 87 m_httpServer = new BaseHttpServer(m_httpServerPort);
@@ -101,6 +102,7 @@ namespace OpenSim.Region.ClientStack
101 // protected abstract ConsoleBase CreateConsole(); 102 // protected abstract ConsoleBase CreateConsole();
102 protected abstract PhysicsScene GetPhysicsScene(); 103 protected abstract PhysicsScene GetPhysicsScene();
103 protected abstract StorageManager CreateStorageManager(string connectionstring); 104 protected abstract StorageManager CreateStorageManager(string connectionstring);
105 protected abstract ClientStackManager CreateClientStackManager();
104 106
105 protected PhysicsScene GetPhysicsScene(string engine, string meshEngine, IConfigSource config) 107 protected PhysicsScene GetPhysicsScene(string engine, string meshEngine, IConfigSource config)
106 { 108 {
@@ -123,7 +125,7 @@ namespace OpenSim.Region.ClientStack
123 // listenIP = IPAddress.Parse("0.0.0.0"); 125 // listenIP = IPAddress.Parse("0.0.0.0");
124 126
125 uint port = (uint) regionInfo.InternalEndPoint.Port; 127 uint port = (uint) regionInfo.InternalEndPoint.Port;
126 clientServer = new LLUDPServer(listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager); 128 clientServer = m_clientStackManager.CreateServer(listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager);
127 regionInfo.InternalEndPoint.Port = (int)port; 129 regionInfo.InternalEndPoint.Port = (int)port;
128 130
129 Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); 131 Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
diff --git a/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs b/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs
index 9a6c05b..69b8fea 100644
--- a/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs
+++ b/ThirdParty/3Di/LoadBalancer/LoadBalancerPlugin.cs
@@ -43,6 +43,8 @@ using OpenSim.Region.ClientStack;
43using OpenSim.Region.ClientStack.LindenUDP; 43using OpenSim.Region.ClientStack.LindenUDP;
44using OpenSim.Region.Environment.Scenes; 44using OpenSim.Region.Environment.Scenes;
45 45
46// TODO: remove LindenUDP dependency
47
46[assembly : Addin] 48[assembly : Addin]
47[assembly : AddinDependency("OpenSim", "0.5")] 49[assembly : AddinDependency("OpenSim", "0.5")]
48[assembly : AddinDependency("RegionProxy", "0.1")] 50[assembly : AddinDependency("RegionProxy", "0.1")]
diff --git a/prebuild.xml b/prebuild.xml
index 7413b1b..1b24fa7 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -819,6 +819,43 @@
819 <Reference name="log4net.dll"/> 819 <Reference name="log4net.dll"/>
820 820
821 <Files> 821 <Files>
822 <Match pattern="*.cs" recurse="false"/>
823 </Files>
824 </Project>
825
826 <!-- ClientStack Plugins -->
827 <Project name="OpenSim.Region.ClientStack.LindenUDP" path="OpenSim/Region/ClientStack/LindenUDP" type="Library">
828 <Configuration name="Debug">
829 <Options>
830 <OutputPath>../../../../bin/</OutputPath>
831 </Options>
832 </Configuration>
833 <Configuration name="Release">
834 <Options>
835 <OutputPath>../../../../bin/</OutputPath>
836 </Options>
837 </Configuration>
838
839 <ReferencePath>../../../../bin/</ReferencePath>
840 <Reference name="System" localCopy="false"/>
841 <Reference name="System.Xml"/>
842 <Reference name="libsecondlife.dll"/>
843 <Reference name="Axiom.MathLib.dll"/>
844 <Reference name="OpenSim.Region.Environment"/>
845 <Reference name="OpenSim.Framework"/>
846 <Reference name="OpenSim.Data"/>
847 <Reference name="OpenSim.Framework.Servers"/>
848 <Reference name="OpenSim.Framework.Console"/>
849 <Reference name="OpenSim.Framework.Communications"/>
850 <Reference name="OpenSim.Framework.Statistics"/>
851 <Reference name="OpenSim.Region.ClientStack"/>
852 <Reference name="OpenSim.Region.Communications.Local"/>
853 <Reference name="OpenSim.Region.Physics.Manager"/>
854 <Reference name="XMLRPC.dll"/>
855 <Reference name="Nini.dll" />
856 <Reference name="log4net.dll"/>
857
858 <Files>
822 <Match pattern="*.cs" recurse="true"/> 859 <Match pattern="*.cs" recurse="true"/>
823 </Files> 860 </Files>
824 </Project> 861 </Project>
@@ -1900,6 +1937,7 @@
1900 <Reference name="OpenSim.Framework.Console"/> 1937 <Reference name="OpenSim.Framework.Console"/>
1901 <Reference name="OpenSim.Region.Environment"/> 1938 <Reference name="OpenSim.Region.Environment"/>
1902 <Reference name="OpenSim.Region.ClientStack"/> 1939 <Reference name="OpenSim.Region.ClientStack"/>
1940 <Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
1903 <Reference name="OpenSim.Region.Physics.Manager"/> 1941 <Reference name="OpenSim.Region.Physics.Manager"/>
1904 <Reference name="libsecondlife.dll"/> 1942 <Reference name="libsecondlife.dll"/>
1905 <Files> 1943 <Files>