diff options
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBackground.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 125 | ||||
-rw-r--r-- | OpenSim/Region/Application/RegionApplicationBase.cs | 115 |
3 files changed, 140 insertions, 102 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 9108e5d..a7ebff3 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -36,17 +36,15 @@ using log4net; | |||
36 | using Nini.Config; | 36 | using Nini.Config; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Communications; | ||
40 | using OpenSim.Framework.Console; | 39 | using OpenSim.Framework.Console; |
41 | using OpenSim.Framework.Servers; | 40 | using OpenSim.Framework.Servers; |
42 | using OpenSim.Framework.Servers.HttpServer; | 41 | using OpenSim.Framework.Servers.HttpServer; |
43 | using OpenSim.Framework.Monitoring; | 42 | using OpenSim.Framework.Monitoring; |
44 | using OpenSim.Region.ClientStack; | ||
45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; | 43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; |
46 | using OpenSim.Region.Framework; | 44 | using OpenSim.Region.Framework; |
47 | using OpenSim.Region.Framework.Interfaces; | 45 | using OpenSim.Region.Framework.Interfaces; |
48 | using OpenSim.Region.Framework.Scenes; | 46 | using OpenSim.Region.Framework.Scenes; |
49 | using OpenSim.Region.Physics.Manager; | 47 | using OpenSim.Region.PhysicsModules.SharedBase; |
50 | using OpenSim.Server.Base; | 48 | using OpenSim.Server.Base; |
51 | using OpenSim.Services.Base; | 49 | using OpenSim.Services.Base; |
52 | using OpenSim.Services.Interfaces; | 50 | using OpenSim.Services.Interfaces; |
@@ -121,19 +119,12 @@ namespace OpenSim | |||
121 | /// </value> | 119 | /// </value> |
122 | public OpenSimConfigSource ConfigSource { get; private set; } | 120 | public OpenSimConfigSource ConfigSource { get; private set; } |
123 | 121 | ||
124 | public List<IClientNetworkServer> ClientServers | ||
125 | { | ||
126 | get { return m_clientServers; } | ||
127 | } | ||
128 | |||
129 | protected EnvConfigSource m_EnvConfigSource = new EnvConfigSource(); | 122 | protected EnvConfigSource m_EnvConfigSource = new EnvConfigSource(); |
130 | 123 | ||
131 | public EnvConfigSource envConfigSource | 124 | public EnvConfigSource envConfigSource |
132 | { | 125 | { |
133 | get { return m_EnvConfigSource; } | 126 | get { return m_EnvConfigSource; } |
134 | } | 127 | } |
135 | |||
136 | protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>(); | ||
137 | 128 | ||
138 | public uint HttpServerPort | 129 | public uint HttpServerPort |
139 | { | 130 | { |
@@ -371,9 +362,9 @@ namespace OpenSim | |||
371 | /// <param name="regionInfo"></param> | 362 | /// <param name="regionInfo"></param> |
372 | /// <param name="portadd_flag"></param> | 363 | /// <param name="portadd_flag"></param> |
373 | /// <returns></returns> | 364 | /// <returns></returns> |
374 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) | 365 | public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) |
375 | { | 366 | { |
376 | return CreateRegion(regionInfo, portadd_flag, false, out scene); | 367 | CreateRegion(regionInfo, portadd_flag, false, out scene); |
377 | } | 368 | } |
378 | 369 | ||
379 | /// <summary> | 370 | /// <summary> |
@@ -381,9 +372,9 @@ namespace OpenSim | |||
381 | /// </summary> | 372 | /// </summary> |
382 | /// <param name="regionInfo"></param> | 373 | /// <param name="regionInfo"></param> |
383 | /// <returns></returns> | 374 | /// <returns></returns> |
384 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, out IScene scene) | 375 | public void CreateRegion(RegionInfo regionInfo, out IScene scene) |
385 | { | 376 | { |
386 | return CreateRegion(regionInfo, false, true, out scene); | 377 | CreateRegion(regionInfo, false, true, out scene); |
387 | } | 378 | } |
388 | 379 | ||
389 | /// <summary> | 380 | /// <summary> |
@@ -393,7 +384,7 @@ namespace OpenSim | |||
393 | /// <param name="portadd_flag"></param> | 384 | /// <param name="portadd_flag"></param> |
394 | /// <param name="do_post_init"></param> | 385 | /// <param name="do_post_init"></param> |
395 | /// <returns></returns> | 386 | /// <returns></returns> |
396 | public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) | 387 | public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) |
397 | { | 388 | { |
398 | int port = regionInfo.InternalEndPoint.Port; | 389 | int port = regionInfo.InternalEndPoint.Port; |
399 | 390 | ||
@@ -418,8 +409,7 @@ namespace OpenSim | |||
418 | Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); | 409 | Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); |
419 | } | 410 | } |
420 | 411 | ||
421 | List<IClientNetworkServer> clientServers; | 412 | Scene scene = SetupScene(regionInfo, proxyOffset, Config); |
422 | Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServers); | ||
423 | 413 | ||
424 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); | 414 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); |
425 | 415 | ||
@@ -511,14 +501,14 @@ namespace OpenSim | |||
511 | 501 | ||
512 | SceneManager.Add(scene); | 502 | SceneManager.Add(scene); |
513 | 503 | ||
514 | if (m_autoCreateClientStack) | 504 | //if (m_autoCreateClientStack) |
515 | { | 505 | //{ |
516 | foreach (IClientNetworkServer clientserver in clientServers) | 506 | // foreach (IClientNetworkServer clientserver in clientServers) |
517 | { | 507 | // { |
518 | m_clientServers.Add(clientserver); | 508 | // m_clientServers.Add(clientserver); |
519 | clientserver.Start(); | 509 | // clientserver.Start(); |
520 | } | 510 | // } |
521 | } | 511 | //} |
522 | 512 | ||
523 | if (scene.SnmpService != null) | 513 | if (scene.SnmpService != null) |
524 | { | 514 | { |
@@ -534,7 +524,7 @@ namespace OpenSim | |||
534 | scene.SnmpService.LinkUp(scene); | 524 | scene.SnmpService.LinkUp(scene); |
535 | } | 525 | } |
536 | 526 | ||
537 | return clientServers; | 527 | //return clientServers; |
538 | } | 528 | } |
539 | 529 | ||
540 | /// <summary> | 530 | /// <summary> |
@@ -673,7 +663,7 @@ namespace OpenSim | |||
673 | 663 | ||
674 | scene.DeleteAllSceneObjects(); | 664 | scene.DeleteAllSceneObjects(); |
675 | SceneManager.CloseScene(scene); | 665 | SceneManager.CloseScene(scene); |
676 | ShutdownClientServer(scene.RegionInfo); | 666 | //ShutdownClientServer(scene.RegionInfo); |
677 | 667 | ||
678 | if (!cleanup) | 668 | if (!cleanup) |
679 | return; | 669 | return; |
@@ -734,7 +724,7 @@ namespace OpenSim | |||
734 | } | 724 | } |
735 | 725 | ||
736 | SceneManager.CloseScene(scene); | 726 | SceneManager.CloseScene(scene); |
737 | ShutdownClientServer(scene.RegionInfo); | 727 | //ShutdownClientServer(scene.RegionInfo); |
738 | } | 728 | } |
739 | 729 | ||
740 | /// <summary> | 730 | /// <summary> |
@@ -755,9 +745,9 @@ namespace OpenSim | |||
755 | /// <param name="regionInfo"></param> | 745 | /// <param name="regionInfo"></param> |
756 | /// <param name="clientServer"> </param> | 746 | /// <param name="clientServer"> </param> |
757 | /// <returns></returns> | 747 | /// <returns></returns> |
758 | protected Scene SetupScene(RegionInfo regionInfo, out List<IClientNetworkServer> clientServer) | 748 | protected Scene SetupScene(RegionInfo regionInfo) |
759 | { | 749 | { |
760 | return SetupScene(regionInfo, 0, null, out clientServer); | 750 | return SetupScene(regionInfo, 0, null); |
761 | } | 751 | } |
762 | 752 | ||
763 | /// <summary> | 753 | /// <summary> |
@@ -768,55 +758,18 @@ namespace OpenSim | |||
768 | /// <param name="configSource"></param> | 758 | /// <param name="configSource"></param> |
769 | /// <param name="clientServer"> </param> | 759 | /// <param name="clientServer"> </param> |
770 | /// <returns></returns> | 760 | /// <returns></returns> |
771 | protected Scene SetupScene( | 761 | protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, IConfigSource configSource) |
772 | RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out List<IClientNetworkServer> clientServer) | ||
773 | { | 762 | { |
774 | List<IClientNetworkServer> clientNetworkServers = null; | 763 | //List<IClientNetworkServer> clientNetworkServers = null; |
775 | 764 | ||
776 | AgentCircuitManager circuitManager = new AgentCircuitManager(); | 765 | AgentCircuitManager circuitManager = new AgentCircuitManager(); |
777 | IPAddress listenIP = regionInfo.InternalEndPoint.Address; | ||
778 | //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) | ||
779 | // listenIP = IPAddress.Parse("0.0.0.0"); | ||
780 | |||
781 | uint port = (uint) regionInfo.InternalEndPoint.Port; | ||
782 | |||
783 | if (m_autoCreateClientStack) | ||
784 | { | ||
785 | clientNetworkServers = m_clientStackManager.CreateServers( | ||
786 | listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, | ||
787 | circuitManager); | ||
788 | } | ||
789 | else | ||
790 | { | ||
791 | clientServer = null; | ||
792 | } | ||
793 | |||
794 | regionInfo.InternalEndPoint.Port = (int) port; | ||
795 | |||
796 | Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager); | 766 | Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager); |
797 | 767 | ||
798 | if (m_autoCreateClientStack) | ||
799 | { | ||
800 | foreach (IClientNetworkServer clientnetserver in clientNetworkServers) | ||
801 | { | ||
802 | clientnetserver.AddScene(scene); | ||
803 | } | ||
804 | } | ||
805 | clientServer = clientNetworkServers; | ||
806 | scene.LoadWorldMap(); | 768 | scene.LoadWorldMap(); |
807 | 769 | ||
808 | scene.PhysicsScene.RequestAssetMethod = scene.PhysicsRequestAsset; | ||
809 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | ||
810 | scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight); | ||
811 | |||
812 | return scene; | 770 | return scene; |
813 | } | 771 | } |
814 | 772 | ||
815 | protected override ClientStackManager CreateClientStackManager() | ||
816 | { | ||
817 | return new ClientStackManager(m_configSettings.ClientstackDll); | ||
818 | } | ||
819 | |||
820 | protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, | 773 | protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, |
821 | IEstateDataService estateDataService, AgentCircuitManager circuitManager) | 774 | IEstateDataService estateDataService, AgentCircuitManager circuitManager) |
822 | { | 775 | { |
@@ -825,42 +778,18 @@ namespace OpenSim | |||
825 | SceneCommunicationService sceneGridService = new SceneCommunicationService(); | 778 | SceneCommunicationService sceneGridService = new SceneCommunicationService(); |
826 | 779 | ||
827 | return new Scene( | 780 | return new Scene( |
828 | regionInfo, circuitManager, physicsScene, sceneGridService, | 781 | regionInfo, circuitManager, |
829 | simDataService, estateDataService, | 782 | simDataService, estateDataService, |
830 | Config, m_version); | 783 | Config, m_version); |
831 | } | 784 | } |
832 | 785 | ||
833 | protected void ShutdownClientServer(RegionInfo whichRegion) | ||
834 | { | ||
835 | // Close and remove the clientserver for a region | ||
836 | bool foundClientServer = false; | ||
837 | int clientServerElement = 0; | ||
838 | Location location = new Location(whichRegion.RegionHandle); | ||
839 | |||
840 | for (int i = 0; i < m_clientServers.Count; i++) | ||
841 | { | ||
842 | if (m_clientServers[i].HandlesRegion(location)) | ||
843 | { | ||
844 | clientServerElement = i; | ||
845 | foundClientServer = true; | ||
846 | break; | ||
847 | } | ||
848 | } | ||
849 | |||
850 | if (foundClientServer) | ||
851 | { | ||
852 | m_clientServers[clientServerElement].Stop(); | ||
853 | m_clientServers.RemoveAt(clientServerElement); | ||
854 | } | ||
855 | } | ||
856 | |||
857 | protected virtual void HandleRestartRegion(RegionInfo whichRegion) | 786 | protected virtual void HandleRestartRegion(RegionInfo whichRegion) |
858 | { | 787 | { |
859 | m_log.InfoFormat( | 788 | m_log.InfoFormat( |
860 | "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})", | 789 | "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})", |
861 | whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY); | 790 | whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY); |
862 | 791 | ||
863 | ShutdownClientServer(whichRegion); | 792 | //ShutdownClientServer(whichRegion); |
864 | IScene scene; | 793 | IScene scene; |
865 | CreateRegion(whichRegion, true, out scene); | 794 | CreateRegion(whichRegion, true, out scene); |
866 | scene.Start(); | 795 | scene.Start(); |
@@ -868,12 +797,6 @@ namespace OpenSim | |||
868 | 797 | ||
869 | # region Setup methods | 798 | # region Setup methods |
870 | 799 | ||
871 | protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier, Vector3 regionExtent) | ||
872 | { | ||
873 | return GetPhysicsScene( | ||
874 | m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier, regionExtent); | ||
875 | } | ||
876 | |||
877 | /// <summary> | 800 | /// <summary> |
878 | /// Handler to supply the current status of this sim | 801 | /// Handler to supply the current status of this sim |
879 | /// </summary> | 802 | /// </summary> |
diff --git a/OpenSim/Region/Application/RegionApplicationBase.cs b/OpenSim/Region/Application/RegionApplicationBase.cs new file mode 100644 index 0000000..ba92fd6 --- /dev/null +++ b/OpenSim/Region/Application/RegionApplicationBase.cs | |||
@@ -0,0 +1,115 @@ | |||
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.Servers; | ||
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Region.Framework; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | using OpenSim.Region.PhysicsModules.SharedBase; | ||
41 | using OpenSim.Services.Interfaces; | ||
42 | |||
43 | namespace OpenSim | ||
44 | { | ||
45 | public abstract class RegionApplicationBase : BaseOpenSimServer | ||
46 | { | ||
47 | private static readonly ILog m_log | ||
48 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>(); | ||
51 | protected NetworkServersInfo m_networkServersInfo; | ||
52 | protected uint m_httpServerPort; | ||
53 | protected ISimulationDataService m_simulationDataService; | ||
54 | protected IEstateDataService m_estateDataService; | ||
55 | |||
56 | public SceneManager SceneManager { get; protected set; } | ||
57 | public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } } | ||
58 | public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } } | ||
59 | public IEstateDataService EstateDataService { get { return m_estateDataService; } } | ||
60 | |||
61 | protected abstract void Initialize(); | ||
62 | |||
63 | protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); | ||
64 | |||
65 | protected override void StartupSpecific() | ||
66 | { | ||
67 | SceneManager = SceneManager.Instance; | ||
68 | |||
69 | Initialize(); | ||
70 | |||
71 | m_httpServer | ||
72 | = new BaseHttpServer( | ||
73 | m_httpServerPort, m_networkServersInfo.HttpUsesSSL, m_networkServersInfo.httpSSLPort, | ||
74 | m_networkServersInfo.HttpSSLCN); | ||
75 | |||
76 | if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort)) | ||
77 | { | ||
78 | m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports"); | ||
79 | } | ||
80 | |||
81 | m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort); | ||
82 | m_httpServer.Start(); | ||
83 | |||
84 | MainServer.AddHttpServer(m_httpServer); | ||
85 | MainServer.Instance = m_httpServer; | ||
86 | |||
87 | // "OOB" Server | ||
88 | if (m_networkServersInfo.ssl_listener) | ||
89 | { | ||
90 | if (!m_networkServersInfo.ssl_external) | ||
91 | { | ||
92 | BaseHttpServer server = new BaseHttpServer( | ||
93 | m_networkServersInfo.https_port, m_networkServersInfo.ssl_listener, m_networkServersInfo.cert_path, | ||
94 | m_networkServersInfo.cert_pass); | ||
95 | |||
96 | m_log.InfoFormat("[REGION SERVER]: Starting HTTPS server on port {0}", server.Port); | ||
97 | MainServer.AddHttpServer(server); | ||
98 | server.Start(); | ||
99 | } | ||
100 | else | ||
101 | { | ||
102 | BaseHttpServer server = new BaseHttpServer( | ||
103 | m_networkServersInfo.https_port); | ||
104 | |||
105 | m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0} for external HTTPS", server.Port); | ||
106 | MainServer.AddHttpServer(server); | ||
107 | server.Start(); | ||
108 | } | ||
109 | } | ||
110 | |||
111 | base.StartupSpecific(); | ||
112 | } | ||
113 | |||
114 | } | ||
115 | } | ||