From 497ab5d7abec3c644a6340c1c64a2557dbade0ef Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 16 Jul 2007 23:25:35 +0000 Subject: * RegionApplicationBase restructuring now complete * Still has some weird bug in SimpleApp though. --- OpenSim/Region/ClientStack/ClientView.cs | 4 +- OpenSim/Region/ClientStack/PacketServer.cs | 4 +- .../Region/ClientStack/RegionApplicationBase.cs | 52 ++++++++++++++++++---- OpenSim/Region/ClientStack/UDPServer.cs | 5 +-- 4 files changed, 50 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 9fddc7b..44466c6 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -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 clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions ) + public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AgentCircuitManager authenSessions ) { m_world = world; m_clientThreads = clientThreads; diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index 466fdde..41aaf3a 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs @@ -133,7 +133,7 @@ namespace OpenSim.Region.ClientStack /// /// /// - protected virtual ClientView CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions) + protected virtual ClientView CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary 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 /// /// /// - 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, diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 8467082..1bb383f 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -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 m_udpServers = new List(); - protected List m_regionData = new List(); - protected List m_localWorld = new List(); protected BaseHttpServer m_httpServer; protected int m_httpServerPort; - protected List AuthenticateSessionsHandler = new List(); 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); } } diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index 781f96a..ac17720 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs @@ -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() -- cgit v1.1