diff options
author | teravus | 2013-02-03 07:44:45 -0500 |
---|---|---|
committer | teravus | 2013-02-03 07:44:45 -0500 |
commit | d18fbb98b7f51d46eb3e716c59a8e76bc772bad1 (patch) | |
tree | eebf3164c11426bfcec583a629aa482ae1898450 | |
parent | Commit 1 in of this branch feature. This is one of many... (diff) | |
download | opensim-SC_OLD-d18fbb98b7f51d46eb3e716c59a8e76bc772bad1.zip opensim-SC_OLD-d18fbb98b7f51d46eb3e716c59a8e76bc772bad1.tar.gz opensim-SC_OLD-d18fbb98b7f51d46eb3e716c59a8e76bc772bad1.tar.bz2 opensim-SC_OLD-d18fbb98b7f51d46eb3e716c59a8e76bc772bad1.tar.xz |
Adds the ability to load more then one IClientNetworkServer thereby allowing additional client stacks. Use comma separated values in clientstack_plugin in your config.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 37 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientStackManager.cs | 83 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/TCPJSONStream/ClientNetworkContext.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/TCPJSONStream/TCPJsonWebSocketServer.cs | 2 | ||||
-rw-r--r-- | bin/OpenSimDefaults.ini | 2 |
5 files changed, 78 insertions, 49 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index c3c87e7..f5c06df 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -316,7 +316,7 @@ namespace OpenSim | |||
316 | /// <param name="regionInfo"></param> | 316 | /// <param name="regionInfo"></param> |
317 | /// <param name="portadd_flag"></param> | 317 | /// <param name="portadd_flag"></param> |
318 | /// <returns></returns> | 318 | /// <returns></returns> |
319 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) | 319 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) |
320 | { | 320 | { |
321 | return CreateRegion(regionInfo, portadd_flag, false, out scene); | 321 | return CreateRegion(regionInfo, portadd_flag, false, out scene); |
322 | } | 322 | } |
@@ -326,7 +326,7 @@ namespace OpenSim | |||
326 | /// </summary> | 326 | /// </summary> |
327 | /// <param name="regionInfo"></param> | 327 | /// <param name="regionInfo"></param> |
328 | /// <returns></returns> | 328 | /// <returns></returns> |
329 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, out IScene scene) | 329 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, out IScene scene) |
330 | { | 330 | { |
331 | return CreateRegion(regionInfo, false, true, out scene); | 331 | return CreateRegion(regionInfo, false, true, out scene); |
332 | } | 332 | } |
@@ -338,7 +338,7 @@ namespace OpenSim | |||
338 | /// <param name="portadd_flag"></param> | 338 | /// <param name="portadd_flag"></param> |
339 | /// <param name="do_post_init"></param> | 339 | /// <param name="do_post_init"></param> |
340 | /// <returns></returns> | 340 | /// <returns></returns> |
341 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) | 341 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) |
342 | { | 342 | { |
343 | int port = regionInfo.InternalEndPoint.Port; | 343 | int port = regionInfo.InternalEndPoint.Port; |
344 | 344 | ||
@@ -363,8 +363,8 @@ namespace OpenSim | |||
363 | Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); | 363 | Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); |
364 | } | 364 | } |
365 | 365 | ||
366 | IClientNetworkServer clientServer; | 366 | List<IClientNetworkServer> clientServers; |
367 | Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServer); | 367 | Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServers); |
368 | 368 | ||
369 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); | 369 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); |
370 | 370 | ||
@@ -414,8 +414,11 @@ namespace OpenSim | |||
414 | 414 | ||
415 | if (m_autoCreateClientStack) | 415 | if (m_autoCreateClientStack) |
416 | { | 416 | { |
417 | m_clientServers.Add(clientServer); | 417 | foreach (IClientNetworkServer clientserver in clientServers) |
418 | clientServer.Start(); | 418 | { |
419 | m_clientServers.Add(clientserver); | ||
420 | clientserver.Start(); | ||
421 | } | ||
419 | } | 422 | } |
420 | 423 | ||
421 | scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; | 424 | scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; |
@@ -425,7 +428,7 @@ namespace OpenSim | |||
425 | scene.Start(); | 428 | scene.Start(); |
426 | scene.StartScripts(); | 429 | scene.StartScripts(); |
427 | 430 | ||
428 | return clientServer; | 431 | return clientServers; |
429 | } | 432 | } |
430 | 433 | ||
431 | /// <summary> | 434 | /// <summary> |
@@ -641,7 +644,7 @@ namespace OpenSim | |||
641 | /// <param name="regionInfo"></param> | 644 | /// <param name="regionInfo"></param> |
642 | /// <param name="clientServer"> </param> | 645 | /// <param name="clientServer"> </param> |
643 | /// <returns></returns> | 646 | /// <returns></returns> |
644 | protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer) | 647 | protected Scene SetupScene(RegionInfo regionInfo, out List<IClientNetworkServer> clientServer) |
645 | { | 648 | { |
646 | return SetupScene(regionInfo, 0, null, out clientServer); | 649 | return SetupScene(regionInfo, 0, null, out clientServer); |
647 | } | 650 | } |
@@ -655,19 +658,20 @@ namespace OpenSim | |||
655 | /// <param name="clientServer"> </param> | 658 | /// <param name="clientServer"> </param> |
656 | /// <returns></returns> | 659 | /// <returns></returns> |
657 | protected Scene SetupScene( | 660 | protected Scene SetupScene( |
658 | RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out IClientNetworkServer clientServer) | 661 | RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out List<IClientNetworkServer> clientServer) |
659 | { | 662 | { |
663 | List<IClientNetworkServer> clientNetworkServers = null; | ||
664 | |||
660 | AgentCircuitManager circuitManager = new AgentCircuitManager(); | 665 | AgentCircuitManager circuitManager = new AgentCircuitManager(); |
661 | IPAddress listenIP = regionInfo.InternalEndPoint.Address; | 666 | IPAddress listenIP = regionInfo.InternalEndPoint.Address; |
662 | //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) | 667 | //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) |
663 | // listenIP = IPAddress.Parse("0.0.0.0"); | 668 | // listenIP = IPAddress.Parse("0.0.0.0"); |
664 | 669 | ||
665 | uint port = (uint) regionInfo.InternalEndPoint.Port; | 670 | uint port = (uint) regionInfo.InternalEndPoint.Port; |
666 | 671 | IClientNetworkServer clientNetworkServer; | |
667 | if (m_autoCreateClientStack) | 672 | if (m_autoCreateClientStack) |
668 | { | 673 | { |
669 | clientServer | 674 | clientNetworkServers = m_clientStackManager.CreateServers( |
670 | = m_clientStackManager.CreateServer( | ||
671 | listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, | 675 | listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, |
672 | circuitManager); | 676 | circuitManager); |
673 | } | 677 | } |
@@ -682,9 +686,12 @@ namespace OpenSim | |||
682 | 686 | ||
683 | if (m_autoCreateClientStack) | 687 | if (m_autoCreateClientStack) |
684 | { | 688 | { |
685 | clientServer.AddScene(scene); | 689 | foreach (IClientNetworkServer clientnetserver in clientNetworkServers) |
690 | { | ||
691 | clientnetserver.AddScene(scene); | ||
692 | } | ||
686 | } | 693 | } |
687 | 694 | clientServer = clientNetworkServers; | |
688 | scene.LoadWorldMap(); | 695 | scene.LoadWorldMap(); |
689 | 696 | ||
690 | scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); | 697 | scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); |
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"); |
diff --git a/OpenSim/Region/ClientStack/TCPJSONStream/ClientNetworkContext.cs b/OpenSim/Region/ClientStack/TCPJSONStream/ClientNetworkContext.cs index 591f817..b077b6a 100644 --- a/OpenSim/Region/ClientStack/TCPJSONStream/ClientNetworkContext.cs +++ b/OpenSim/Region/ClientStack/TCPJSONStream/ClientNetworkContext.cs | |||
@@ -55,6 +55,9 @@ namespace OpenSim.Region.ClientStack.TCPJSONStream | |||
55 | } | 55 | } |
56 | 56 | ||
57 | } | 57 | } |
58 | catch (Exception) | ||
59 | { | ||
60 | } | ||
58 | } | 61 | } |
59 | /// <summary> | 62 | /// <summary> |
60 | /// send a whole buffer | 63 | /// send a whole buffer |
diff --git a/OpenSim/Region/ClientStack/TCPJSONStream/TCPJsonWebSocketServer.cs b/OpenSim/Region/ClientStack/TCPJSONStream/TCPJsonWebSocketServer.cs index 0713bf4..c0f6792 100644 --- a/OpenSim/Region/ClientStack/TCPJSONStream/TCPJsonWebSocketServer.cs +++ b/OpenSim/Region/ClientStack/TCPJSONStream/TCPJsonWebSocketServer.cs | |||
@@ -99,7 +99,7 @@ namespace OpenSim.Region.ClientStack.TCPJSONStream | |||
99 | } | 99 | } |
100 | ClientNetworkContext context = new ClientNetworkContext((IPEndPoint) socket.RemoteEndPoint, _port, | 100 | ClientNetworkContext context = new ClientNetworkContext((IPEndPoint) socket.RemoteEndPoint, _port, |
101 | new NetworkStream(socket), 16384, socket); | 101 | new NetworkStream(socket), 16384, socket); |
102 | HttpRequestParser parser; | 102 | //HttpRequestParser parser; |
103 | context.BeginRead(); | 103 | context.BeginRead(); |
104 | 104 | ||
105 | } | 105 | } |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index c60579b..cc08094 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -58,7 +58,7 @@ | |||
58 | ; ## | 58 | ; ## |
59 | 59 | ||
60 | ; Set this to the DLL containing the client stack to use. | 60 | ; Set this to the DLL containing the client stack to use. |
61 | clientstack_plugin="OpenSim.Region.ClientStack.LindenUDP.dll" | 61 | clientstack_plugin="OpenSim.Region.ClientStack.LindenUDP.dll,OpenSim.Region.ClientStack.TCPJSONStream.dll" |
62 | 62 | ||
63 | ; ## | 63 | ; ## |
64 | ; ## REGIONS | 64 | ; ## REGIONS |