* RegionApplicationBase restructuring now complete

* Still has some weird bug in SimpleApp though.
This commit is contained in:
lbsa71
2007-07-16 23:25:35 +00:00
parent 6c9d9b660d
commit 497ab5d7ab
11 changed files with 100 additions and 127 deletions

View File

@@ -76,7 +76,7 @@ namespace OpenSim.Region.ClientStack
private AssetCache m_assetCache;
private InventoryCache m_inventoryCache;
private int cachedtextureserial = 0;
protected AuthenticateSessionsBase m_authenticateSessionsHandler;
protected AgentCircuitManager m_authenticateSessionsHandler;
private Encoding enc = Encoding.ASCII;
// Dead client detection vars
private Timer clientPingTimer;
@@ -84,7 +84,7 @@ namespace OpenSim.Region.ClientStack
private int probesWithNoIngressPackets = 0;
private int lastPacketsReceived = 0;
public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions )
public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AgentCircuitManager authenSessions )
{
m_world = world;
m_clientThreads = clientThreads;

View File

@@ -133,7 +133,7 @@ namespace OpenSim.Region.ClientStack
/// <param name="inventoryCache"></param>
/// <param name="authenSessions"></param>
/// <returns></returns>
protected virtual ClientView CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions)
protected virtual ClientView CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AgentCircuitManager authenSessions)
{
return new ClientView(remoteEP, initialcirpack, clientThreads, world, assetCache, packServer, inventoryCache, authenSessions );
}
@@ -147,7 +147,7 @@ namespace OpenSim.Region.ClientStack
/// <param name="inventoryCache"></param>
/// <param name="authenticateSessionsClass"></param>
/// <returns></returns>
public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, InventoryCache inventoryCache, AuthenticateSessionsBase authenticateSessionsClass)
public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, InventoryCache inventoryCache, AgentCircuitManager authenticateSessionsClass)
{
ClientView newuser =
CreateNewClient(epSender, useCircuit, ClientThreads, _localWorld, assetCache, this, inventoryCache,

View File

@@ -31,6 +31,7 @@ using System.Net;
using OpenSim.Assets;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Data;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Types;
@@ -39,6 +40,7 @@ using OpenSim.Region.Caches;
using OpenSim.Region.Environment;
using libsecondlife;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Framework.Communications;
namespace OpenSim.Region.ClientStack
{
@@ -50,14 +52,11 @@ namespace OpenSim.Region.ClientStack
protected DateTime m_startuptime;
protected NetworkServersInfo m_networkServersInfo;
protected List<UDPServer> m_udpServers = new List<UDPServer>();
protected List<RegionInfo> m_regionData = new List<RegionInfo>();
protected List<IWorld> m_localWorld = new List<IWorld>();
protected BaseHttpServer m_httpServer;
protected int m_httpServerPort;
protected List<AuthenticateSessionsBase> AuthenticateSessionsHandler = new List<AuthenticateSessionsBase>();
protected LogBase m_log;
protected CommunicationsManager m_commsManager;
public RegionApplicationBase( )
{
@@ -72,19 +71,19 @@ namespace OpenSim.Region.ClientStack
Initialize();
StartLog();
ScenePresence.LoadTextureFile("avatar-texture.dat");
m_httpServer = new BaseHttpServer( m_httpServerPort );
m_log.Verbose("Starting HTTP server");
m_httpServer.Start();
m_inventoryCache = new InventoryCache();
}
protected abstract void Initialize();
private void StartLog()
protected void StartLog()
{
m_log = CreateLog();
MainLog.Instance = m_log;
@@ -92,7 +91,7 @@ namespace OpenSim.Region.ClientStack
protected abstract LogBase CreateLog();
protected abstract PhysicsScene GetPhysicsScene( );
protected abstract StorageManager GetStoreManager(RegionInfo regionInfo);
protected abstract StorageManager CreateStorageManager(RegionInfo regionInfo);
protected PhysicsScene GetPhysicsScene(string engine)
{
@@ -102,5 +101,42 @@ namespace OpenSim.Region.ClientStack
return physicsPluginManager.GetPhysicsScene( engine );
}
protected Scene SetupScene(RegionInfo regionInfo, out UDPServer udpServer)
{
AgentCircuitManager authen = new AgentCircuitManager();
udpServer = new UDPServer(regionInfo.InternalEndPoint.Port, m_assetCache, m_inventoryCache, m_log, authen);
StorageManager storageManager = CreateStorageManager(regionInfo);
Scene scene = CreateScene(regionInfo, storageManager, authen);
udpServer.LocalWorld = scene;
scene.LoadStorageDLL("OpenSim.Region.Storage.LocalStorageDb4o.dll");
scene.LoadWorldMap();
scene.PhysScene = GetPhysicsScene( );
scene.PhysScene.SetTerrain(scene.Terrain.getHeights1D());
scene.LoadPrimsFromStorage();
//Master Avatar Setup
UserProfileData masterAvatar = m_commsManager.UserServer.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarSandboxPassword);
if (masterAvatar != null)
{
m_log.Notice("Parcels - Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]");
scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID;
scene.localStorage.LoadLandObjects((ILocalStorageLandObjectReceiver)scene.LandManager);
}
else
{
m_log.Notice("Parcels - No master avatar found, using null.");
scene.RegionInfo.MasterAvatarAssignedUUID = libsecondlife.LLUUID.Zero;
scene.localStorage.LoadLandObjects((ILocalStorageLandObjectReceiver)scene.LandManager);
}
scene.performParcelPrimCountUpdate();
scene.StartTimer();
return scene;
}
protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager);
}
}

View File

@@ -56,7 +56,7 @@ namespace OpenSim.Region.ClientStack
protected AssetCache m_assetCache;
protected InventoryCache m_inventoryCache;
protected LogBase m_log;
protected AuthenticateSessionsBase m_authenticateSessionsClass;
protected AgentCircuitManager m_authenticateSessionsClass;
public PacketServer PacketServer
{
@@ -83,7 +83,7 @@ namespace OpenSim.Region.ClientStack
{
}
public UDPServer(int port, AssetCache assetCache, InventoryCache inventoryCache, LogBase console, AuthenticateSessionsBase authenticateClass)
public UDPServer(int port, AssetCache assetCache, InventoryCache inventoryCache, LogBase console, AgentCircuitManager authenticateClass)
{
listenPort = port;
this.m_assetCache = assetCache;
@@ -91,7 +91,6 @@ namespace OpenSim.Region.ClientStack
this.m_log = console;
this.m_authenticateSessionsClass = authenticateClass;
this.CreatePacketServer();
}
protected virtual void CreatePacketServer()