aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
authorMW2009-03-02 16:33:11 +0000
committerMW2009-03-02 16:33:11 +0000
commit3c46ee93269cbb7944442f5de23bb10cf77bf9af (patch)
treedfe78dabcf2c907db29254ed114d46d36729e740 /OpenSim/Region/Application
parentChanged IClientNetworkServer.AddScene method from void AddScene(Scene x) to v... (diff)
downloadopensim-SC_OLD-3c46ee93269cbb7944442f5de23bb10cf77bf9af.zip
opensim-SC_OLD-3c46ee93269cbb7944442f5de23bb10cf77bf9af.tar.gz
opensim-SC_OLD-3c46ee93269cbb7944442f5de23bb10cf77bf9af.tar.bz2
opensim-SC_OLD-3c46ee93269cbb7944442f5de23bb10cf77bf9af.tar.xz
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/Application')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs113
1 files changed, 99 insertions, 14 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 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Net;
31using System.Reflection; 32using System.Reflection;
32using System.Text; 33using System.Text;
33using log4net; 34using log4net;
34using Nini.Config; 35using Nini.Config;
36using OpenMetaverse;
35using OpenSim.Framework; 37using OpenSim.Framework;
36using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
37using OpenSim.Framework.Communications.Cache; 39using 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);