diff options
author | Diva Canto | 2015-09-03 15:59:06 -0700 |
---|---|---|
committer | Diva Canto | 2015-09-03 15:59:06 -0700 |
commit | dac8edd5dddb5f3d2a2447fb479144429e32ea68 (patch) | |
tree | 5a68dcaa0f4cd75c97d16abb0a3c0bcb65b49d51 /OpenSim/Region/Application | |
parent | Moved ExtendedPhysics from OptionalModules to Bullet project, because it's ve... (diff) | |
download | opensim-SC_OLD-dac8edd5dddb5f3d2a2447fb479144429e32ea68.zip opensim-SC_OLD-dac8edd5dddb5f3d2a2447fb479144429e32ea68.tar.gz opensim-SC_OLD-dac8edd5dddb5f3d2a2447fb479144429e32ea68.tar.bz2 opensim-SC_OLD-dac8edd5dddb5f3d2a2447fb479144429e32ea68.tar.xz |
Transformed the LLUDP ad-hoc plugin into a region module. It works.
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBackground.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 151 | ||||
-rw-r--r-- | OpenSim/Region/Application/RegionApplicationBase.cs | 104 |
3 files changed, 173 insertions, 84 deletions
diff --git a/OpenSim/Region/Application/OpenSimBackground.cs b/OpenSim/Region/Application/OpenSimBackground.cs index 008c6b0..15d9065 100644 --- a/OpenSim/Region/Application/OpenSimBackground.cs +++ b/OpenSim/Region/Application/OpenSimBackground.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim | |||
55 | base.Startup(); | 55 | base.Startup(); |
56 | 56 | ||
57 | m_log.InfoFormat("[OPENSIM MAIN]: Startup complete, serving {0} region{1}", | 57 | m_log.InfoFormat("[OPENSIM MAIN]: Startup complete, serving {0} region{1}", |
58 | m_clientServers.Count.ToString(), m_clientServers.Count > 1 ? "s" : ""); | 58 | SceneManager.Scenes.Count, SceneManager.Scenes.Count > 1 ? "s" : ""); |
59 | 59 | ||
60 | WorldHasComeToAnEnd.WaitOne(); | 60 | WorldHasComeToAnEnd.WaitOne(); |
61 | WorldHasComeToAnEnd.Close(); | 61 | WorldHasComeToAnEnd.Close(); |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 980fa85..6e984d8 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -41,7 +41,6 @@ using OpenSim.Framework.Console; | |||
41 | using OpenSim.Framework.Servers; | 41 | using OpenSim.Framework.Servers; |
42 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
43 | using OpenSim.Framework.Monitoring; | 43 | using OpenSim.Framework.Monitoring; |
44 | using OpenSim.Region.ClientStack; | ||
45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; | 44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; |
46 | using OpenSim.Region.Framework; | 45 | using OpenSim.Region.Framework; |
47 | using OpenSim.Region.Framework.Interfaces; | 46 | using OpenSim.Region.Framework.Interfaces; |
@@ -117,19 +116,12 @@ namespace OpenSim | |||
117 | /// </value> | 116 | /// </value> |
118 | public OpenSimConfigSource ConfigSource { get; private set; } | 117 | public OpenSimConfigSource ConfigSource { get; private set; } |
119 | 118 | ||
120 | public List<IClientNetworkServer> ClientServers | ||
121 | { | ||
122 | get { return m_clientServers; } | ||
123 | } | ||
124 | |||
125 | protected EnvConfigSource m_EnvConfigSource = new EnvConfigSource(); | 119 | protected EnvConfigSource m_EnvConfigSource = new EnvConfigSource(); |
126 | 120 | ||
127 | public EnvConfigSource envConfigSource | 121 | public EnvConfigSource envConfigSource |
128 | { | 122 | { |
129 | get { return m_EnvConfigSource; } | 123 | get { return m_EnvConfigSource; } |
130 | } | 124 | } |
131 | |||
132 | protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>(); | ||
133 | 125 | ||
134 | public uint HttpServerPort | 126 | public uint HttpServerPort |
135 | { | 127 | { |
@@ -359,9 +351,9 @@ namespace OpenSim | |||
359 | /// <param name="regionInfo"></param> | 351 | /// <param name="regionInfo"></param> |
360 | /// <param name="portadd_flag"></param> | 352 | /// <param name="portadd_flag"></param> |
361 | /// <returns></returns> | 353 | /// <returns></returns> |
362 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) | 354 | public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) |
363 | { | 355 | { |
364 | return CreateRegion(regionInfo, portadd_flag, false, out scene); | 356 | CreateRegion(regionInfo, portadd_flag, false, out scene); |
365 | } | 357 | } |
366 | 358 | ||
367 | /// <summary> | 359 | /// <summary> |
@@ -369,9 +361,9 @@ namespace OpenSim | |||
369 | /// </summary> | 361 | /// </summary> |
370 | /// <param name="regionInfo"></param> | 362 | /// <param name="regionInfo"></param> |
371 | /// <returns></returns> | 363 | /// <returns></returns> |
372 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, out IScene scene) | 364 | public void CreateRegion(RegionInfo regionInfo, out IScene scene) |
373 | { | 365 | { |
374 | return CreateRegion(regionInfo, false, true, out scene); | 366 | CreateRegion(regionInfo, false, true, out scene); |
375 | } | 367 | } |
376 | 368 | ||
377 | /// <summary> | 369 | /// <summary> |
@@ -381,7 +373,7 @@ namespace OpenSim | |||
381 | /// <param name="portadd_flag"></param> | 373 | /// <param name="portadd_flag"></param> |
382 | /// <param name="do_post_init"></param> | 374 | /// <param name="do_post_init"></param> |
383 | /// <returns></returns> | 375 | /// <returns></returns> |
384 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) | 376 | public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) |
385 | { | 377 | { |
386 | int port = regionInfo.InternalEndPoint.Port; | 378 | int port = regionInfo.InternalEndPoint.Port; |
387 | 379 | ||
@@ -406,8 +398,7 @@ namespace OpenSim | |||
406 | Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); | 398 | Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); |
407 | } | 399 | } |
408 | 400 | ||
409 | List<IClientNetworkServer> clientServers; | 401 | Scene scene = SetupScene(regionInfo, proxyOffset, Config); |
410 | Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServers); | ||
411 | 402 | ||
412 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); | 403 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); |
413 | 404 | ||
@@ -455,20 +446,20 @@ namespace OpenSim | |||
455 | 446 | ||
456 | SceneManager.Add(scene); | 447 | SceneManager.Add(scene); |
457 | 448 | ||
458 | if (m_autoCreateClientStack) | 449 | //if (m_autoCreateClientStack) |
459 | { | 450 | //{ |
460 | foreach (IClientNetworkServer clientserver in clientServers) | 451 | // foreach (IClientNetworkServer clientserver in clientServers) |
461 | { | 452 | // { |
462 | m_clientServers.Add(clientserver); | 453 | // m_clientServers.Add(clientserver); |
463 | clientserver.Start(); | 454 | // clientserver.Start(); |
464 | } | 455 | // } |
465 | } | 456 | //} |
466 | 457 | ||
467 | scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; | 458 | scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; |
468 | 459 | ||
469 | mscene = scene; | 460 | mscene = scene; |
470 | 461 | ||
471 | return clientServers; | 462 | //return clientServers; |
472 | } | 463 | } |
473 | 464 | ||
474 | /// <summary> | 465 | /// <summary> |
@@ -602,7 +593,7 @@ namespace OpenSim | |||
602 | 593 | ||
603 | scene.DeleteAllSceneObjects(); | 594 | scene.DeleteAllSceneObjects(); |
604 | SceneManager.CloseScene(scene); | 595 | SceneManager.CloseScene(scene); |
605 | ShutdownClientServer(scene.RegionInfo); | 596 | //ShutdownClientServer(scene.RegionInfo); |
606 | 597 | ||
607 | if (!cleanup) | 598 | if (!cleanup) |
608 | return; | 599 | return; |
@@ -663,7 +654,7 @@ namespace OpenSim | |||
663 | } | 654 | } |
664 | 655 | ||
665 | SceneManager.CloseScene(scene); | 656 | SceneManager.CloseScene(scene); |
666 | ShutdownClientServer(scene.RegionInfo); | 657 | //ShutdownClientServer(scene.RegionInfo); |
667 | } | 658 | } |
668 | 659 | ||
669 | /// <summary> | 660 | /// <summary> |
@@ -684,9 +675,9 @@ namespace OpenSim | |||
684 | /// <param name="regionInfo"></param> | 675 | /// <param name="regionInfo"></param> |
685 | /// <param name="clientServer"> </param> | 676 | /// <param name="clientServer"> </param> |
686 | /// <returns></returns> | 677 | /// <returns></returns> |
687 | protected Scene SetupScene(RegionInfo regionInfo, out List<IClientNetworkServer> clientServer) | 678 | protected Scene SetupScene(RegionInfo regionInfo) |
688 | { | 679 | { |
689 | return SetupScene(regionInfo, 0, null, out clientServer); | 680 | return SetupScene(regionInfo, 0, null); |
690 | } | 681 | } |
691 | 682 | ||
692 | /// <summary> | 683 | /// <summary> |
@@ -697,51 +688,45 @@ namespace OpenSim | |||
697 | /// <param name="configSource"></param> | 688 | /// <param name="configSource"></param> |
698 | /// <param name="clientServer"> </param> | 689 | /// <param name="clientServer"> </param> |
699 | /// <returns></returns> | 690 | /// <returns></returns> |
700 | protected Scene SetupScene( | 691 | protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, IConfigSource configSource) |
701 | RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out List<IClientNetworkServer> clientServer) | ||
702 | { | 692 | { |
703 | List<IClientNetworkServer> clientNetworkServers = null; | 693 | //List<IClientNetworkServer> clientNetworkServers = null; |
704 | 694 | ||
705 | AgentCircuitManager circuitManager = new AgentCircuitManager(); | 695 | AgentCircuitManager circuitManager = new AgentCircuitManager(); |
706 | IPAddress listenIP = regionInfo.InternalEndPoint.Address; | 696 | //IPAddress listenIP = regionInfo.InternalEndPoint.Address; |
707 | //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) | 697 | ////if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) |
708 | // listenIP = IPAddress.Parse("0.0.0.0"); | 698 | //// listenIP = IPAddress.Parse("0.0.0.0"); |
709 | 699 | ||
710 | uint port = (uint) regionInfo.InternalEndPoint.Port; | 700 | //uint port = (uint) regionInfo.InternalEndPoint.Port; |
711 | 701 | ||
712 | if (m_autoCreateClientStack) | 702 | //if (m_autoCreateClientStack) |
713 | { | 703 | //{ |
714 | clientNetworkServers = m_clientStackManager.CreateServers( | 704 | // clientNetworkServers = m_clientStackManager.CreateServers( |
715 | listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, | 705 | // listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, |
716 | circuitManager); | 706 | // circuitManager); |
717 | } | 707 | //} |
718 | else | 708 | //else |
719 | { | 709 | //{ |
720 | clientServer = null; | 710 | // clientServer = null; |
721 | } | 711 | //} |
722 | 712 | ||
723 | regionInfo.InternalEndPoint.Port = (int) port; | 713 | //regionInfo.InternalEndPoint.Port = (int) port; |
724 | 714 | ||
725 | Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager); | 715 | Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager); |
726 | 716 | ||
727 | if (m_autoCreateClientStack) | 717 | //if (m_autoCreateClientStack) |
728 | { | 718 | //{ |
729 | foreach (IClientNetworkServer clientnetserver in clientNetworkServers) | 719 | // foreach (IClientNetworkServer clientnetserver in clientNetworkServers) |
730 | { | 720 | // { |
731 | clientnetserver.AddScene(scene); | 721 | // clientnetserver.AddScene(scene); |
732 | } | 722 | // } |
733 | } | 723 | //} |
734 | clientServer = clientNetworkServers; | 724 | //clientServer = clientNetworkServers; |
735 | scene.LoadWorldMap(); | 725 | scene.LoadWorldMap(); |
736 | 726 | ||
737 | return scene; | 727 | return scene; |
738 | } | 728 | } |
739 | 729 | ||
740 | protected override ClientStackManager CreateClientStackManager() | ||
741 | { | ||
742 | return new ClientStackManager(m_configSettings.ClientstackDll); | ||
743 | } | ||
744 | |||
745 | protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, | 730 | protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, |
746 | IEstateDataService estateDataService, AgentCircuitManager circuitManager) | 731 | IEstateDataService estateDataService, AgentCircuitManager circuitManager) |
747 | { | 732 | { |
@@ -751,29 +736,29 @@ namespace OpenSim | |||
751 | Config, m_version); | 736 | Config, m_version); |
752 | } | 737 | } |
753 | 738 | ||
754 | protected void ShutdownClientServer(RegionInfo whichRegion) | 739 | //protected void ShutdownClientServer(RegionInfo whichRegion) |
755 | { | 740 | //{ |
756 | // Close and remove the clientserver for a region | 741 | // // Close and remove the clientserver for a region |
757 | bool foundClientServer = false; | 742 | // bool foundClientServer = false; |
758 | int clientServerElement = 0; | 743 | // int clientServerElement = 0; |
759 | Location location = new Location(whichRegion.RegionHandle); | 744 | // Location location = new Location(whichRegion.RegionHandle); |
760 | 745 | ||
761 | for (int i = 0; i < m_clientServers.Count; i++) | 746 | // for (int i = 0; i < m_clientServers.Count; i++) |
762 | { | 747 | // { |
763 | if (m_clientServers[i].HandlesRegion(location)) | 748 | // if (m_clientServers[i].HandlesRegion(location)) |
764 | { | 749 | // { |
765 | clientServerElement = i; | 750 | // clientServerElement = i; |
766 | foundClientServer = true; | 751 | // foundClientServer = true; |
767 | break; | 752 | // break; |
768 | } | 753 | // } |
769 | } | 754 | // } |
770 | 755 | ||
771 | if (foundClientServer) | 756 | // if (foundClientServer) |
772 | { | 757 | // { |
773 | m_clientServers[clientServerElement].Stop(); | 758 | // m_clientServers[clientServerElement].Stop(); |
774 | m_clientServers.RemoveAt(clientServerElement); | 759 | // m_clientServers.RemoveAt(clientServerElement); |
775 | } | 760 | // } |
776 | } | 761 | //} |
777 | 762 | ||
778 | protected virtual void HandleRestartRegion(RegionInfo whichRegion) | 763 | protected virtual void HandleRestartRegion(RegionInfo whichRegion) |
779 | { | 764 | { |
@@ -781,7 +766,7 @@ namespace OpenSim | |||
781 | "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})", | 766 | "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})", |
782 | whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY); | 767 | whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY); |
783 | 768 | ||
784 | ShutdownClientServer(whichRegion); | 769 | //ShutdownClientServer(whichRegion); |
785 | IScene scene; | 770 | IScene scene; |
786 | CreateRegion(whichRegion, true, out scene); | 771 | CreateRegion(whichRegion, true, out scene); |
787 | scene.Start(); | 772 | scene.Start(); |
diff --git a/OpenSim/Region/Application/RegionApplicationBase.cs b/OpenSim/Region/Application/RegionApplicationBase.cs new file mode 100644 index 0000000..b58c998 --- /dev/null +++ b/OpenSim/Region/Application/RegionApplicationBase.cs | |||
@@ -0,0 +1,104 @@ | |||
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 OpenSimulator 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 | |||
28 | using System.Collections.Generic; | ||
29 | using System.Net; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Communications; | ||
36 | using OpenSim.Framework.Servers; | ||
37 | using OpenSim.Framework.Servers.HttpServer; | ||
38 | using OpenSim.Region.Framework; | ||
39 | using OpenSim.Region.Framework.Interfaces; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | using OpenSim.Region.PhysicsModules.SharedBase; | ||
42 | using OpenSim.Services.Interfaces; | ||
43 | |||
44 | namespace OpenSim | ||
45 | { | ||
46 | public abstract class RegionApplicationBase : BaseOpenSimServer | ||
47 | { | ||
48 | private static readonly ILog m_log | ||
49 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>(); | ||
52 | protected NetworkServersInfo m_networkServersInfo; | ||
53 | protected uint m_httpServerPort; | ||
54 | protected ISimulationDataService m_simulationDataService; | ||
55 | protected IEstateDataService m_estateDataService; | ||
56 | |||
57 | public SceneManager SceneManager { get; protected set; } | ||
58 | public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } } | ||
59 | public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } } | ||
60 | public IEstateDataService EstateDataService { get { return m_estateDataService; } } | ||
61 | |||
62 | protected abstract void Initialize(); | ||
63 | |||
64 | protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); | ||
65 | |||
66 | protected override void StartupSpecific() | ||
67 | { | ||
68 | SceneManager = SceneManager.Instance; | ||
69 | |||
70 | Initialize(); | ||
71 | |||
72 | m_httpServer | ||
73 | = new BaseHttpServer( | ||
74 | m_httpServerPort, m_networkServersInfo.HttpUsesSSL, m_networkServersInfo.httpSSLPort, | ||
75 | m_networkServersInfo.HttpSSLCN); | ||
76 | |||
77 | if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)) | ||
78 | { | ||
79 | m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); | ||
80 | } | ||
81 | |||
82 | m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort); | ||
83 | m_httpServer.Start(); | ||
84 | |||
85 | MainServer.AddHttpServer(m_httpServer); | ||
86 | MainServer.Instance = m_httpServer; | ||
87 | |||
88 | // "OOB" Server | ||
89 | if (m_networkServersInfo.ssl_listener) | ||
90 | { | ||
91 | BaseHttpServer server = new BaseHttpServer( | ||
92 | m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, | ||
93 | m_networkServersInfo.cert_pass); | ||
94 | |||
95 | m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); | ||
96 | MainServer.AddHttpServer(server); | ||
97 | server.Start(); | ||
98 | } | ||
99 | |||
100 | base.StartupSpecific(); | ||
101 | } | ||
102 | |||
103 | } | ||
104 | } \ No newline at end of file | ||