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.
0.6.4-rc1
MW 2009-03-02 16:33:11 +00:00
parent ff76102644
commit 3c46ee9326
3 changed files with 100 additions and 95 deletions

View File

@ -208,6 +208,7 @@ namespace OpenSim.Framework
public string MasterAvatarSandboxPassword = String.Empty;
public UUID originRegionID = UUID.Zero;
public string proxyUrl = "";
public int ProxyOffset = 0;
public string RegionName = String.Empty;
public string regionSecret = UUID.Random().ToString();

View File

@ -28,10 +28,12 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
@ -64,6 +66,8 @@ namespace OpenSim
protected string proxyUrl;
protected int proxyOffset = 0;
protected bool m_autoCreateLindenStack = true;
/// <summary>
/// The file used to load and save prim backup xml if no filename has been specified
/// </summary>
@ -186,17 +190,6 @@ namespace OpenSim
LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_configSettings.LibrariesXMLFile);
//// Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false)
//if (m_configSettings.Standalone)
//{
// InitialiseStandaloneServices(libraryRootFolder);
//}
//else
//{
// // We are in grid mode
// InitialiseGridServices(libraryRootFolder);
//}
// Create a ModuleLoader instance
m_moduleLoader = new ModuleLoader(m_config.Source);
@ -544,6 +537,7 @@ namespace OpenSim
{
// set proxy url to RegionInfo
regionInfo.proxyUrl = proxyUrl;
regionInfo.ProxyOffset = proxyOffset;
Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
}
@ -591,8 +585,11 @@ namespace OpenSim
m_sceneManager.Add(scene);
m_clientServers.Add(clientServer);
clientServer.Start();
if (m_autoCreateLindenStack)
{
m_clientServers.Add(clientServer);
clientServer.Start();
}
if (do_post_init)
{
@ -636,6 +633,94 @@ namespace OpenSim
RemoveRegion(target, cleanUp);
}
/// <summary>
/// Create a scene and its initial base structures.
/// </summary>
/// <param name="regionInfo"></param>
/// <param name="clientServer"> </param>
/// <returns></returns>
protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer)
{
return SetupScene(regionInfo, 0, null, out clientServer);
}
/// <summary>
/// Create a scene and its initial base structures.
/// </summary>
/// <param name="regionInfo"></param>
/// <param name="proxyOffset"></param>
/// <param name="configSource"></param>
/// <param name="clientServer"> </param>
/// <returns></returns>
protected Scene SetupScene(
RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out IClientNetworkServer clientServer)
{
AgentCircuitManager circuitManager = new AgentCircuitManager();
IPAddress listenIP = regionInfo.InternalEndPoint.Address;
//if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP))
// listenIP = IPAddress.Parse("0.0.0.0");
uint port = (uint)regionInfo.InternalEndPoint.Port;
if (m_autoCreateLindenStack)
{
clientServer
= m_clientStackManager.CreateServer(
listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource,
m_assetCache, circuitManager);
}
else
{
clientServer = null;
}
regionInfo.InternalEndPoint.Port = (int)port;
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
if (m_autoCreateLindenStack)
{
clientServer.AddScene(scene);
}
scene.LoadWorldMap();
scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName);
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight);
// TODO: Remove this cruft once MasterAvatar is fully deprecated
//Master Avatar Setup
UserProfileData masterAvatar;
if (scene.RegionInfo.MasterAvatarAssignedUUID == UUID.Zero)
{
masterAvatar =
m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName,
scene.RegionInfo.MasterAvatarLastName,
scene.RegionInfo.MasterAvatarSandboxPassword);
}
else
{
masterAvatar = m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarAssignedUUID);
scene.RegionInfo.MasterAvatarFirstName = masterAvatar.FirstName;
scene.RegionInfo.MasterAvatarLastName = masterAvatar.SurName;
}
if (masterAvatar == null)
{
m_log.Info("[PARCEL]: No master avatar found, using null.");
scene.RegionInfo.MasterAvatarAssignedUUID = UUID.Zero;
}
else
{
m_log.InfoFormat("[PARCEL]: Found master avatar {0} {1} [" + masterAvatar.ID.ToString() + "]",
scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName);
scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.ID;
}
return scene;
}
protected override StorageManager CreateStorageManager()
{
return CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString);

View File

@ -141,86 +141,5 @@ namespace OpenSim.Region.ClientStack
return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier);
}
/// <summary>
/// Create a scene and its initial base structures.
/// </summary>
/// <param name="regionInfo"></param>
/// <param name="clientServer"> </param>
/// <returns></returns>
protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer)
{
return SetupScene(regionInfo, 0, null, out clientServer);
}
/// <summary>
/// Create a scene and its initial base structures.
/// </summary>
/// TODO: Really configSource shouldn't be passed in here, but should be moved up to BaseOpenSimServer and
/// made common to all the servers.
///
/// <param name="regionInfo"></param>
/// <param name="proxyOffset"></param>
/// <param name="configSource"></param>
/// <param name="clientServer"> </param>
/// <returns></returns>
protected Scene SetupScene(
RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out IClientNetworkServer clientServer)
{
AgentCircuitManager circuitManager = new AgentCircuitManager();
IPAddress listenIP = regionInfo.InternalEndPoint.Address;
//if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP))
// listenIP = IPAddress.Parse("0.0.0.0");
uint port = (uint) regionInfo.InternalEndPoint.Port;
clientServer
= m_clientStackManager.CreateServer(
listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource,
m_assetCache, circuitManager);
regionInfo.InternalEndPoint.Port = (int)port;
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
clientServer.AddScene(scene);
scene.LoadWorldMap();
scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName);
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight);
// TODO: Remove this cruft once MasterAvatar is fully deprecated
//Master Avatar Setup
UserProfileData masterAvatar;
if (scene.RegionInfo.MasterAvatarAssignedUUID == UUID.Zero)
{
masterAvatar =
m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName,
scene.RegionInfo.MasterAvatarLastName,
scene.RegionInfo.MasterAvatarSandboxPassword);
}
else
{
masterAvatar = m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarAssignedUUID);
scene.RegionInfo.MasterAvatarFirstName = masterAvatar.FirstName;
scene.RegionInfo.MasterAvatarLastName = masterAvatar.SurName;
}
if (masterAvatar == null)
{
m_log.Info("[PARCEL]: No master avatar found, using null.");
scene.RegionInfo.MasterAvatarAssignedUUID = UUID.Zero;
}
else
{
m_log.InfoFormat("[PARCEL]: Found master avatar {0} {1} [" + masterAvatar.ID.ToString() + "]",
scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName);
scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.ID;
}
return scene;
}
}
}