diff options
Moved the SetupScene methods from RegionApplicationBase to OpenSimBase [Do we really still need RegionApplicationBase?]
Added a flag (bool m_autoCreateLindenStack = true) which says if the ClientStack will be autocreated and initialised when creating regions. This helps with moving ClientStacks to Region modules.
Currently this flag is hardcoded to true, as it is only for testing at the moment, so you need to change the value in the code if you want to turn off auto creating.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 113 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/RegionApplicationBase.cs | 81 |
2 files changed, 99 insertions, 95 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 8021b8f..10f75c1 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -28,10 +28,12 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Net; | ||
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using System.Text; | 33 | using System.Text; |
33 | using log4net; | 34 | using log4net; |
34 | using Nini.Config; | 35 | using Nini.Config; |
36 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Framework.Communications.Cache; | 39 | using OpenSim.Framework.Communications.Cache; |
@@ -62,7 +64,9 @@ namespace OpenSim | |||
62 | private const string PLUGIN_ASSET_SERVER_CLIENT = "/OpenSim/AssetClient"; | 64 | private const string PLUGIN_ASSET_SERVER_CLIENT = "/OpenSim/AssetClient"; |
63 | 65 | ||
64 | protected string proxyUrl; | 66 | protected string proxyUrl; |
65 | protected int proxyOffset = 0; | 67 | protected int proxyOffset = 0; |
68 | |||
69 | protected bool m_autoCreateLindenStack = true; | ||
66 | 70 | ||
67 | /// <summary> | 71 | /// <summary> |
68 | /// The file used to load and save prim backup xml if no filename has been specified | 72 | /// The file used to load and save prim backup xml if no filename has been specified |
@@ -186,17 +190,6 @@ namespace OpenSim | |||
186 | 190 | ||
187 | LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_configSettings.LibrariesXMLFile); | 191 | LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_configSettings.LibrariesXMLFile); |
188 | 192 | ||
189 | //// Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false) | ||
190 | //if (m_configSettings.Standalone) | ||
191 | //{ | ||
192 | // InitialiseStandaloneServices(libraryRootFolder); | ||
193 | //} | ||
194 | //else | ||
195 | //{ | ||
196 | // // We are in grid mode | ||
197 | // InitialiseGridServices(libraryRootFolder); | ||
198 | //} | ||
199 | |||
200 | // Create a ModuleLoader instance | 193 | // Create a ModuleLoader instance |
201 | m_moduleLoader = new ModuleLoader(m_config.Source); | 194 | m_moduleLoader = new ModuleLoader(m_config.Source); |
202 | 195 | ||
@@ -544,6 +537,7 @@ namespace OpenSim | |||
544 | { | 537 | { |
545 | // set proxy url to RegionInfo | 538 | // set proxy url to RegionInfo |
546 | regionInfo.proxyUrl = proxyUrl; | 539 | regionInfo.proxyUrl = proxyUrl; |
540 | regionInfo.ProxyOffset = proxyOffset; | ||
547 | Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); | 541 | Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); |
548 | } | 542 | } |
549 | 543 | ||
@@ -591,8 +585,11 @@ namespace OpenSim | |||
591 | 585 | ||
592 | m_sceneManager.Add(scene); | 586 | m_sceneManager.Add(scene); |
593 | 587 | ||
594 | m_clientServers.Add(clientServer); | 588 | if (m_autoCreateLindenStack) |
595 | clientServer.Start(); | 589 | { |
590 | m_clientServers.Add(clientServer); | ||
591 | clientServer.Start(); | ||
592 | } | ||
596 | 593 | ||
597 | if (do_post_init) | 594 | if (do_post_init) |
598 | { | 595 | { |
@@ -636,6 +633,94 @@ namespace OpenSim | |||
636 | RemoveRegion(target, cleanUp); | 633 | RemoveRegion(target, cleanUp); |
637 | } | 634 | } |
638 | 635 | ||
636 | /// <summary> | ||
637 | /// Create a scene and its initial base structures. | ||
638 | /// </summary> | ||
639 | /// <param name="regionInfo"></param> | ||
640 | /// <param name="clientServer"> </param> | ||
641 | /// <returns></returns> | ||
642 | protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer) | ||
643 | { | ||
644 | return SetupScene(regionInfo, 0, null, out clientServer); | ||
645 | } | ||
646 | |||
647 | /// <summary> | ||
648 | /// Create a scene and its initial base structures. | ||
649 | /// </summary> | ||
650 | /// <param name="regionInfo"></param> | ||
651 | /// <param name="proxyOffset"></param> | ||
652 | /// <param name="configSource"></param> | ||
653 | /// <param name="clientServer"> </param> | ||
654 | /// <returns></returns> | ||
655 | protected Scene SetupScene( | ||
656 | RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out IClientNetworkServer clientServer) | ||
657 | { | ||
658 | AgentCircuitManager circuitManager = new AgentCircuitManager(); | ||
659 | IPAddress listenIP = regionInfo.InternalEndPoint.Address; | ||
660 | //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) | ||
661 | // listenIP = IPAddress.Parse("0.0.0.0"); | ||
662 | |||
663 | uint port = (uint)regionInfo.InternalEndPoint.Port; | ||
664 | |||
665 | if (m_autoCreateLindenStack) | ||
666 | { | ||
667 | clientServer | ||
668 | = m_clientStackManager.CreateServer( | ||
669 | listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, | ||
670 | m_assetCache, circuitManager); | ||
671 | } | ||
672 | else | ||
673 | { | ||
674 | clientServer = null; | ||
675 | } | ||
676 | |||
677 | regionInfo.InternalEndPoint.Port = (int)port; | ||
678 | |||
679 | Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); | ||
680 | |||
681 | if (m_autoCreateLindenStack) | ||
682 | { | ||
683 | clientServer.AddScene(scene); | ||
684 | } | ||
685 | |||
686 | scene.LoadWorldMap(); | ||
687 | |||
688 | scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); | ||
689 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | ||
690 | scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight); | ||
691 | |||
692 | // TODO: Remove this cruft once MasterAvatar is fully deprecated | ||
693 | //Master Avatar Setup | ||
694 | UserProfileData masterAvatar; | ||
695 | if (scene.RegionInfo.MasterAvatarAssignedUUID == UUID.Zero) | ||
696 | { | ||
697 | masterAvatar = | ||
698 | m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, | ||
699 | scene.RegionInfo.MasterAvatarLastName, | ||
700 | scene.RegionInfo.MasterAvatarSandboxPassword); | ||
701 | } | ||
702 | else | ||
703 | { | ||
704 | masterAvatar = m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarAssignedUUID); | ||
705 | scene.RegionInfo.MasterAvatarFirstName = masterAvatar.FirstName; | ||
706 | scene.RegionInfo.MasterAvatarLastName = masterAvatar.SurName; | ||
707 | } | ||
708 | |||
709 | if (masterAvatar == null) | ||
710 | { | ||
711 | m_log.Info("[PARCEL]: No master avatar found, using null."); | ||
712 | scene.RegionInfo.MasterAvatarAssignedUUID = UUID.Zero; | ||
713 | } | ||
714 | else | ||
715 | { | ||
716 | m_log.InfoFormat("[PARCEL]: Found master avatar {0} {1} [" + masterAvatar.ID.ToString() + "]", | ||
717 | scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName); | ||
718 | scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.ID; | ||
719 | } | ||
720 | |||
721 | return scene; | ||
722 | } | ||
723 | |||
639 | protected override StorageManager CreateStorageManager() | 724 | protected override StorageManager CreateStorageManager() |
640 | { | 725 | { |
641 | return CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString); | 726 | return CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString); |
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 731e0e5..c1c212c 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs | |||
@@ -141,86 +141,5 @@ namespace OpenSim.Region.ClientStack | |||
141 | 141 | ||
142 | return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); | 142 | return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); |
143 | } | 143 | } |
144 | |||
145 | /// <summary> | ||
146 | /// Create a scene and its initial base structures. | ||
147 | /// </summary> | ||
148 | /// <param name="regionInfo"></param> | ||
149 | /// <param name="clientServer"> </param> | ||
150 | /// <returns></returns> | ||
151 | protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer) | ||
152 | { | ||
153 | return SetupScene(regionInfo, 0, null, out clientServer); | ||
154 | } | ||
155 | |||
156 | /// <summary> | ||
157 | /// Create a scene and its initial base structures. | ||
158 | /// </summary> | ||
159 | /// TODO: Really configSource shouldn't be passed in here, but should be moved up to BaseOpenSimServer and | ||
160 | /// made common to all the servers. | ||
161 | /// | ||
162 | /// <param name="regionInfo"></param> | ||
163 | /// <param name="proxyOffset"></param> | ||
164 | /// <param name="configSource"></param> | ||
165 | /// <param name="clientServer"> </param> | ||
166 | /// <returns></returns> | ||
167 | protected Scene SetupScene( | ||
168 | RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out IClientNetworkServer clientServer) | ||
169 | { | ||
170 | AgentCircuitManager circuitManager = new AgentCircuitManager(); | ||
171 | IPAddress listenIP = regionInfo.InternalEndPoint.Address; | ||
172 | //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) | ||
173 | // listenIP = IPAddress.Parse("0.0.0.0"); | ||
174 | |||
175 | uint port = (uint) regionInfo.InternalEndPoint.Port; | ||
176 | |||
177 | clientServer | ||
178 | = m_clientStackManager.CreateServer( | ||
179 | listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, | ||
180 | m_assetCache, circuitManager); | ||
181 | |||
182 | regionInfo.InternalEndPoint.Port = (int)port; | ||
183 | |||
184 | Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); | ||
185 | |||
186 | clientServer.AddScene(scene); | ||
187 | |||
188 | scene.LoadWorldMap(); | ||
189 | |||
190 | scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); | ||
191 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | ||
192 | scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight); | ||
193 | |||
194 | // TODO: Remove this cruft once MasterAvatar is fully deprecated | ||
195 | //Master Avatar Setup | ||
196 | UserProfileData masterAvatar; | ||
197 | if (scene.RegionInfo.MasterAvatarAssignedUUID == UUID.Zero) | ||
198 | { | ||
199 | masterAvatar = | ||
200 | m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, | ||
201 | scene.RegionInfo.MasterAvatarLastName, | ||
202 | scene.RegionInfo.MasterAvatarSandboxPassword); | ||
203 | } | ||
204 | else | ||
205 | { | ||
206 | masterAvatar = m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarAssignedUUID); | ||
207 | scene.RegionInfo.MasterAvatarFirstName = masterAvatar.FirstName; | ||
208 | scene.RegionInfo.MasterAvatarLastName = masterAvatar.SurName; | ||
209 | } | ||
210 | |||
211 | if (masterAvatar == null) | ||
212 | { | ||
213 | m_log.Info("[PARCEL]: No master avatar found, using null."); | ||
214 | scene.RegionInfo.MasterAvatarAssignedUUID = UUID.Zero; | ||
215 | } | ||
216 | else | ||
217 | { | ||
218 | m_log.InfoFormat("[PARCEL]: Found master avatar {0} {1} [" + masterAvatar.ID.ToString() + "]", | ||
219 | scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName); | ||
220 | scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.ID; | ||
221 | } | ||
222 | |||
223 | return scene; | ||
224 | } | ||
225 | } | 144 | } |
226 | } | 145 | } |