From 31a81e17be6e59111deb484650fbb1cfa1eb6c5c Mon Sep 17 00:00:00 2001 From: MW Date: Mon, 20 Aug 2007 15:49:06 +0000 Subject: The regionUUID is now being passed to the datastore calls. --- OpenSim/Region/ClientStack/ClientView.cs | 37 +++++++++++++--------- .../Environment/Interfaces/IRegionDataStore.cs | 6 ++-- .../Environment/Scenes/Scene.PacketHandlers.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 10 +++--- .../Region/Environment/Scenes/SceneObjectGroup.cs | 16 +++++++++- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 10 ++++++ .../OpenSim.DataStore.DB4o/DB4oDataStore.cs | 6 ++-- .../MonoSqliteDataStore.cs | 6 ++-- .../OpenSim.DataStore.NullStorage/NullDataStore.cs | 6 ++-- 9 files changed, 65 insertions(+), 34 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index e56d361..ff527fb 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -40,8 +40,8 @@ using OpenSim.Framework.Inventory; using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; using OpenSim.Framework.Communications.Caches; - -using Timer=System.Timers.Timer; + +using Timer = System.Timers.Timer; namespace OpenSim.Region.ClientStack { @@ -74,7 +74,7 @@ namespace OpenSim.Region.ClientStack protected IScene m_scene; private Dictionary m_clientThreads; private AssetCache m_assetCache; - // private InventoryCache m_inventoryCache; + // private InventoryCache m_inventoryCache; private int cachedtextureserial = 0; protected AgentCircuitManager m_authenticateSessionsHandler; private Encoding enc = Encoding.ASCII; @@ -84,7 +84,7 @@ namespace OpenSim.Region.ClientStack private int probesWithNoIngressPackets = 0; private int lastPacketsReceived = 0; - public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions ) + public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions) { m_moneyBalance = 1000; @@ -93,10 +93,10 @@ namespace OpenSim.Region.ClientStack m_assetCache = assetCache; m_networkServer = packServer; - // m_inventoryCache = inventoryCache; + // m_inventoryCache = inventoryCache; m_authenticateSessionsHandler = authenSessions; - MainLog.Instance.Verbose( "OpenSimClient.cs - Started up new client thread to handle incoming request"); + MainLog.Instance.Verbose("OpenSimClient.cs - Started up new client thread to handle incoming request"); cirpack = initialcirpack; userEP = remoteEP; @@ -121,7 +121,7 @@ namespace OpenSim.Region.ClientStack public void KillClient() { clientPingTimer.Stop(); - + m_scene.RemoveClient(this.AgentId); m_clientThreads.Remove(this.CircuitCode); @@ -186,14 +186,15 @@ namespace OpenSim.Region.ClientStack protected virtual void ClientLoop() { - MainLog.Instance.Verbose( "OpenSimClient.cs:ClientLoop() - Entered loop"); + MainLog.Instance.Verbose("OpenSimClient.cs:ClientLoop() - Entered loop"); while (true) { QueItem nextPacket = PacketQueue.Dequeue(); if (nextPacket.Incoming) { //is a incoming packet - if (nextPacket.Packet.Type != PacketType.AgentUpdate) { + if (nextPacket.Packet.Type != PacketType.AgentUpdate) + { packetsReceived++; } ProcessInPacket(nextPacket.Packet); @@ -209,15 +210,21 @@ namespace OpenSim.Region.ClientStack protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) { - if (packetsReceived == lastPacketsReceived) { + if (packetsReceived == lastPacketsReceived) + { probesWithNoIngressPackets++; - if (probesWithNoIngressPackets > 30) { + if (probesWithNoIngressPackets > 30) + { this.KillClient(); - } else { + } + else + { // this will normally trigger at least one packet (ping response) SendStartPingCheck(0); - } - } else { + } + } + else + { // Something received in the meantime - we can reset the counters probesWithNoIngressPackets = 0; lastPacketsReceived = packetsReceived; @@ -232,7 +239,7 @@ namespace OpenSim.Region.ClientStack clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); clientPingTimer.Enabled = true; - MainLog.Instance.Verbose( "OpenSimClient.cs:InitNewClient() - Adding viewer agent to scene"); + MainLog.Instance.Verbose("OpenSimClient.cs:InitNewClient() - Adding viewer agent to scene"); this.m_scene.AddNewClient(this, false); } diff --git a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs index 395819d..9b97fc6 100644 --- a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs +++ b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs @@ -47,10 +47,10 @@ namespace OpenSim.Region.Interfaces /// The name of the database to store to (may not be applicable) void Initialise(string filename, string dbname); - void StoreObject(SceneObjectGroup obj); - void RemoveObject(LLUUID uuid); + void StoreObject(SceneObjectGroup obj, LLUUID regionUUID); + void RemoveObject(LLUUID uuid, LLUUID regionUUID); - List LoadObjects(); + List LoadObjects(LLUUID regionUUID); void StoreTerrain(double[,] terrain); double[,] LoadTerrain(); diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 0ed10c0..0449cd9 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -270,7 +270,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendInventoryItemUpdate(item); } - storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID); + storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID); ((SceneObjectGroup)selectedEnt).DeleteGroup(); lock (Entities) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d1a16e0..10be283 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -180,6 +180,8 @@ namespace OpenSim.Region.Environment.Scenes ScenePresence.LoadAnims(); httpListener = httpServer; + + } #endregion @@ -497,7 +499,7 @@ namespace OpenSim.Region.Environment.Scenes public void LoadPrimsFromStorage() { MainLog.Instance.Verbose("Loading objects from datastore"); - List PrimsFromDB = storageManager.DataStore.LoadObjects(); + List PrimsFromDB = storageManager.DataStore.LoadObjects(this.m_regInfo.SimUUID); foreach (SceneObjectGroup prim in PrimsFromDB) { AddEntityFromStorage(prim); @@ -707,7 +709,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnFetchInventory += commsManager.UserProfiles.HandleFetchInventory; client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; - // client.OnRequestXfer += RequestXfer; + // client.OnRequestXfer += RequestXfer; client.OnRequestAvatarProperties += RequestAvatarProperty; @@ -919,9 +921,7 @@ namespace OpenSim.Region.Environment.Scenes if (agent.CapsPath != "") { //Console.WriteLine("new user, so creating caps handler for it"); - Caps cap = - new Caps(assetCache, httpListener, m_regInfo.ExternalHostName, m_regInfo.ExternalEndPoint.Port, - agent.CapsPath, agent.AgentID); + Caps cap = new Caps(assetCache, httpListener, m_regInfo.ExternalHostName, m_regInfo.ExternalEndPoint.Port, agent.CapsPath, agent.AgentID); Util.SetCapsURL(agent.AgentID, "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + "/CAPS/" + agent.CapsPath + "0000/"); cap.RegisterHandlers(); cap.AddNewInventoryItem = this.AddInventoryItem; diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 1e6cd8f..9042c04 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -436,12 +436,26 @@ namespace OpenSim.Region.Environment.Scenes linkPart.SetParent(this); //TODO: rest of parts + foreach (SceneObjectPart part in objectGroup.Children.Values) + { + if (part.UUID != objectGroup.m_rootPart.UUID) + { + this.LinkNonRootPart(part); + } + } m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup; m_scene.DeleteEntity(objectGroup.UUID); this.ScheduleGroupForFullUpdate(); } + private void LinkNonRootPart(SceneObjectPart part) + { + part.SetParent(this); + part.ParentID = this.m_rootPart.LocalID; + this.m_parts.Add(part.UUID, part); + } + /// /// /// @@ -812,7 +826,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void ProcessBackup(OpenSim.Region.Interfaces.IRegionDataStore datastore) { - datastore.StoreObject(this); + datastore.StoreObject(this, m_scene.RegionInfo.SimUUID); } #endregion diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 0393a2a..73e9d48 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -496,6 +496,16 @@ namespace OpenSim.Region.Environment.Scenes this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); this.ControllingClient.SendViewerTime(this.m_scene.TimePhase); + + //Please don't remove the following code (at least not yet), just leave it commented out + //gives the user god powers, should help with debuging things in the future + /* + GrantGodlikePowersPacket grant = new GrantGodlikePowersPacket(); + grant.AgentData.AgentID = this.ControllingClient.AgentId; + grant.AgentData.SessionID = this.ControllingClient.SessionId; + grant.GrantData.GodLevel = 255; + grant.GrantData.Token = LLUUID.Random(); + this.ControllingClient.OutPacket(grant);*/ } /// diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs index 9c5e4bc..73eb635 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs @@ -43,12 +43,12 @@ namespace OpenSim.DataStore.DB4oStorage return; } - public void StoreObject(SceneObjectGroup obj) + public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) { db.Set(obj); } - public void RemoveObject(LLUUID obj) + public void RemoveObject(LLUUID obj, LLUUID regionUUID) { IObjectSet result = db.Query(new SceneObjectQuery(obj)); if (result.Count > 0) @@ -58,7 +58,7 @@ namespace OpenSim.DataStore.DB4oStorage } } - public List LoadObjects() + public List LoadObjects(LLUUID regionUUID) { IObjectSet result = db.Get(typeof(SceneObjectGroup)); List retvals = new List(); diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index 391ac84..b6c6c83 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs @@ -485,7 +485,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage } } - public void StoreObject(SceneObjectGroup obj) + public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) { foreach (SceneObjectPart prim in obj.Children.Values) { @@ -498,7 +498,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage // MainLog.Instance.Verbose("Dump of prims:", ds.GetXml()); } - public void RemoveObject(LLUUID obj) + public void RemoveObject(LLUUID obj, LLUUID regionUUID) { DataTable prims = ds.Tables["prims"]; DataTable shapes = ds.Tables["primshapes"]; @@ -520,7 +520,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage shapeDa.Update(ds, "primshapes"); } - public List LoadObjects() + public List LoadObjects(LLUUID regionUUID) { Dictionary createdObjects = new Dictionary(); List retvals = new List(); diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs index 643508e..176a534 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs @@ -18,17 +18,17 @@ namespace OpenSim.DataStore.NullStorage return; } - public void StoreObject(SceneObjectGroup obj) + public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) { } - public void RemoveObject(LLUUID obj) + public void RemoveObject(LLUUID obj, LLUUID regionUUID) { } - public List LoadObjects() + public List LoadObjects(LLUUID regionUUID) { return new List(); } -- cgit v1.1