diff options
author | teravus | 2013-02-03 07:44:45 -0500 |
---|---|---|
committer | teravus | 2013-02-03 08:13:52 -0500 |
commit | 6b0310b82973031fdf35c570bc69450f2f700eb7 (patch) | |
tree | 4f9c278e43c7c61935bd8daad2dedf79237971c2 /OpenSim/Region/ClientStack | |
parent | Sit and Spin reduction. If sitting, slam avatar angular velocity to zero. (diff) | |
download | opensim-SC_OLD-6b0310b82973031fdf35c570bc69450f2f700eb7.zip opensim-SC_OLD-6b0310b82973031fdf35c570bc69450f2f700eb7.tar.gz opensim-SC_OLD-6b0310b82973031fdf35c570bc69450f2f700eb7.tar.bz2 opensim-SC_OLD-6b0310b82973031fdf35c570bc69450f2f700eb7.tar.xz |
Adds the ability to load more then one IClientNetworkServer thereby allowing additional client network servers at the same time. Use comma separated values in clientstack_plugin in your config. Additional plugins lying around shouldn't be picked up because the loader only loads configured dll assemblies and breaks at the first IClientNetworkServer found in the assembly. (the only new functionality is the ability to specify more in config). Note: The existing functionality also passes in a nini config.. and has a boolean to determine if the client network server should be initialized for a specific scene.
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientStackManager.cs | 83 |
1 files changed, 51 insertions, 32 deletions
diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs index 84ea0b3..299aabd 100644 --- a/OpenSim/Region/ClientStack/ClientStackManager.cs +++ b/OpenSim/Region/ClientStack/ClientStackManager.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Net; | 30 | using System.Net; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using log4net; | 32 | using log4net; |
@@ -38,39 +39,53 @@ namespace OpenSim.Region.ClientStack | |||
38 | { | 39 | { |
39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 40 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
40 | 41 | ||
41 | private Type plugin; | 42 | private List<Type> plugin = new List<Type>(); |
42 | private Assembly pluginAssembly; | 43 | private List<Assembly> pluginAssembly = new List<Assembly>(); |
43 | 44 | ||
44 | public ClientStackManager(string dllName) | 45 | public ClientStackManager(string pDllName) |
45 | { | 46 | { |
46 | m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName); | 47 | List<string> clientstacks = new List<string>(); |
47 | 48 | if (pDllName.Contains(",")) | |
48 | try | 49 | { |
50 | clientstacks = new List<string>(pDllName.Split(',')); | ||
51 | } | ||
52 | else | ||
49 | { | 53 | { |
50 | plugin = null; | 54 | clientstacks.Add(pDllName); |
51 | pluginAssembly = Assembly.LoadFrom(dllName); | 55 | } |
56 | foreach (string dllName in clientstacks) | ||
57 | { | ||
58 | m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName); | ||
52 | 59 | ||
53 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 60 | try |
54 | { | 61 | { |
55 | if (pluginType.IsPublic) | 62 | //plugin = null; |
56 | { | 63 | Assembly itemAssembly = Assembly.LoadFrom(dllName); |
57 | Type typeInterface = pluginType.GetInterface("IClientNetworkServer", true); | 64 | pluginAssembly.Add(itemAssembly); |
58 | 65 | ||
59 | if (typeInterface != null) | 66 | foreach (Type pluginType in itemAssembly.GetTypes()) |
67 | { | ||
68 | if (pluginType.IsPublic) | ||
60 | { | 69 | { |
61 | m_log.Info("[CLIENTSTACK]: Added IClientNetworkServer Interface"); | 70 | Type typeInterface = pluginType.GetInterface("IClientNetworkServer", true); |
62 | plugin = pluginType; | 71 | |
63 | return; | 72 | if (typeInterface != null) |
73 | { | ||
74 | m_log.Info("[CLIENTSTACK]: Added IClientNetworkServer Interface"); | ||
75 | plugin.Add(pluginType); | ||
76 | break; | ||
77 | } | ||
64 | } | 78 | } |
65 | } | 79 | } |
66 | } | 80 | } |
67 | } catch (ReflectionTypeLoadException e) | 81 | catch (ReflectionTypeLoadException e) |
68 | { | ||
69 | foreach (Exception e2 in e.LoaderExceptions) | ||
70 | { | 82 | { |
71 | m_log.Error(e2.ToString()); | 83 | foreach (Exception e2 in e.LoaderExceptions) |
84 | { | ||
85 | m_log.Error(e2.ToString()); | ||
86 | } | ||
87 | throw e; | ||
72 | } | 88 | } |
73 | throw e; | ||
74 | } | 89 | } |
75 | } | 90 | } |
76 | 91 | ||
@@ -84,11 +99,11 @@ namespace OpenSim.Region.ClientStack | |||
84 | /// <param name="assetCache"></param> | 99 | /// <param name="assetCache"></param> |
85 | /// <param name="authenticateClass"></param> | 100 | /// <param name="authenticateClass"></param> |
86 | /// <returns></returns> | 101 | /// <returns></returns> |
87 | public IClientNetworkServer CreateServer( | 102 | public List<IClientNetworkServer> CreateServers( |
88 | IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, | 103 | IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, |
89 | AgentCircuitManager authenticateClass) | 104 | AgentCircuitManager authenticateClass) |
90 | { | 105 | { |
91 | return CreateServer( | 106 | return CreateServers( |
92 | _listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass); | 107 | _listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass); |
93 | } | 108 | } |
94 | 109 | ||
@@ -105,20 +120,24 @@ namespace OpenSim.Region.ClientStack | |||
105 | /// <param name="assetCache"></param> | 120 | /// <param name="assetCache"></param> |
106 | /// <param name="authenticateClass"></param> | 121 | /// <param name="authenticateClass"></param> |
107 | /// <returns></returns> | 122 | /// <returns></returns> |
108 | public IClientNetworkServer CreateServer( | 123 | public List<IClientNetworkServer> CreateServers( |
109 | IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource, | 124 | IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource, |
110 | AgentCircuitManager authenticateClass) | 125 | AgentCircuitManager authenticateClass) |
111 | { | 126 | { |
127 | List<IClientNetworkServer> servers = new List<IClientNetworkServer>(); | ||
112 | if (plugin != null) | 128 | if (plugin != null) |
113 | { | 129 | { |
114 | IClientNetworkServer server = | 130 | for (int i = 0; i < plugin.Count; i++) |
115 | (IClientNetworkServer)Activator.CreateInstance(pluginAssembly.GetType(plugin.ToString())); | 131 | { |
116 | 132 | IClientNetworkServer server = | |
117 | server.Initialise( | 133 | (IClientNetworkServer) Activator.CreateInstance(pluginAssembly[i].GetType(plugin[i].ToString())); |
118 | _listenIP, ref port, proxyPortOffset, allow_alternate_port, | 134 | |
119 | configSource, authenticateClass); | 135 | server.Initialise( |
120 | 136 | _listenIP, ref port, proxyPortOffset, allow_alternate_port, | |
121 | return server; | 137 | configSource, authenticateClass); |
138 | servers.Add(server); | ||
139 | } | ||
140 | return servers; | ||
122 | } | 141 | } |
123 | 142 | ||
124 | m_log.Error("[CLIENTSTACK]: Couldn't initialize a new server"); | 143 | m_log.Error("[CLIENTSTACK]: Couldn't initialize a new server"); |