aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/ClientStackManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/ClientStackManager.cs')
-rw-r--r--OpenSim/Region/ClientStack/ClientStackManager.cs83
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
28using System; 28using System;
29using System.Collections.Generic;
29using System.Net; 30using System.Net;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using 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");