From fb890e543f1684e0c01f7a57f312ab1d7140cdc0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 21 Mar 2011 05:52:29 +0100 Subject: Don't send a windlight profile to clients if windlight is not set for that region. This should restore normal day and night cycles for regions without WL settings. --- OpenSim/Region/CoreModules/LightShare/LightShareModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs index 00b0aa9..2de8d7a 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs @@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare public void SendProfileToClient(ScenePresence presence) { IClientAPI client = presence.ControllingClient; - if (m_enableWindlight) + if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) { if (presence.IsChildAgent == false) { @@ -165,7 +165,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl) { IClientAPI client = presence.ControllingClient; - if (m_enableWindlight) + if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) { if (presence.IsChildAgent == false) { -- cgit v1.1 From d3a20a1e9257ecec417e219ebaf079370015f06d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 21:37:06 +0000 Subject: On initial region registration, if the user chooses the option to make the region part of an existing estate, then list the existing region names. --- OpenSim/Region/Application/OpenSimBase.cs | 13 ++++++++++++- OpenSim/Region/Framework/Interfaces/IEstateDataService.cs | 14 ++++++++++++++ OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs | 14 ++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index e950613..f804cb7 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -828,7 +828,18 @@ namespace OpenSim } else { - response = MainConsole.Instance.CmdPrompt("Estate name to join", "None"); + List estates = estateDataService.LoadEstateSettingsAll(); + + List estateNames = new List(); + foreach (EstateSettings estate in estates) + estateNames.Add(estate.EstateName); + + response + = MainConsole.Instance.CmdPrompt( + string.Format( + "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())), + "None"); + if (response == "None") continue; diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs index 95c9659..12ed9e3 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs @@ -36,8 +36,22 @@ namespace OpenSim.Region.Framework.Interfaces { EstateSettings LoadEstateSettings(UUID regionID, bool create); EstateSettings LoadEstateSettings(int estateID); + + /// + /// Load/Get all estate settings. + /// + /// An empty list if no estates were found. + List LoadEstateSettingsAll(); + void StoreEstateSettings(EstateSettings es); List GetEstates(string search); + + /// + /// Get the IDs of all estates. + /// + /// An empty list if no estates were found. + List GetEstatesAll(); + bool LinkRegion(UUID regionID, int estateID); List GetRegions(int estateID); bool DeleteEstate(int estateID); diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs index 87c7a05..d78ad78 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs @@ -37,8 +37,22 @@ namespace OpenSim.Region.Framework.Interfaces EstateSettings LoadEstateSettings(UUID regionID, bool create); EstateSettings LoadEstateSettings(int estateID); + + /// + /// Load/Get all estate settings. + /// + /// An empty list if no estates were found. + List LoadEstateSettingsAll(); + void StoreEstateSettings(EstateSettings es); List GetEstates(string search); + + /// + /// Get the IDs of all estates. + /// + /// An empty list if no estates were found. + List GetEstatesAll(); + bool LinkRegion(UUID regionID, int estateID); List GetRegions(int estateID); bool DeleteEstate(int estateID); -- cgit v1.1 From 793bfb5a663879296789efa8350df0e9cabb2148 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 22:25:20 +0000 Subject: add method doc to IEstateDataService and IEstateDataStore interfaces --- .../Framework/Interfaces/IEstateDataService.cs | 44 +++++++++++++++++++- .../Framework/Interfaces/IEstateDataStore.cs | 48 +++++++++++++++++++++- 2 files changed, 90 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs index 12ed9e3..55adef1 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs @@ -34,7 +34,19 @@ namespace OpenSim.Region.Framework.Interfaces { public interface IEstateDataService { + /// + /// Load estate settings for a region. + /// + /// + /// If true, then an estate is created if one is not found. This is used in migration. + /// EstateSettings LoadEstateSettings(UUID regionID, bool create); + + /// + /// Load estate settings for an estate ID. + /// + /// + /// EstateSettings LoadEstateSettings(int estateID); /// @@ -43,7 +55,19 @@ namespace OpenSim.Region.Framework.Interfaces /// An empty list if no estates were found. List LoadEstateSettingsAll(); + /// + /// Store estate settings. + /// + /// + /// This is also called by EstateSettings.Save() + /// void StoreEstateSettings(EstateSettings es); + + /// + /// Get estate IDs. + /// + /// Name of estate to search for. This is the exact name, no parttern matching is done. + /// List GetEstates(string search); /// @@ -52,8 +76,26 @@ namespace OpenSim.Region.Framework.Interfaces /// An empty list if no estates were found. List GetEstatesAll(); + /// + /// Link a region to an estate. + /// + /// + /// + /// true if the link succeeded, false otherwise bool LinkRegion(UUID regionID, int estateID); + + /// + /// Get the UUIDs of all the regions in an estate. + /// + /// + /// List GetRegions(int estateID); + + /// + /// Delete an estate + /// + /// + /// true if the delete succeeded, false otherwise bool DeleteEstate(int estateID); } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs index d78ad78..4974d5d 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs @@ -33,9 +33,25 @@ namespace OpenSim.Region.Framework.Interfaces { public interface IEstateDataStore { + /// + /// Initialise the data store. + /// + /// void Initialise(string connectstring); + /// + /// Load estate settings for a region. + /// + /// + /// If true, then an estate is created if one is not found. This is used in migration. + /// EstateSettings LoadEstateSettings(UUID regionID, bool create); + + /// + /// Load estate settings for an estate ID. + /// + /// + /// EstateSettings LoadEstateSettings(int estateID); /// @@ -44,7 +60,19 @@ namespace OpenSim.Region.Framework.Interfaces /// An empty list if no estates were found. List LoadEstateSettingsAll(); + /// + /// Store estate settings. + /// + /// + /// This is also called by EstateSettings.Save() + /// void StoreEstateSettings(EstateSettings es); + + /// + /// Get estate IDs. + /// + /// Name of estate to search for. This is the exact name, no parttern matching is done. + /// List GetEstates(string search); /// @@ -53,8 +81,26 @@ namespace OpenSim.Region.Framework.Interfaces /// An empty list if no estates were found. List GetEstatesAll(); + /// + /// Link a region to an estate. + /// + /// + /// + /// true if the link succeeded, false otherwise bool LinkRegion(UUID regionID, int estateID); + + /// + /// Get the UUIDs of all the regions in an estate. + /// + /// + /// List GetRegions(int estateID); + + /// + /// Delete an estate + /// + /// + /// true if the delete succeeded, false otherwise bool DeleteEstate(int estateID); } -} +} \ No newline at end of file -- cgit v1.1 From 2d1f0d224c355e92997643cf849b8e9774dddbad Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 22:27:16 +0000 Subject: minor: slightly adjust previous method doc. --- OpenSim/Region/Framework/Interfaces/IEstateDataService.cs | 2 +- OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs index 55adef1..38c10a6 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs @@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Load estate settings for a region. /// /// - /// If true, then an estate is created if one is not found. This is used in migration. + /// If true, then an estate is created if one is not found. /// EstateSettings LoadEstateSettings(UUID regionID, bool create); diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs index 4974d5d..c82661d 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs @@ -43,7 +43,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Load estate settings for a region. /// /// - /// If true, then an estate is created if one is not found. This is used in migration. + /// If true, then an estate is created if one is not found. /// EstateSettings LoadEstateSettings(UUID regionID, bool create); -- cgit v1.1 From ee7cfc2854aba3572d5342b8c1bfd5bf4ea93841 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 22:47:02 +0000 Subject: refactor: use EstateDataService property directly instead of loading it into a local variable --- OpenSim/Region/Application/OpenSimBase.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f804cb7..eae3686 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -798,12 +798,8 @@ namespace OpenSim /// public void PopulateRegionEstateInfo(RegionInfo regInfo) { - IEstateDataService estateDataService = EstateDataService; - - if (estateDataService != null) - { - regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, false); - } + if (EstateDataService != null) + regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, false); if (regInfo.EstateSettings.EstateID == 0) // No record at all { @@ -814,7 +810,7 @@ namespace OpenSim if (response == "no") { // Create a new estate - regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true); + regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); @@ -828,7 +824,7 @@ namespace OpenSim } else { - List estates = estateDataService.LoadEstateSettingsAll(); + List estates = EstateDataService.LoadEstateSettingsAll(); List estateNames = new List(); foreach (EstateSettings estate in estates) @@ -843,7 +839,7 @@ namespace OpenSim if (response == "None") continue; - List estateIDs = estateDataService.GetEstates(response); + List estateIDs = EstateDataService.GetEstates(response); if (estateIDs.Count < 1) { MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); @@ -852,9 +848,9 @@ namespace OpenSim int estateID = estateIDs[0]; - regInfo.EstateSettings = estateDataService.LoadEstateSettings(estateID); + regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID); - if (estateDataService.LinkRegion(regInfo.RegionID, estateID)) + if (EstateDataService.LinkRegion(regInfo.RegionID, estateID)) break; MainConsole.Instance.Output("Joining the estate failed. Please try again."); @@ -863,7 +859,6 @@ namespace OpenSim } } } - public class OpenSimConfigSource { -- cgit v1.1 From 060a53b896d338309458861161eb0b9e621d4171 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 22:57:20 +0000 Subject: On initial opensim setup, don't ask the user whether they want to join an existing opensim estate when there aren't any. Proceed directly to estate setup instead. --- OpenSim/Region/Application/OpenSimBase.cs | 102 ++++++++++++++++++------------ 1 file changed, 63 insertions(+), 39 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index eae3686..81a10e3 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -793,6 +793,25 @@ namespace OpenSim } /// + /// Create an estate with an initial region. + /// + /// + public void CreateEstate(RegionInfo regInfo) + { + // Create a new estate + regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); + + regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); + + // FIXME: Later on, the scene constructor will reload the estate settings no matter what. + // Therefore, we need to do an initial save here otherwise the new estate name will be reset + // back to the default. The reloading of estate settings by scene could be eliminated if it + // knows that the passed in settings in RegionInfo are already valid. Also, it might be + // possible to eliminate some additional later saves made by callers of this method. + regInfo.EstateSettings.Save(); + } + + /// /// Load the estate information for the provided RegionInfo object. /// /// @@ -804,56 +823,61 @@ namespace OpenSim if (regInfo.EstateSettings.EstateID == 0) // No record at all { MainConsole.Instance.Output("Your region is not part of an estate."); + + List estates = EstateDataService.LoadEstateSettingsAll(); + while (true) { - string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List() { "yes", "no" }); - if (response == "no") - { - // Create a new estate - regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); - - regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); + if (estates.Count == 0) + { + MainConsole.Instance.Output( + "There aren't any existing estates. You will need to create a new one for this region."); - // FIXME: Later on, the scene constructor will reload the estate settings no matter what. - // Therefore, we need to do an initial save here otherwise the new estate name will be reset - // back to the default. The reloading of estate settings by scene could be eliminated if it - // knows that the passed in settings in RegionInfo are already valid. Also, it might be - // possible to eliminate some additional later saves made by callers of this method. - regInfo.EstateSettings.Save(); + CreateEstate(regInfo); break; } else { - List estates = EstateDataService.LoadEstateSettingsAll(); - - List estateNames = new List(); - foreach (EstateSettings estate in estates) - estateNames.Add(estate.EstateName); - - response + string response = MainConsole.Instance.CmdPrompt( - string.Format( - "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())), - "None"); + "Do you wish to join an existing estate (yes/no)?", "no", new List() { "yes", "no" }); - if (response == "None") - continue; - - List estateIDs = EstateDataService.GetEstates(response); - if (estateIDs.Count < 1) + if (response == "no") { - MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); - continue; - } - - int estateID = estateIDs[0]; - - regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID); - - if (EstateDataService.LinkRegion(regInfo.RegionID, estateID)) + CreateEstate(regInfo); break; - - MainConsole.Instance.Output("Joining the estate failed. Please try again."); + } + else + { + List estateNames = new List(); + foreach (EstateSettings estate in estates) + estateNames.Add(estate.EstateName); + + response + = MainConsole.Instance.CmdPrompt( + string.Format( + "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())), + "None"); + + if (response == "None") + continue; + + List estateIDs = EstateDataService.GetEstates(response); + if (estateIDs.Count < 1) + { + MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); + continue; + } + + int estateID = estateIDs[0]; + + regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID); + + if (EstateDataService.LinkRegion(regInfo.RegionID, estateID)) + break; + + MainConsole.Instance.Output("Joining the estate failed. Please try again."); + } } } } -- cgit v1.1 From 3382de4d8bcfce0c3f8e2e63ee63ed2428322461 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 23:16:57 +0000 Subject: In initial setup, stop a user being able to create a new estate with the same name as an existing estate. --- OpenSim/Region/Application/OpenSimBase.cs | 45 +++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 81a10e3..3f5e35e 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -795,20 +795,34 @@ namespace OpenSim /// /// Create an estate with an initial region. /// + /// + /// This method doesn't allow an estate to be created with the same name as existing estates. + /// /// - public void CreateEstate(RegionInfo regInfo) + /// A list of estate names that already exist. + /// true if the estate was created, false otherwise + public bool CreateEstate(RegionInfo regInfo, List existingNames) { // Create a new estate regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); + string newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); - regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); + if (existingNames.Contains(newName)) + { + MainConsole.Instance.OutputFormat("An estate named {0} already exists. Please try again.", newName); + return false; + } + + regInfo.EstateSettings.EstateName = newName; // FIXME: Later on, the scene constructor will reload the estate settings no matter what. // Therefore, we need to do an initial save here otherwise the new estate name will be reset // back to the default. The reloading of estate settings by scene could be eliminated if it // knows that the passed in settings in RegionInfo are already valid. Also, it might be // possible to eliminate some additional later saves made by callers of this method. - regInfo.EstateSettings.Save(); + regInfo.EstateSettings.Save(); + + return true; } /// @@ -825,16 +839,21 @@ namespace OpenSim MainConsole.Instance.Output("Your region is not part of an estate."); List estates = EstateDataService.LoadEstateSettingsAll(); + List estateNames = new List(); + foreach (EstateSettings estate in estates) + estateNames.Add(estate.EstateName); while (true) { if (estates.Count == 0) { MainConsole.Instance.Output( - "There aren't any existing estates. You will need to create a new one for this region."); + "No existing estates found. You must create a new one for this region."); - CreateEstate(regInfo); - break; + if (CreateEstate(regInfo, estateNames)) + break; + else + continue; } else { @@ -844,15 +863,13 @@ namespace OpenSim if (response == "no") { - CreateEstate(regInfo); - break; + if (CreateEstate(regInfo, estateNames)) + break; + else + continue; } else - { - List estateNames = new List(); - foreach (EstateSettings estate in estates) - estateNames.Add(estate.EstateName); - + { response = MainConsole.Instance.CmdPrompt( string.Format( @@ -865,7 +882,7 @@ namespace OpenSim List estateIDs = EstateDataService.GetEstates(response); if (estateIDs.Count < 1) { - MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); + MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again."); continue; } -- cgit v1.1 From 7acade00b9b34403e63656d5e2efc94322342653 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 23:26:35 +0000 Subject: On initial setup, include estate and regions names in questions to make it clearer what they relate to. --- OpenSim/Region/Application/OpenSimBase.cs | 10 ++++++---- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 3f5e35e..6405811 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -836,7 +836,7 @@ namespace OpenSim if (regInfo.EstateSettings.EstateID == 0) // No record at all { - MainConsole.Instance.Output("Your region is not part of an estate."); + MainConsole.Instance.OutputFormat("Region {0} is not part of an estate.", regInfo.RegionName); List estates = EstateDataService.LoadEstateSettingsAll(); List estateNames = new List(); @@ -847,8 +847,7 @@ namespace OpenSim { if (estates.Count == 0) { - MainConsole.Instance.Output( - "No existing estates found. You must create a new one for this region."); + MainConsole.Instance.Output("No existing estates found. You must create a new one."); if (CreateEstate(regInfo, estateNames)) break; @@ -859,7 +858,10 @@ namespace OpenSim { string response = MainConsole.Instance.CmdPrompt( - "Do you wish to join an existing estate (yes/no)?", "no", new List() { "yes", "no" }); + string.Format( + "Do you wish to join region {0} to an existing estate (yes/no)?", regInfo.RegionName), + "no", + new List() { "yes", "no" }); if (response == "no") { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1a6a70b..4d2519d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1109,7 +1109,7 @@ namespace OpenSim.Region.Framework.Scenes // while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) { - MainConsole.Instance.Output("The current estate has no owner set."); + MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", m_regInfo.EstateSettings.EstateName); List excluded = new List(new char[1]{' '}); string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); -- cgit v1.1 From b34743e5fe6b0783caa62c014ff86e2ec76c8184 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 22 Mar 2011 23:47:36 +0000 Subject: Add an initial confidence-building TestAddObject() for prim counts. --- .../CoreModules/World/Land/LandManagementModule.cs | 29 +++++---- .../CoreModules/World/Land/PrimCountModule.cs | 23 +++++-- .../World/Land/Tests/PrimCountModuleTests.cs | 75 ++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/SceneGraph.cs | 13 ++-- 4 files changed, 115 insertions(+), 25 deletions(-) create mode 100644 OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 98ba8c3..514be4f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -306,6 +306,9 @@ namespace OpenSim.Region.CoreModules.World.Land /// The parcel created. protected ILandObject CreateDefaultParcel() { +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); + ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; @@ -579,7 +582,7 @@ namespace OpenSim.Region.CoreModules.World.Land } else { - m_log.WarnFormat("[LAND]: Invalid local land ID {0}", landLocalID); + m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid local land ID {0}", landLocalID); } } @@ -630,7 +633,7 @@ namespace OpenSim.Region.CoreModules.World.Land { if (m_landIDList[x, y] == local_id) { - m_log.WarnFormat("[LAND]: Not removing land object {0}; still being used at {1}, {2}", + m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Not removing land object {0}; still being used at {1}, {2}", local_id, x, y); return; //throw new Exception("Could not remove land object. Still being used at " + x + ", " + y); @@ -1198,7 +1201,7 @@ namespace OpenSim.Region.CoreModules.World.Land } else { - m_log.WarnFormat("[PARCEL]: Invalid land object {0} passed for parcel object owner request", local_id); + m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid land object {0} passed for parcel object owner request", local_id); } } @@ -1426,7 +1429,7 @@ namespace OpenSim.Region.CoreModules.World.Land { IClientAPI client; if (! m_scene.TryGetClient(agentID, out client)) { - m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString()); + m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to retrieve IClientAPI for {0}", agentID); return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); } @@ -1475,7 +1478,7 @@ namespace OpenSim.Region.CoreModules.World.Land } else { - m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); + m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID); } return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); } @@ -1533,17 +1536,17 @@ namespace OpenSim.Region.CoreModules.World.Land } catch (LLSD.LLSDParseException e) { - m_log.ErrorFormat("[LAND] Fetch error: {0}", e.Message); - m_log.ErrorFormat("[LAND] ... in request {0}", request); + m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Fetch error: {0}", e.Message); + m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: ... in request {0}", request); } - catch(InvalidCastException) + catch (InvalidCastException) { - m_log.ErrorFormat("[LAND] Wrong type in request {0}", request); + m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Wrong type in request {0}", request); } LLSDRemoteParcelResponse response = new LLSDRemoteParcelResponse(); response.parcel_id = parcelID; - m_log.DebugFormat("[LAND] got parcelID {0}", parcelID); + m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelID {0}", parcelID); return LLSDHelpers.SerialiseLLSDReply(response); } @@ -1564,7 +1567,7 @@ namespace OpenSim.Region.CoreModules.World.Land ExtendedLandData extLandData = new ExtendedLandData(); Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, out extLandData.X, out extLandData.Y); - m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", + m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelinfo request for regionHandle {0}, x/y {1}/{2}", extLandData.RegionHandle, extLandData.X, extLandData.Y); // for this region or for somewhere else? @@ -1605,7 +1608,7 @@ namespace OpenSim.Region.CoreModules.World.Land info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); } // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark. - m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...", + m_log.DebugFormat("[LAND MANAGEMENT MODULE]: got parcelinfo for parcel {0} in region {1}; sending...", data.LandData.Name, data.RegionHandle); // HACK for now RegionInfo r = new RegionInfo(); @@ -1616,7 +1619,7 @@ namespace OpenSim.Region.CoreModules.World.Land remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y); } else - m_log.Debug("[LAND] got no parcelinfo; not sending"); + m_log.Debug("[LAND MANAGEMENT MODULE]: got no parcelinfo; not sending"); } public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 34ef67f..c71264c 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -51,8 +51,8 @@ namespace OpenSim.Region.CoreModules.World.Land public class PrimCountModule : IPrimCountModule, INonSharedRegionModule { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = +// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_Scene; private Dictionary m_PrimCounts = @@ -64,10 +64,16 @@ namespace OpenSim.Region.CoreModules.World.Land private Dictionary m_ParcelCounts = new Dictionary(); - // For now, a simple simwide taint to get this up. Later parcel based - // taint to allow recounting a parcel if only ownership has changed - // without recounting the whole sim. + + /// + /// For now, a simple simwide taint to get this up. Later parcel based + /// taint to allow recounting a parcel if only ownership has changed + /// without recounting the whole sim. + /// + /// We start out tainted so that the first get call resets the various prim counts. + /// private bool m_Tainted = true; + private Object m_TaintLock = new Object(); public Type ReplaceableInterface @@ -156,6 +162,8 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: Call under Taint Lock private void AddObject(SceneObjectGroup obj) { +// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} to prim count", obj.Name); + if (obj.IsAttachment) return; if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)) @@ -299,18 +307,21 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: This method MUST be called while holding the taint lock! private void Recount() { +// m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName); + m_OwnerMap.Clear(); m_SimwideCounts.Clear(); m_ParcelCounts.Clear(); List land = m_Scene.LandChannel.AllParcels(); - + foreach (ILandObject l in land) { LandData landData = l.LandData; m_OwnerMap[landData.GlobalID] = landData.OwnerID; m_SimwideCounts[landData.OwnerID] = 0; +// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding parcel count for {0}", landData.GlobalID); m_ParcelCounts[landData.GlobalID] = new ParcelCounts(); } diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs new file mode 100644 index 0000000..402965f --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using log4net.Config; +using NUnit.Framework; +using OpenMetaverse; +using OpenMetaverse.Assets; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; +using OpenSim.Tests.Common.Setup; + +namespace OpenSim.Region.CoreModules.World.Land.Tests +{ + [TestFixture] + public class PrimCountModuleTests + { + [Test] + public void TestAddObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + PrimCountModule pcm = new PrimCountModule(); + LandManagementModule lmm = new LandManagementModule(); + Scene scene = SceneSetupHelpers.SetupScene(); + SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); + + ILandObject lo = new LandObject(UUID.Zero, false, scene); + lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); + lmm.AddLandObject(lo); + //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); + + string objName = "obj1"; + UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); + + SceneObjectPart part + = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { Name = objName, UUID = objUuid }; + + scene.AddNewSceneObject(new SceneObjectGroup(part), false); + + Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 734ba22..eca2786 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -627,7 +627,7 @@ namespace OpenSim.Region.Framework.Scenes if (!Entities.Remove(agentID)) { m_log.WarnFormat( - "[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", + "[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", agentID); } @@ -650,7 +650,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - m_log.WarnFormat("[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); + m_log.WarnFormat("[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); } } } @@ -1079,7 +1079,8 @@ namespace OpenSim.Region.Framework.Scenes catch (Exception e) { // Catch it and move on. This includes situations where splist has inconsistent info - m_log.WarnFormat("[SCENE]: Problem processing action in ForEachSOG: ", e.ToString()); + m_log.WarnFormat( + "[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace); } } } @@ -1103,8 +1104,8 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); - m_log.Info("[BUG] Stack Trace: " + e.StackTrace); + m_log.Info("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); + m_log.Info("[SCENEGRAPH]: Stack Trace: " + e.StackTrace); } }); Parallel.ForEach(GetScenePresences(), protectedAction); @@ -1119,7 +1120,7 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); + m_log.Error("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); } } } -- cgit v1.1 From d011896341d09ce6c10a801264e663b6a19f0b48 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 21:50:56 +0000 Subject: Add generic EventManager.OnObjectAddedToScene and get PrimCountModule to listen for that rather than EventManager.OnParcelPrimCountAdd OnParcelPrimCountAdd had the wrong semantics for the PrimCountModule - it was invoked for every entity in the scene, not just new ones, which would screw up the untainted count. Extend automated test for this scenario. --- .../CoreModules/World/Land/LandManagementModule.cs | 4 +++ .../CoreModules/World/Land/PrimCountModule.cs | 10 ++++++-- .../World/Land/Tests/PrimCountModuleTests.cs | 2 ++ OpenSim/Region/Framework/Scenes/EventManager.cs | 30 ++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 18 ++++++++++--- 5 files changed, 59 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 514be4f..4d887a8 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -854,6 +854,10 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnParcelPrimCountUpdate() { +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}", +// m_scene.RegionInfo.RegionName); + ResetAllLandPrimCounts(); EntityBase[] entities = m_scene.Entities.GetEntities(); foreach (EntityBase obj in entities) diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index c71264c..5371aaf 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -89,8 +89,7 @@ namespace OpenSim.Region.CoreModules.World.Land { m_Scene = scene; - m_Scene.EventManager.OnParcelPrimCountAdd += - OnParcelPrimCountAdd; + m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd; m_Scene.EventManager.OnObjectBeingRemovedFromScene += OnObjectBeingRemovedFromScene; m_Scene.EventManager.OnParcelPrimCountTainted += @@ -116,6 +115,7 @@ namespace OpenSim.Region.CoreModules.World.Land private void OnParcelPrimCountAdd(SceneObjectGroup obj) { + Console.WriteLine("WIBBLE"); // If we're tainted already, don't bother to add. The next // access will cause a recount anyway lock (m_TaintLock) @@ -172,6 +172,10 @@ namespace OpenSim.Region.CoreModules.World.Land Vector3 pos = obj.AbsolutePosition; ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y); LandData landData = landObject.LandData; + +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}", +// obj.Name, obj.OwnerID, landData.OwnerID); ParcelCounts parcelCounts; if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) @@ -228,6 +232,8 @@ namespace OpenSim.Region.CoreModules.World.Land public int GetOwnerCount(UUID parcelID) { +// m_log.DebugFormat("[PRIM COUNT MODULE]: GetOwnerCount for {0}", parcelID); + lock (m_TaintLock) { if (m_Tainted) diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 402965f..fd332ed 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -67,6 +67,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) { Name = objName, UUID = objUuid }; + Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); + scene.AddNewSceneObject(new SceneObjectGroup(part), false); Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index c321a15..fd62535 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -242,7 +242,15 @@ namespace OpenSim.Region.Framework.Scenes public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); public event EstateToolsSunUpdate OnEstateToolsSunUpdate; + + /// + /// Triggered when an object is added to the scene. + /// + public event Action OnObjectAddedToScene; + /// + /// Triggered when an object is removed from the scene. + /// public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; @@ -345,6 +353,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate void Attach(uint localID, UUID itemID, UUID avatarID); public event Attach OnAttach; + /// /// Called immediately after an object is loaded from storage. /// @@ -800,6 +809,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public void TriggerObjectAddedToScene(SceneObjectGroup obj) + { + Action handler = OnObjectAddedToScene; + if (handler != null) + { + foreach (Action d in handler.GetInvocationList()) + { + try + { + d(obj); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) { ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4d2519d..d407a6f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1956,8 +1956,14 @@ namespace OpenSim.Region.Framework.Scenes /// If false, it is left to the caller to schedule the update /// public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) - { - return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); + { + if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) + { + EventManager.TriggerObjectAddedToScene(sceneObject); + return true; + } + + return false; } /// @@ -1974,7 +1980,13 @@ namespace OpenSim.Region.Framework.Scenes public bool AddNewSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) { - return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); + if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) + { + EventManager.TriggerObjectAddedToScene(sceneObject); + return true; + } + + return false; } /// -- cgit v1.1 From 67cafbd33aeb1038f22aa775cbde96b4c89dd770 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 21:54:02 +0000 Subject: remove a rogue Console.WriteLine() from the last commit. --- OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 5371aaf..46c7eed 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -115,7 +115,6 @@ namespace OpenSim.Region.CoreModules.World.Land private void OnParcelPrimCountAdd(SceneObjectGroup obj) { - Console.WriteLine("WIBBLE"); // If we're tainted already, don't bother to add. The next // access will cause a recount anyway lock (m_TaintLock) -- cgit v1.1 From 08c3cd6b369e2bb8dfa08709c2ffddaea4cdbaa5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 22:04:14 +0000 Subject: Add method doc to the Get*() methods on PrimCountModule --- .../CoreModules/World/Land/PrimCountModule.cs | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 46c7eed..ae85798 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -229,6 +229,12 @@ namespace OpenSim.Region.CoreModules.World.Land return primCounts; } + + /// + /// Get the number of prims on the parcel that are owned by the parcel owner. + /// + /// + /// public int GetOwnerCount(UUID parcelID) { // m_log.DebugFormat("[PRIM COUNT MODULE]: GetOwnerCount for {0}", parcelID); @@ -245,6 +251,11 @@ namespace OpenSim.Region.CoreModules.World.Land return 0; } + /// + /// Get the number of prims on the parcel that have been set to the group that owns the parcel. + /// + /// + /// public int GetGroupCount(UUID parcelID) { lock (m_TaintLock) @@ -259,6 +270,11 @@ namespace OpenSim.Region.CoreModules.World.Land return 0; } + /// + /// Get the number of prims on the parcel that are not owned by the parcel owner or set to the parcel group. + /// + /// + /// public int GetOthersCount(UUID parcelID) { lock (m_TaintLock) @@ -273,6 +289,11 @@ namespace OpenSim.Region.CoreModules.World.Land return 0; } + /// + /// Get the number of prims that are in the entire simulator for the owner of this parcel. + /// + /// + /// public int GetSimulatorCount(UUID parcelID) { lock (m_TaintLock) @@ -291,6 +312,12 @@ namespace OpenSim.Region.CoreModules.World.Land return 0; } + /// + /// Get the number of prims that a particular user owns on this parcel. + /// + /// + /// + /// public int GetUserCount(UUID parcelID, UUID userID) { lock (m_TaintLock) -- cgit v1.1 From 654aa7abeb497e024c87e2ef8d610ba3ca512c3e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 22:12:20 +0000 Subject: Extend simple PCM add object test to check all counts --- .../CoreModules/World/Land/Tests/PrimCountModuleTests.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index fd332ed..88c814e 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -55,6 +55,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Scene scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); + UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); ILandObject lo = new LandObject(UUID.Zero, false, scene); lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); lmm.AddLandObject(lo); @@ -68,10 +69,20 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests { Name = objName, UUID = objUuid }; Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, UUID.Zero), Is.EqualTo(0)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); + Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0)); scene.AddNewSceneObject(new SceneObjectGroup(part), false); Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, UUID.Zero), Is.EqualTo(1)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); + Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1)); } } } \ No newline at end of file -- cgit v1.1 From f1f4985ab6fc98daf2263f72397fe7db79b20ecd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 22:14:04 +0000 Subject: user a non UUID.Zero user in pcm test to avoid any special treatment of UUID.Zero --- .../Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 88c814e..639d781 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -55,8 +55,9 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Scene scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); + UUID userId = new UUID("00000000-0000-0000-0000-000000000010"); UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); - ILandObject lo = new LandObject(UUID.Zero, false, scene); + ILandObject lo = new LandObject(userId, false, scene); lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); lmm.AddLandObject(lo); //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); @@ -65,13 +66,13 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); SceneObjectPart part - = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) { Name = objName, UUID = objUuid }; Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, UUID.Zero), Is.EqualTo(0)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(0)); Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0)); @@ -80,7 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, UUID.Zero), Is.EqualTo(1)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1)); Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1)); } -- cgit v1.1 From 88673c86a4b9cde729c62fbdc92b8c9076c54230 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 22:17:47 +0000 Subject: use a 3 part object for the pcm test rather than a 1 part, for improved test coverage --- .../World/Land/Tests/PrimCountModuleTests.cs | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 639d781..8c1b6a3 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -61,13 +61,17 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); lmm.AddLandObject(lo); //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); - - string objName = "obj1"; - UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); - - SceneObjectPart part + + SceneObjectPart part1 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = objName, UUID = objUuid }; + { Name = "obj1", UUID = new UUID("00000000-0000-0000-0000-000000000001") }; + SceneObjectGroup sog = new SceneObjectGroup(part1); + sog.AddPart( + new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { Name = "obj2", UUID = new UUID("00000000-0000-0000-0000-000000000002") }); + sog.AddPart( + new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { Name = "obj3", UUID = new UUID("00000000-0000-0000-0000-000000000003") }); Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); @@ -76,14 +80,14 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0)); - scene.AddNewSceneObject(new SceneObjectGroup(part), false); + scene.AddNewSceneObject(sog, false); - Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(3)); Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(3)); Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); - Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3)); } } } \ No newline at end of file -- cgit v1.1 From de88227bc486788197b3a7c842c8b60f82b0a29b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 22:29:27 +0000 Subject: refactor: simplify part of AddSceneObject() test setup by moving sog construction into SceneSetupHelpers.CreateSceneObject() --- .../CoreModules/World/Land/Tests/PrimCountModuleTests.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 8c1b6a3..72f74fa 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -62,16 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests lmm.AddLandObject(lo); //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); - SceneObjectPart part1 - = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = "obj1", UUID = new UUID("00000000-0000-0000-0000-000000000001") }; - SceneObjectGroup sog = new SceneObjectGroup(part1); - sog.AddPart( - new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = "obj2", UUID = new UUID("00000000-0000-0000-0000-000000000002") }); - sog.AddPart( - new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = "obj3", UUID = new UUID("00000000-0000-0000-0000-000000000003") }); + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId); Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); -- cgit v1.1 From ebbe3afaf15fa07f4a8d1c2db8795065b852ec8d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 23:14:55 +0000 Subject: Add PrimCountModuleTests.TestRemoveOwnerObject(). Also adds SceneSetupHelpers methods to easily create sogs with different part UUIDs --- .../World/Land/Tests/PrimCountModuleTests.cs | 39 +++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 72f74fa..e6b8627 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -44,8 +44,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [TestFixture] public class PrimCountModuleTests { + /// + /// Test count after a parcel owner owned object is added. + /// [Test] - public void TestAddObject() + public void TestAddOwnerObject() { TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -80,5 +83,39 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3)); } + + /// + /// Test count after a parcel owner owned object is removed. + /// + [Test] + public void TestRemoveOwnerObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + PrimCountModule pcm = new PrimCountModule(); + LandManagementModule lmm = new LandManagementModule(); + Scene scene = SceneSetupHelpers.SetupScene(); + SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); + + UUID userId = new UUID("00000000-0000-0000-0000-000000000010"); + UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); + ILandObject lo = new LandObject(userId, false, scene); + lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); + lmm.AddLandObject(lo); + //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); + + scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, userId, 0x1), false); + SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, userId, 0x10); + scene.AddNewSceneObject(sogToDelete, false); + scene.DeleteSceneObject(sogToDelete, false); + + Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); + Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1)); + } } } \ No newline at end of file -- cgit v1.1 From f001aab8aa5f3ceebe259ff89673c7757b16c637 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 23:19:15 +0000 Subject: extend TestAddOwnerObject() to add a second object --- .../World/Land/Tests/PrimCountModuleTests.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index e6b8627..a0e7e4c 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -58,15 +58,13 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Scene scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); - UUID userId = new UUID("00000000-0000-0000-0000-000000000010"); + UUID userId = new UUID("00000000-0000-0000-0000-100000000000"); UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); ILandObject lo = new LandObject(userId, false, scene); lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); lmm.AddLandObject(lo); //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); - - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId); - + Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); @@ -74,6 +72,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0)); + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId, 0x01); scene.AddNewSceneObject(sog, false); Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(3)); @@ -82,6 +81,17 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(3)); Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3)); + + // Add a second object and retest + SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, userId, 0x10); + scene.AddNewSceneObject(sog2, false); + + Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(5)); + Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(5)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); + Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(5)); } /// -- cgit v1.1 From eaa37d15f26adda05cbcc44404b586551d86e983 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 23:28:10 +0000 Subject: factor out common test setup code in PCM tests --- .../World/Land/Tests/PrimCountModuleTests.cs | 110 ++++++++++----------- 1 file changed, 53 insertions(+), 57 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index a0e7e4c..45e579e 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -44,6 +44,26 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [TestFixture] public class PrimCountModuleTests { + protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000"); + protected UUID m_dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); + protected TestScene m_scene; + protected PrimCountModule m_pcm; + protected ILandObject m_lo; + + [SetUp] + public void SetUp() + { + m_pcm = new PrimCountModule(); + LandManagementModule lmm = new LandManagementModule(); + m_scene = SceneSetupHelpers.SetupScene(); + SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); + + m_lo = new LandObject(m_userId, false, m_scene); + m_lo.SetLandBitmap(m_lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); + lmm.AddLandObject(m_lo); + //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); + } + /// /// Test count after a parcel owner owned object is added. /// @@ -51,47 +71,35 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests public void TestAddOwnerObject() { TestHelper.InMethod(); -// log4net.Config.XmlConfigurator.Configure(); - - PrimCountModule pcm = new PrimCountModule(); - LandManagementModule lmm = new LandManagementModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); - - UUID userId = new UUID("00000000-0000-0000-0000-100000000000"); - UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); - ILandObject lo = new LandObject(userId, false, scene); - lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); - lmm.AddLandObject(lo); - //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); +// log4net.Config.XmlConfigurator.Configure(); - Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); - Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(0)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); + Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId, 0x01); - scene.AddNewSceneObject(sog, false); + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); + m_scene.AddNewSceneObject(sog, false); - Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(3)); - Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(3)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); - Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3)); + Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(3)); + Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(3)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); + Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(3)); // Add a second object and retest - SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, userId, 0x10); - scene.AddNewSceneObject(sog2, false); + SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); + m_scene.AddNewSceneObject(sog2, false); - Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(5)); - Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(5)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); - Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(5)); + Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(5)); + Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(5)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); + Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(5)); } /// @@ -103,29 +111,17 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - PrimCountModule pcm = new PrimCountModule(); - LandManagementModule lmm = new LandManagementModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); - - UUID userId = new UUID("00000000-0000-0000-0000-000000000010"); - UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); - ILandObject lo = new LandObject(userId, false, scene); - lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); - lmm.AddLandObject(lo); - //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); - - scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, userId, 0x1), false); - SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, userId, 0x10); - scene.AddNewSceneObject(sogToDelete, false); - scene.DeleteSceneObject(sogToDelete, false); + m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false); + SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); + m_scene.AddNewSceneObject(sogToDelete, false); + m_scene.DeleteSceneObject(sogToDelete, false); - Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); - Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); - Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(1)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); + Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(1)); } } } \ No newline at end of file -- cgit v1.1 From 7f5019b0f23959ca049f87b596bc2bd47725eb0d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 Mar 2011 21:47:54 +0000 Subject: Add ILandObject.IPrimCounts for the new prim count module. Not functional yet, but tests now act against this object rather than interrogating the module directly --- .../CoreModules/World/Land/LandManagementModule.cs | 12 ++++- .../Region/CoreModules/World/Land/LandObject.cs | 4 +- .../CoreModules/World/Land/PrimCountModule.cs | 2 + .../World/Land/Tests/PrimCountModuleTests.cs | 60 ++++++++++++---------- OpenSim/Region/Framework/Interfaces/ILandObject.cs | 5 ++ 5 files changed, 52 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 4d887a8..d0727d9 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -72,6 +72,7 @@ namespace OpenSim.Region.CoreModules.World.Land protected Commander m_commander = new Commander("land"); protected IUserManagement m_userManager; + protected IPrimCountModule m_primCountModule; // Minimum for parcels to work is 64m even if we don't actually use them. #pragma warning disable 0429 @@ -147,6 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void RegionLoaded(Scene scene) { m_userManager = m_scene.RequestModuleInterface(); + m_primCountModule = m_scene.RequestModuleInterface(); } public void RemoveRegion(Scene scene) @@ -309,10 +311,11 @@ namespace OpenSim.Region.CoreModules.World.Land // m_log.DebugFormat( // "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); - ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); + ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); + return AddLandObject(fullSimParcel); } @@ -593,6 +596,11 @@ namespace OpenSim.Region.CoreModules.World.Land public ILandObject AddLandObject(ILandObject land) { ILandObject new_land = land.Copy(); + + // Only now can we add the prim counts to the land object - we rely on the global ID which is generated + // as a random UUID inside LandData initialization + if (m_primCountModule != null) + new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID); lock (m_landList) { @@ -1368,7 +1376,7 @@ namespace OpenSim.Region.CoreModules.World.Land { ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); new_land.LandData = data.Copy(); - new_land.SetLandBitmapFromByteArray(); + new_land.SetLandBitmapFromByteArray(); AddLandObject(new_land); } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 46c15ed..749bb3d 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land private int m_lastSeqId = 0; - protected LandData m_landData = new LandData(); + protected LandData m_landData = new LandData(); protected Scene m_scene; protected List primsOverMe = new List(); protected Dictionary m_listTransactions = new Dictionary(); @@ -79,6 +79,8 @@ namespace OpenSim.Region.CoreModules.World.Land set { m_landData = value; } } + + public IPrimCounts PrimCounts { get; set; } public UUID RegionUUID { diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index ae85798..9fd347e 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -88,6 +88,8 @@ namespace OpenSim.Region.CoreModules.World.Land public void AddRegion(Scene scene) { m_Scene = scene; + + m_Scene.RegisterModuleInterface(this); m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd; m_Scene.EventManager.OnObjectBeingRemovedFromScene += diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 45e579e..c9d393f 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -58,9 +58,9 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests m_scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); - m_lo = new LandObject(m_userId, false, m_scene); - m_lo.SetLandBitmap(m_lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); - lmm.AddLandObject(m_lo); + ILandObject lo = new LandObject(m_userId, false, m_scene); + lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); + m_lo = lmm.AddLandObject(lo); //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); } @@ -72,34 +72,36 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests { TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - - Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(0)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); - Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + + IPrimCounts pc = m_lo.PrimCounts; + + Assert.That(pc.Owner, Is.EqualTo(0)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(0)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(0)); SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); m_scene.AddNewSceneObject(sog, false); - Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(3)); - Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(3)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); - Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(3)); + Assert.That(pc.Owner, Is.EqualTo(3)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(3)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(3)); // Add a second object and retest SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); m_scene.AddNewSceneObject(sog2, false); - Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(5)); - Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(5)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); - Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(5)); + Assert.That(pc.Owner, Is.EqualTo(5)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(5)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(5)); } /// @@ -111,17 +113,19 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); + IPrimCounts pc = m_lo.PrimCounts; + m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false); SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); m_scene.AddNewSceneObject(sogToDelete, false); m_scene.DeleteSceneObject(sogToDelete, false); - Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(1)); - Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(1)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); - Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(pc.Owner, Is.EqualTo(1)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(1)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(1)); } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs index eeb9d3a..9c0abde 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs +++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs @@ -46,6 +46,11 @@ namespace OpenSim.Region.Framework.Interfaces UUID RegionUUID { get; } /// + /// Prim counts for this land object. + /// + IPrimCounts PrimCounts { get; set; } + + /// /// The start point for the land object. This is the western-most point as one scans land working from /// north to south. /// -- cgit v1.1 From 6ae04448f73afdca791ea185fdc0e9c062dea87b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 Mar 2011 23:05:51 +0000 Subject: Start using IPrimCounts populated by PrimCountModule instead of LandData counts populated by LandManagementModule. In order to pass ILandObject into IClientAPI.SendLandProperties(), had to push ILandObject and IPrimCounts into OpenSim.Framework from OpenSim.Region.Framework.Interfaces, in order to avoid ci Counts are showing odd behaviour at the moment, this will be addressed shortly. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 35 +++--- .../CoreModules/Avatar/Combat/CombatModule.cs | 1 + .../CoreModules/World/Land/LandManagementModule.cs | 2 +- .../Region/CoreModules/World/Land/LandObject.cs | 2 +- .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 2 +- .../Region/Framework/Interfaces/ILandChannel.cs | 91 ---------------- OpenSim/Region/Framework/Interfaces/ILandObject.cs | 117 --------------------- .../Framework/Interfaces/IPrimCountModule.cs | 16 +-- .../Server/IRCClientView.cs | 2 +- .../Scripting/Minimodule/LOParcel.cs | 1 + .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 +- 11 files changed, 30 insertions(+), 241 deletions(-) delete mode 100644 OpenSim/Region/Framework/Interfaces/ILandChannel.cs delete mode 100644 OpenSim/Region/Framework/Interfaces/ILandObject.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2c6795f..6138056 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4272,8 +4272,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task); } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties( + int sequence_id, bool snap_selection, int request_result, ILandObject lo, + float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { + LandData landData = lo.LandData; + ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); updateMessage.AABBMax = landData.AABBMax; @@ -4281,15 +4285,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.Area = landData.Area; updateMessage.AuctionID = landData.AuctionID; updateMessage.AuthBuyerID = landData.AuthBuyerID; - updateMessage.Bitmap = landData.Bitmap; - updateMessage.Desc = landData.Description; updateMessage.Category = landData.Category; updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate); updateMessage.ClaimPrice = landData.ClaimPrice; - updateMessage.GroupID = landData.GroupID; - updateMessage.GroupPrims = landData.GroupPrims; + updateMessage.GroupID = landData.GroupID; updateMessage.IsGroupOwned = landData.IsGroupOwned; updateMessage.LandingType = (LandingType) landData.LandingType; updateMessage.LocalID = landData.LocalID; @@ -4310,9 +4311,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.Name = landData.Name; updateMessage.OtherCleanTime = landData.OtherCleanTime; updateMessage.OtherCount = 0; //TODO: Unimplemented - updateMessage.OtherPrims = landData.OtherPrims; - updateMessage.OwnerID = landData.OwnerID; - updateMessage.OwnerPrims = landData.OwnerPrims; + updateMessage.OwnerID = landData.OwnerID; updateMessage.ParcelFlags = (ParcelFlags) landData.Flags; updateMessage.ParcelPrimBonus = simObjectBonusFactor; updateMessage.PassHours = landData.PassHours; @@ -4327,10 +4326,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.RentPrice = 0; updateMessage.RequestResult = (ParcelResult) request_result; - updateMessage.SalePrice = landData.SalePrice; - updateMessage.SelectedPrims = landData.SelectedPrims; + updateMessage.SalePrice = landData.SalePrice; updateMessage.SelfCount = 0; //TODO: Unimplemented updateMessage.SequenceID = sequence_id; + if (landData.SimwideArea > 0) { int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); @@ -4340,12 +4339,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP { updateMessage.SimWideMaxPrims = 0; } - updateMessage.SimWideTotalPrims = landData.SimwidePrims; + updateMessage.SnapSelection = snap_selection; updateMessage.SnapshotID = landData.SnapshotID; updateMessage.Status = (ParcelStatus) landData.Status; - updateMessage.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims + - landData.SelectedPrims; updateMessage.UserLocation = landData.UserLocation; updateMessage.UserLookAt = landData.UserLookAt; @@ -4356,6 +4353,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.MediaLoop = landData.MediaLoop; updateMessage.ObscureMusic = landData.ObscureMusic; updateMessage.ObscureMedia = landData.ObscureMedia; + + IPrimCounts pc = lo.PrimCounts; + updateMessage.OwnerPrims = pc.Owner; + updateMessage.GroupPrims = pc.Group; + updateMessage.OtherPrims = pc.Others; + updateMessage.SimWideTotalPrims = pc.Simulator; + + // FIXME: Need to do selected prims once this is reimplemented. + updateMessage.TotalPrims = pc.Owner + pc.Group + pc.Others; + + // TODO: Need to transfer selected prims to new prim count structure. + updateMessage.SelectedPrims = landData.SelectedPrims; try { diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index a5fcb49..0babeb5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using Nini.Config; +using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenMetaverse; diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index d0727d9..52e3718 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -805,7 +805,7 @@ namespace OpenSim.Region.CoreModules.World.Land ILandObject landUnderPrim = GetLandObject(position.X, position.Y); if (landUnderPrim != null) { - landUnderPrim.AddPrimToCount(obj); + ((LandObject)landUnderPrim).AddPrimToCount(obj); } } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 749bb3d..e7bdb19 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.World.Land } remote_client.SendLandProperties(seq_id, - snap_selection, request_result, LandData, + snap_selection, request_result, this, (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, GetParcelMaxPrimCount(this), GetSimulatorMaxPrimCount(this), regionFlags); diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 41d6628..d939329 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -909,7 +909,7 @@ namespace OpenSim.Region.Examples.SimpleModule { } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { } diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs deleted file mode 100644 index 30bae16..0000000 --- a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using OpenMetaverse; -using OpenSim.Framework; - -namespace OpenSim.Region.Framework.Interfaces -{ - public interface ILandChannel - { - /// - /// Get all parcels - /// - /// - List AllParcels(); - - /// - /// Get the parcel at the specified point - /// - /// Value between 0 - 256 on the x axis of the point - /// Value between 0 - 256 on the y axis of the point - /// Land object at the point supplied - ILandObject GetLandObject(int x, int y); - - /// - /// Get the parcel at the specified point - /// - /// Value between 0 - 256 on the x axis of the point - /// Value between 0 - 256 on the y axis of the point - /// Land object at the point supplied - ILandObject GetLandObject(float x, float y); - - /// - /// Get the parcels near the specified point - /// - /// - /// - List ParcelsNearPoint(Vector3 position); - - /// - /// Get the parcel given the land's local id. - /// - /// - /// - ILandObject GetLandObject(int localID); - - /// - /// Clear the land channel of all parcels. - /// - /// - /// If true, set up a default parcel covering the whole region owned by the estate owner. - /// - void Clear(bool setupDefaultParcel); - - bool IsLandPrimCountTainted(); - bool IsForcefulBansAllowed(); - void UpdateLandObject(int localID, LandData data); - void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient); - void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel); - void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel); - void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime); - - void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); - void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id); - } -} diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs deleted file mode 100644 index 9c0abde..0000000 --- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Framework.Scenes; - -namespace OpenSim.Region.Framework.Interfaces -{ - public delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj); - public delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj); - - public interface ILandObject - { - int GetParcelMaxPrimCount(ILandObject thisObject); - int GetSimulatorMaxPrimCount(ILandObject thisObject); - int GetPrimsFree(); - - LandData LandData { get; set; } - bool[,] LandBitmap { get; set; } - UUID RegionUUID { get; } - - /// - /// Prim counts for this land object. - /// - IPrimCounts PrimCounts { get; set; } - - /// - /// The start point for the land object. This is the western-most point as one scans land working from - /// north to south. - /// - Vector3 StartPoint { get; } - - /// - /// The end point for the land object. This is the eastern-most point as one scans land working from - /// south to north. - /// - Vector3 EndPoint { get; } - - bool ContainsPoint(int x, int y); - - ILandObject Copy(); - - void SendLandUpdateToAvatarsOverMe(); - - void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client); - void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); - bool IsEitherBannedOrRestricted(UUID avatar); - bool IsBannedFromLand(UUID avatar); - bool IsRestrictedFromLand(UUID avatar); - void SendLandUpdateToClient(IClientAPI remote_client); - void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); - List CreateAccessListArrayByFlag(AccessList flag); - void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client); - void UpdateAccessList(uint flags, UUID transactionID, int sequenceID, int sections, List entries, IClientAPI remote_client); - void UpdateLandBitmapByteArray(); - void SetLandBitmapFromByteArray(); - bool[,] GetLandBitmap(); - void ForceUpdateLandInfo(); - void SetLandBitmap(bool[,] bitmap); - - bool[,] BasicFullRegionLandBitmap(); - bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y); - bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value); - bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add); - void SendForceObjectSelect(int local_id, int request_type, List returnIDs, IClientAPI remote_client); - void SendLandObjectOwners(IClientAPI remote_client); - void ReturnObject(SceneObjectGroup obj); - void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client); - void ResetLandPrimCounts(); - void AddPrimToCount(SceneObjectGroup obj); - void RemovePrimFromCount(SceneObjectGroup obj); - void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area); - - void DeedToGroup(UUID groupID); - - void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel); - void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel); - - /// - /// Set the media url for this land parcel - /// - /// - void SetMediaUrl(string url); - - /// - /// Set the music url for this land parcel - /// - /// - void SetMusicUrl(string url); - } -} diff --git a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs index 65158e1..d63da2e 100644 --- a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs @@ -38,18 +38,4 @@ namespace OpenSim.Region.Framework.Interfaces IPrimCounts GetPrimCounts(UUID parcelID); } - - public interface IPrimCounts - { - int Owner { get; } - int Group { get; } - int Others { get; } - int Simulator { get; } - IUserPrimCounts Users { get; } - } - - public interface IUserPrimCounts - { - int this[UUID agentID] { get; } - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 49382f0..821cd4b 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1247,7 +1247,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs index 8df020f..c898da6 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 5d44aa1..96760a2 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -925,7 +925,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) + public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { } public void SendLandAccessListData(List avatars, uint accessFlag, int localLandID) -- cgit v1.1 From cc8897fcebdc9d3e875c9bf745ecb77678a776e9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 00:34:49 +0000 Subject: Add test for PCM taint. This currently fails due to unexpected behaviour of SceneGraph.ForEachSOG(). This will be corrected soon. Also adds lots of temproarily debug logging --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 2 + .../CoreModules/World/Land/PrimCountModule.cs | 79 ++++++++++++++++++---- .../World/Land/Tests/PrimCountModuleTests.cs | 24 ++++++- 3 files changed, 89 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 6138056..0b6b04d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4276,6 +4276,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { + m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); + LandData landData = lo.LandData; ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 9fd347e..72115a8 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -51,8 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land public class PrimCountModule : IPrimCountModule, INonSharedRegionModule { -// private static readonly ILog m_log = -// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_Scene; private Dictionary m_PrimCounts = @@ -123,6 +122,11 @@ namespace OpenSim.Region.CoreModules.World.Land { if (!m_Tainted) AddObject(obj); + else + m_log.DebugFormat( + "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", + obj.Name, m_Scene.RegionInfo.RegionName); + } } @@ -133,11 +137,18 @@ namespace OpenSim.Region.CoreModules.World.Land { if (!m_Tainted) RemoveObject(obj); + else + m_log.DebugFormat( + "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted", + obj.Name, m_Scene.RegionInfo.RegionName); } } private void OnParcelPrimCountTainted() { + m_log.DebugFormat( + "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName); + lock (m_TaintLock) m_Tainted = true; } @@ -163,7 +174,7 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: Call under Taint Lock private void AddObject(SceneObjectGroup obj) { -// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} to prim count", obj.Name); + m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} {1} to prim count", obj.Name, obj.UUID); if (obj.IsAttachment) return; @@ -214,10 +225,14 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: Call under Taint Lock private void RemoveObject(SceneObjectGroup obj) { + m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID); } public IPrimCounts GetPrimCounts(UUID parcelID) { + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName); + PrimCounts primCounts; lock (m_PrimCounts) @@ -239,7 +254,7 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetOwnerCount(UUID parcelID) { -// m_log.DebugFormat("[PRIM COUNT MODULE]: GetOwnerCount for {0}", parcelID); + int count = 0; lock (m_TaintLock) { @@ -248,9 +263,14 @@ namespace OpenSim.Region.CoreModules.World.Land ParcelCounts counts; if (m_ParcelCounts.TryGetValue(parcelID, out counts)) - return counts.Owner; + count = counts.Owner; } - return 0; + + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}", + parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } /// @@ -260,6 +280,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetGroupCount(UUID parcelID) { + int count = 0; + lock (m_TaintLock) { if (m_Tainted) @@ -267,9 +289,14 @@ namespace OpenSim.Region.CoreModules.World.Land ParcelCounts counts; if (m_ParcelCounts.TryGetValue(parcelID, out counts)) - return counts.Group; + count = counts.Group; } - return 0; + + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}", + parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } /// @@ -279,6 +306,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetOthersCount(UUID parcelID) { + int count = 0; + lock (m_TaintLock) { if (m_Tainted) @@ -286,9 +315,14 @@ namespace OpenSim.Region.CoreModules.World.Land ParcelCounts counts; if (m_ParcelCounts.TryGetValue(parcelID, out counts)) - return counts.Others; + count = counts.Others; } - return 0; + + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", + parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } /// @@ -298,6 +332,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetSimulatorCount(UUID parcelID) { + int count = 0; + lock (m_TaintLock) { if (m_Tainted) @@ -308,10 +344,15 @@ namespace OpenSim.Region.CoreModules.World.Land { int val; if (m_SimwideCounts.TryGetValue(owner, out val)) - return val; + count = val; } } - return 0; + + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", + parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } /// @@ -322,6 +363,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// public int GetUserCount(UUID parcelID, UUID userID) { + int count = 0; + lock (m_TaintLock) { if (m_Tainted) @@ -332,16 +375,21 @@ namespace OpenSim.Region.CoreModules.World.Land { int val; if (counts.Users.TryGetValue(userID, out val)) - return val; + count = val; } } - return 0; + + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}", + userID, parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; } // NOTE: This method MUST be called while holding the taint lock! private void Recount() { -// m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName); + m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName); m_OwnerMap.Clear(); m_SimwideCounts.Clear(); @@ -367,6 +415,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (!m_OwnerMap.ContainsKey(k)) m_PrimCounts.Remove(k); } + m_Tainted = false; } } diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index c9d393f..80b2859 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -126,6 +126,28 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Users[m_userId], Is.EqualTo(1)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(1)); - } + } + + /// + /// Test the count is correct after is has been tainted. + /// + [Test] + public void TestTaint() + { + TestHelper.InMethod(); + IPrimCounts pc = m_lo.PrimCounts; + + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); + m_scene.AddNewSceneObject(sog, false); + + m_pcm.TaintPrimCount(); + + Assert.That(pc.Owner, Is.EqualTo(3)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(3)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(3)); + } } } \ No newline at end of file -- cgit v1.1 From f30bf429c274c9d6d0cfc99513820f759ca94d3e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 00:42:48 +0000 Subject: refactor: rename SOG collections in SceneGraph to make it clearer that they are indexing each part's UUID, not just the root part. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 60 +++++++++++++-------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index eca2786..345ed7a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -89,8 +89,8 @@ namespace OpenSim.Region.Framework.Scenes protected internal PhysicsScene _PhyScene; - protected internal Dictionary SceneObjectGroupsByLocalID = new Dictionary(); - protected internal Dictionary SceneObjectGroupsByFullID = new Dictionary(); + protected internal Dictionary SceneObjectGroupsByLocalPartID = new Dictionary(); + protected internal Dictionary SceneObjectGroupsByFullPartID = new Dictionary(); private Object m_updateLock = new Object(); @@ -131,10 +131,10 @@ namespace OpenSim.Region.Framework.Scenes m_scenePresenceArray = newlist; } - lock (SceneObjectGroupsByFullID) - SceneObjectGroupsByFullID.Clear(); - lock (SceneObjectGroupsByLocalID) - SceneObjectGroupsByLocalID.Clear(); + lock (SceneObjectGroupsByFullPartID) + SceneObjectGroupsByFullPartID.Clear(); + lock (SceneObjectGroupsByLocalPartID) + SceneObjectGroupsByLocalPartID.Clear(); Entities.Clear(); } @@ -384,18 +384,18 @@ namespace OpenSim.Region.Framework.Scenes if (OnObjectCreate != null) OnObjectCreate(sceneObject); - lock (SceneObjectGroupsByFullID) + lock (SceneObjectGroupsByFullPartID) { - SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; + SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject; foreach (SceneObjectPart part in children) - SceneObjectGroupsByFullID[part.UUID] = sceneObject; + SceneObjectGroupsByFullPartID[part.UUID] = sceneObject; } - lock (SceneObjectGroupsByLocalID) + lock (SceneObjectGroupsByLocalPartID) { - SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; + SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject; foreach (SceneObjectPart part in children) - SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; + SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject; } return true; @@ -427,20 +427,20 @@ namespace OpenSim.Region.Framework.Scenes if (OnObjectRemove != null) OnObjectRemove(Entities[uuid]); - lock (SceneObjectGroupsByFullID) + lock (SceneObjectGroupsByFullPartID) { SceneObjectPart[] parts = grp.Parts; for (int i = 0; i < parts.Length; i++) - SceneObjectGroupsByFullID.Remove(parts[i].UUID); - SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); + SceneObjectGroupsByFullPartID.Remove(parts[i].UUID); + SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID); } - lock (SceneObjectGroupsByLocalID) + lock (SceneObjectGroupsByLocalPartID) { SceneObjectPart[] parts = grp.Parts; for (int i = 0; i < parts.Length; i++) - SceneObjectGroupsByLocalID.Remove(parts[i].LocalId); - SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); + SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId); + SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId); } return Entities.Remove(uuid); @@ -854,14 +854,14 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); SceneObjectGroup sog; - lock (SceneObjectGroupsByLocalID) - SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); + lock (SceneObjectGroupsByLocalPartID) + SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog); if (sog != null) { if (sog.HasChildPrim(localID)) return sog; - SceneObjectGroupsByLocalID.Remove(localID); + SceneObjectGroupsByLocalPartID.Remove(localID); } EntityBase[] entityList = GetEntities(); @@ -873,8 +873,8 @@ namespace OpenSim.Region.Framework.Scenes sog = (SceneObjectGroup)ent; if (sog.HasChildPrim(localID)) { - lock (SceneObjectGroupsByLocalID) - SceneObjectGroupsByLocalID[localID] = sog; + lock (SceneObjectGroupsByLocalPartID) + SceneObjectGroupsByLocalPartID[localID] = sog; return sog; } } @@ -891,16 +891,16 @@ namespace OpenSim.Region.Framework.Scenes private SceneObjectGroup GetGroupByPrim(UUID fullID) { SceneObjectGroup sog; - lock (SceneObjectGroupsByFullID) - SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); + lock (SceneObjectGroupsByFullPartID) + SceneObjectGroupsByFullPartID.TryGetValue(fullID, out sog); if (sog != null) { if (sog.ContainsPart(fullID)) return sog; - lock (SceneObjectGroupsByFullID) - SceneObjectGroupsByFullID.Remove(fullID); + lock (SceneObjectGroupsByFullPartID) + SceneObjectGroupsByFullPartID.Remove(fullID); } EntityBase[] entityList = GetEntities(); @@ -911,8 +911,8 @@ namespace OpenSim.Region.Framework.Scenes sog = (SceneObjectGroup)ent; if (sog.HasChildPrim(fullID)) { - lock (SceneObjectGroupsByFullID) - SceneObjectGroupsByFullID[fullID] = sog; + lock (SceneObjectGroupsByFullPartID) + SceneObjectGroupsByFullPartID[fullID] = sog; return sog; } } @@ -1069,7 +1069,7 @@ namespace OpenSim.Region.Framework.Scenes /// protected internal void ForEachSOG(Action action) { - List objlist = new List(SceneObjectGroupsByFullID.Values); + List objlist = new List(SceneObjectGroupsByFullPartID.Values); foreach (SceneObjectGroup obj in objlist) { try -- cgit v1.1 From 26d16567e1e2bf28a3eafce6d3acf8d9646aaf84 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 00:53:19 +0000 Subject: Make SceneGraph.ForEachSOG() execute once for each SOG, not once for each prim (e.g. a SOG with 3 prims would have the action executed three times). To do this, a new SceneObjectGroupsByFullID index in SceneGraph which just index's prims by their root part UUID, in order to avoid the inefficiency of filtering existing lists. Existing callers to SceneGraph.ForEachSOG() did not fail due to the multiple per SOG action executions - they were probably just much less efficient. Code suggests that no callers expected ForEachSOG() to execute actions on sog multiple times --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 30 ++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 345ed7a..1621398 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -88,9 +88,21 @@ namespace OpenSim.Region.Framework.Scenes protected internal object m_syncRoot = new object(); protected internal PhysicsScene _PhyScene; - - protected internal Dictionary SceneObjectGroupsByLocalPartID = new Dictionary(); + + /// + /// Index the SceneObjectGroup for each part by the root part's UUID. + /// + protected internal Dictionary SceneObjectGroupsByFullID = new Dictionary(); + + /// + /// Index the SceneObjectGroup for each part by that part's UUID. + /// protected internal Dictionary SceneObjectGroupsByFullPartID = new Dictionary(); + + /// + /// Index the SceneObjectGroup for each part by that part's local ID. + /// + protected internal Dictionary SceneObjectGroupsByLocalPartID = new Dictionary(); private Object m_updateLock = new Object(); @@ -131,6 +143,8 @@ namespace OpenSim.Region.Framework.Scenes m_scenePresenceArray = newlist; } + lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID.Clear(); lock (SceneObjectGroupsByFullPartID) SceneObjectGroupsByFullPartID.Clear(); lock (SceneObjectGroupsByLocalPartID) @@ -384,6 +398,9 @@ namespace OpenSim.Region.Framework.Scenes if (OnObjectCreate != null) OnObjectCreate(sceneObject); + lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; + lock (SceneObjectGroupsByFullPartID) { SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject; @@ -426,6 +443,9 @@ namespace OpenSim.Region.Framework.Scenes if (OnObjectRemove != null) OnObjectRemove(Entities[uuid]); + + lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID.Remove(grp.UUID); lock (SceneObjectGroupsByFullPartID) { @@ -1064,12 +1084,13 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Performs action on all scene object groups. + /// Performs action once on all scene object groups. /// /// protected internal void ForEachSOG(Action action) { - List objlist = new List(SceneObjectGroupsByFullPartID.Values); + // FIXME: Need to lock here, really. + List objlist = new List(SceneObjectGroupsByFullID.Values); foreach (SceneObjectGroup obj in objlist) { try @@ -1084,7 +1105,6 @@ namespace OpenSim.Region.Framework.Scenes } } } - /// /// Performs action on all scene presences. This can ultimately run the actions in parallel but -- cgit v1.1 From bfd9cc44b40e64af3c7504d43a15b7e1b44070a0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 02:05:53 +0000 Subject: When an object is duplicated, add the dupe to the uuid/local id indexes as well as the basic entities list. Added a prim counts test to reinforce this - shift-copy was no incrementing prim count. This will sometime become a basic scene test. New code needs to be refactored so we just call SceneGraph.AddSceneObject(). This will happen in the near future. With this, basic owner prim counts on a single parcel appear to be working fine (with the same previous existing taint calls as used by the land management module). More work to do. --- .../World/Land/Tests/PrimCountModuleTests.cs | 23 +++++++++++++++++ OpenSim/Region/Framework/Scenes/SceneGraph.cs | 30 +++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 80b2859..dd55f98 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -105,6 +105,29 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests } /// + /// Test count after a parcel owner owned copied object is added. + /// + [Test] + public void TestCopiedOwnerObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + IPrimCounts pc = m_lo.PrimCounts; + + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); + m_scene.AddNewSceneObject(sog, false); + m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity); + + Assert.That(pc.Owner, Is.EqualTo(6)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(6)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(6)); + } + + /// /// Test count after a parcel owner owned object is removed. /// [Test] diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1621398..60855b2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -363,6 +363,10 @@ namespace OpenSim.Region.Framework.Scenes if (Entities.ContainsKey(sceneObject.UUID)) return false; + +// m_log.DebugFormat( +// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", +// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); SceneObjectPart[] children = sceneObject.Parts; @@ -1798,7 +1802,10 @@ namespace OpenSim.Region.Framework.Scenes /// public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) { - //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); +// m_log.DebugFormat( +// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", +// originalPrimID, offset, AgentID); + SceneObjectGroup original = GetGroupByPrim(originalPrimID); if (original != null) { @@ -1829,7 +1836,28 @@ namespace OpenSim.Region.Framework.Scenes copy.RootPart.SalePrice = 10; } + // FIXME: This section needs to be refactored so that it just calls AddSceneObject() Entities.Add(copy); + + lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID[copy.UUID] = copy; + + SceneObjectPart[] children = copy.Parts; + + lock (SceneObjectGroupsByFullPartID) + { + SceneObjectGroupsByFullPartID[copy.UUID] = copy; + foreach (SceneObjectPart part in children) + SceneObjectGroupsByFullPartID[part.UUID] = copy; + } + + lock (SceneObjectGroupsByLocalPartID) + { + SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; + foreach (SceneObjectPart part in children) + SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; + } + // PROBABLE END OF FIXME // Since we copy from a source group that is in selected // state, but the copy is shown deselected in the viewer, -- cgit v1.1 From 541cd3e8c84d3ccc13525206b1724ee931416a3c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 02:19:28 +0000 Subject: move total parcel prim calculations into IPrimCounts instead of doing this in LLClientView need to move selected prim counts from LandData/LMM still --- .../CoreModules/World/Land/PrimCountModule.cs | 39 ++++++++++++++++++++++ .../World/Land/Tests/PrimCountModuleTests.cs | 8 ++++- 2 files changed, 46 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 72115a8..2de5c16 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -324,6 +324,37 @@ namespace OpenSim.Region.CoreModules.World.Land return count; } + + /// + /// Get the total count of owner, group and others prims on the parcel. + /// FIXME: Need to do selected prims once this is reimplemented. + /// + /// + /// + public int GetTotalCount(UUID parcelID) + { + int count = 0; + + lock (m_TaintLock) + { + if (m_Tainted) + Recount(); + + ParcelCounts counts; + if (m_ParcelCounts.TryGetValue(parcelID, out counts)) + { + count = counts.Owner; + count += counts.Group; + count += counts.Others; + } + } + + m_log.DebugFormat( + "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}", + parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; + } /// /// Get the number of prims that are in the entire simulator for the owner of this parcel. @@ -457,6 +488,14 @@ namespace OpenSim.Region.CoreModules.World.Land return m_Parent.GetOthersCount(m_ParcelID); } } + + public int Total + { + get + { + return m_Parent.GetTotalCount(m_ParcelID); + } + } public int Simulator { diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index dd55f98..58bd841 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -78,9 +78,10 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(0)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(0)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); - Assert.That(pc.Simulator, Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(0)); SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); m_scene.AddNewSceneObject(sog, false); @@ -88,6 +89,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(3)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(3)); Assert.That(pc.Users[m_userId], Is.EqualTo(3)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(3)); @@ -99,6 +101,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(5)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(5)); Assert.That(pc.Users[m_userId], Is.EqualTo(5)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(5)); @@ -122,6 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(6)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(6)); Assert.That(pc.Users[m_userId], Is.EqualTo(6)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(6)); @@ -146,6 +150,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(1)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(1)); Assert.That(pc.Users[m_userId], Is.EqualTo(1)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(1)); @@ -168,6 +173,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Owner, Is.EqualTo(3)); Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(3)); Assert.That(pc.Users[m_userId], Is.EqualTo(3)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(3)); -- cgit v1.1 From b11e3d33f112f4838ca8dde2d217780affbddce4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 02:20:16 +0000 Subject: add save of LLClientView I forgot from last commit --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 0b6b04d..f50637c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4360,10 +4360,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.OwnerPrims = pc.Owner; updateMessage.GroupPrims = pc.Group; updateMessage.OtherPrims = pc.Others; - updateMessage.SimWideTotalPrims = pc.Simulator; - - // FIXME: Need to do selected prims once this is reimplemented. - updateMessage.TotalPrims = pc.Owner + pc.Group + pc.Others; + updateMessage.TotalPrims = pc.Total; + updateMessage.SimWideTotalPrims = pc.Simulator; // TODO: Need to transfer selected prims to new prim count structure. updateMessage.SelectedPrims = landData.SelectedPrims; -- cgit v1.1 From f2d2470c256486df585705313a7fdfdf3d344c1f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 02:24:32 +0000 Subject: When an object is duplicated, add it to the full/local id SOG indexes as well as Entities --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 30 ++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1621398..60855b2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -363,6 +363,10 @@ namespace OpenSim.Region.Framework.Scenes if (Entities.ContainsKey(sceneObject.UUID)) return false; + +// m_log.DebugFormat( +// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", +// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); SceneObjectPart[] children = sceneObject.Parts; @@ -1798,7 +1802,10 @@ namespace OpenSim.Region.Framework.Scenes /// public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) { - //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); +// m_log.DebugFormat( +// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", +// originalPrimID, offset, AgentID); + SceneObjectGroup original = GetGroupByPrim(originalPrimID); if (original != null) { @@ -1829,7 +1836,28 @@ namespace OpenSim.Region.Framework.Scenes copy.RootPart.SalePrice = 10; } + // FIXME: This section needs to be refactored so that it just calls AddSceneObject() Entities.Add(copy); + + lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID[copy.UUID] = copy; + + SceneObjectPart[] children = copy.Parts; + + lock (SceneObjectGroupsByFullPartID) + { + SceneObjectGroupsByFullPartID[copy.UUID] = copy; + foreach (SceneObjectPart part in children) + SceneObjectGroupsByFullPartID[part.UUID] = copy; + } + + lock (SceneObjectGroupsByLocalPartID) + { + SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; + foreach (SceneObjectPart part in children) + SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; + } + // PROBABLE END OF FIXME // Since we copy from a source group that is in selected // state, but the copy is shown deselected in the viewer, -- cgit v1.1 From 2d209d3844a58a4d27fe15aa5ccd497bbd530707 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Mar 2011 16:46:04 -0700 Subject: Fix mantis #5413. WARNING: new config variable in section [GridService] of the simulators called Gatekeeper -- intended to have the URL of the grid's Gatekeeper service (so that it can be checked against). See ini.examples. --- OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 7bb7544..f9ef286 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -100,8 +100,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region regionInfos = new List(); GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName); - if (info != null) regionInfos.Add(info); + if (info != null) + regionInfos.Add(info); } + else if (regionInfos.Count == 0 && mapName.StartsWith("http://")) + remoteClient.SendAlertMessage("Hyperlink could not be established."); + m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); List blocks = new List(); -- cgit v1.1 From d3771e536645f50401e9737a693fcbb1fb3b6a01 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Mar 2011 16:48:12 -0700 Subject: Added code to load a terrain tile of tiff/jpg format. Previously it only worked for one single region. --- .../World/Terrain/FileLoaders/GenericSystemDrawing.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index 6676ec8..d6fa093 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs @@ -62,9 +62,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders return LoadBitmap(new Bitmap(filename)); } - public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) + public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h) { - throw new NotImplementedException(); + Bitmap bitmap = new Bitmap(filename); + ITerrainChannel retval = new TerrainChannel(true); + + for (int x = 0; x < retval.Width; x++) + { + for (int y = 0; y < retval.Height; y++) + { + retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128; + } + } + + return retval; } public virtual ITerrainChannel LoadStream(Stream stream) -- cgit v1.1 From fe258753a04706a0f760743b410611bb299b0bc1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 29 Mar 2011 23:07:01 +0100 Subject: disable prim count debug logging temporarily --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- .../CoreModules/World/Land/PrimCountModule.cs | 68 +++++++++++----------- 2 files changed, 36 insertions(+), 34 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f50637c..8ebcabb 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4276,7 +4276,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { - m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); +// m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); LandData landData = lo.LandData; diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 2de5c16..d126b26 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -122,10 +122,10 @@ namespace OpenSim.Region.CoreModules.World.Land { if (!m_Tainted) AddObject(obj); - else - m_log.DebugFormat( - "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", - obj.Name, m_Scene.RegionInfo.RegionName); +// else +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", +// obj.Name, m_Scene.RegionInfo.RegionName); } } @@ -137,17 +137,17 @@ namespace OpenSim.Region.CoreModules.World.Land { if (!m_Tainted) RemoveObject(obj); - else - m_log.DebugFormat( - "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted", - obj.Name, m_Scene.RegionInfo.RegionName); +// else +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted", +// obj.Name, m_Scene.RegionInfo.RegionName); } } private void OnParcelPrimCountTainted() { - m_log.DebugFormat( - "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName); lock (m_TaintLock) m_Tainted = true; @@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: Call under Taint Lock private void AddObject(SceneObjectGroup obj) { - m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} {1} to prim count", obj.Name, obj.UUID); +// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} {1} to prim count", obj.Name, obj.UUID); if (obj.IsAttachment) return; @@ -225,13 +225,15 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: Call under Taint Lock private void RemoveObject(SceneObjectGroup obj) { - m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID); +// m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID); + + // Currently this is being done by tainting the count instead. } public IPrimCounts GetPrimCounts(UUID parcelID) { - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName); PrimCounts primCounts; @@ -266,9 +268,9 @@ namespace OpenSim.Region.CoreModules.World.Land count = counts.Owner; } - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}", - parcelID, m_Scene.RegionInfo.RegionName, count); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); return count; } @@ -292,9 +294,9 @@ namespace OpenSim.Region.CoreModules.World.Land count = counts.Group; } - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}", - parcelID, m_Scene.RegionInfo.RegionName, count); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); return count; } @@ -318,9 +320,9 @@ namespace OpenSim.Region.CoreModules.World.Land count = counts.Others; } - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", - parcelID, m_Scene.RegionInfo.RegionName, count); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); return count; } @@ -349,9 +351,9 @@ namespace OpenSim.Region.CoreModules.World.Land } } - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}", - parcelID, m_Scene.RegionInfo.RegionName, count); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); return count; } @@ -379,9 +381,9 @@ namespace OpenSim.Region.CoreModules.World.Land } } - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", - parcelID, m_Scene.RegionInfo.RegionName, count); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); return count; } @@ -410,9 +412,9 @@ namespace OpenSim.Region.CoreModules.World.Land } } - m_log.DebugFormat( - "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}", - userID, parcelID, m_Scene.RegionInfo.RegionName, count); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}", +// userID, parcelID, m_Scene.RegionInfo.RegionName, count); return count; } @@ -420,7 +422,7 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: This method MUST be called while holding the taint lock! private void Recount() { - m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName); +// m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName); m_OwnerMap.Clear(); m_SimwideCounts.Clear(); -- cgit v1.1 From 8b16f7d976dc60b06f6d08e9d9d853ae69de5fc9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 30 Mar 2011 00:13:07 +0100 Subject: (re)implement selected prim count. This does not currently count objects that are sat upon (which the viewer ui implies should be included in this count) --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 46 +++++++++++----------- .../CoreModules/World/Land/PrimCountModule.cs | 43 ++++++++++++++++++-- .../World/Land/Tests/PrimCountModuleTests.cs | 6 +++ 3 files changed, 69 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 8ebcabb..2faffae 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4343,28 +4343,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP } updateMessage.SnapSelection = snap_selection; - updateMessage.SnapshotID = landData.SnapshotID; - updateMessage.Status = (ParcelStatus) landData.Status; - updateMessage.UserLocation = landData.UserLocation; - updateMessage.UserLookAt = landData.UserLookAt; - - updateMessage.MediaType = landData.MediaType; - updateMessage.MediaDesc = landData.MediaDescription; - updateMessage.MediaWidth = landData.MediaWidth; - updateMessage.MediaHeight = landData.MediaHeight; - updateMessage.MediaLoop = landData.MediaLoop; - updateMessage.ObscureMusic = landData.ObscureMusic; - updateMessage.ObscureMedia = landData.ObscureMedia; + updateMessage.SnapshotID = landData.SnapshotID; + updateMessage.Status = (ParcelStatus) landData.Status; + updateMessage.UserLocation = landData.UserLocation; + updateMessage.UserLookAt = landData.UserLookAt; + + updateMessage.MediaType = landData.MediaType; + updateMessage.MediaDesc = landData.MediaDescription; + updateMessage.MediaWidth = landData.MediaWidth; + updateMessage.MediaHeight = landData.MediaHeight; + updateMessage.MediaLoop = landData.MediaLoop; + updateMessage.ObscureMusic = landData.ObscureMusic; + updateMessage.ObscureMedia = landData.ObscureMedia; IPrimCounts pc = lo.PrimCounts; - updateMessage.OwnerPrims = pc.Owner; - updateMessage.GroupPrims = pc.Group; - updateMessage.OtherPrims = pc.Others; - updateMessage.TotalPrims = pc.Total; - updateMessage.SimWideTotalPrims = pc.Simulator; - - // TODO: Need to transfer selected prims to new prim count structure. - updateMessage.SelectedPrims = landData.SelectedPrims; + updateMessage.OwnerPrims = pc.Owner; + updateMessage.GroupPrims = pc.Group; + updateMessage.OtherPrims = pc.Others; + updateMessage.SelectedPrims = pc.Selected; + updateMessage.TotalPrims = pc.Total; + updateMessage.SimWideTotalPrims = pc.Simulator; try { @@ -4372,13 +4370,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (eq != null) { eq.ParcelProperties(updateMessage, this.AgentId); - } else { - m_log.Warn("No EQ Interface when sending parcel data."); + } + else + { + m_log.Warn("[LLCLIENTVIEW]: No EQ Interface when sending parcel data."); } } catch (Exception ex) { - m_log.Error("Unable to send parcel data via eventqueue - exception: " + ex.ToString()); + m_log.Error("[LLCLIENTVIEW]: Unable to send parcel data via eventqueue - exception: " + ex.ToString()); } } diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index d126b26..ab0e88e 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -45,13 +45,13 @@ namespace OpenSim.Region.CoreModules.World.Land public int Owner = 0; public int Group = 0; public int Others = 0; - public Dictionary Users = - new Dictionary (); + public int Selected = 0; + public Dictionary Users = new Dictionary (); } public class PrimCountModule : IPrimCountModule, INonSharedRegionModule { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_Scene; private Dictionary m_PrimCounts = @@ -219,6 +219,9 @@ namespace OpenSim.Region.CoreModules.World.Land else parcelCounts.Others += partCount; } + + if (obj.IsSelected) + parcelCounts.Selected += partCount; } } @@ -328,6 +331,32 @@ namespace OpenSim.Region.CoreModules.World.Land } /// + /// Get the number of selected prims. + /// + /// + /// + public int GetSelectedCount(UUID parcelID) + { + int count = 0; + + lock (m_TaintLock) + { + if (m_Tainted) + Recount(); + + ParcelCounts counts; + if (m_ParcelCounts.TryGetValue(parcelID, out counts)) + count = counts.Selected; + } + +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: GetSelectedCount for parcel {0} in {1} returning {2}", +// parcelID, m_Scene.RegionInfo.RegionName, count); + + return count; + } + + /// /// Get the total count of owner, group and others prims on the parcel. /// FIXME: Need to do selected prims once this is reimplemented. /// @@ -491,6 +520,14 @@ namespace OpenSim.Region.CoreModules.World.Land } } + public int Selected + { + get + { + return m_Parent.GetSelectedCount(m_ParcelID); + } + } + public int Total { get diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 58bd841..5a60f22 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -79,6 +79,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Total, Is.EqualTo(0)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(0)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(0)); @@ -90,6 +91,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Total, Is.EqualTo(3)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(3)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(3)); @@ -102,6 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Total, Is.EqualTo(5)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(5)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(5)); @@ -126,6 +129,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Total, Is.EqualTo(6)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(6)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(6)); @@ -151,6 +155,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Total, Is.EqualTo(1)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(1)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(1)); @@ -174,6 +179,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Group, Is.EqualTo(0)); Assert.That(pc.Others, Is.EqualTo(0)); Assert.That(pc.Total, Is.EqualTo(3)); + Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(3)); Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(3)); -- cgit v1.1 From f7ed7fc05d1c6cc02df43f787590d8b3adeda22b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 30 Mar 2011 00:42:02 +0100 Subject: When a new parcel is created, make sure the prim counts are updated. This is done by tainting the counts where appropriate --- OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index ab0e88e..d1e2328 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land public class PrimCountModule : IPrimCountModule, INonSharedRegionModule { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_Scene; private Dictionary m_PrimCounts = @@ -63,7 +63,6 @@ namespace OpenSim.Region.CoreModules.World.Land private Dictionary m_ParcelCounts = new Dictionary(); - /// /// For now, a simple simwide taint to get this up. Later parcel based /// taint to allow recounting a parcel if only ownership has changed @@ -95,6 +94,7 @@ namespace OpenSim.Region.CoreModules.World.Land OnObjectBeingRemovedFromScene; m_Scene.EventManager.OnParcelPrimCountTainted += OnParcelPrimCountTainted; + m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); }; } public void RegionLoaded(Scene scene) -- cgit v1.1 From 8022400bd4c852c3faf0db61006a2c60f5200342 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 31 Mar 2011 22:16:09 +0100 Subject: Remove unused Datastore parameter from RegionInfo (legacy from early 2008) --- OpenSim/Region/Framework/Scenes/Scene.cs | 1 - OpenSim/Region/Framework/Scenes/SceneBase.cs | 2 -- 2 files changed, 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d407a6f..353b7c2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -563,7 +563,6 @@ namespace OpenSim.Region.Framework.Scenes m_regInfo = regInfo; m_regionHandle = m_regInfo.RegionHandle; m_regionName = m_regInfo.RegionName; - m_datastore = m_regInfo.DataStore; m_lastUpdate = Util.EnvironmentTickCount(); m_physicalPrim = physicalPrim; diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index f343bc8..c4547f2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -136,8 +136,6 @@ namespace OpenSim.Region.Framework.Scenes get { return m_permissions; } } - protected string m_datastore; - /* Used by the loadbalancer plugin on GForge */ protected RegionStatus m_regStatus; public RegionStatus RegionStatus -- cgit v1.1 From efd0c003a3baf3c8d1abd1bab422ae5bb015ab87 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 31 Mar 2011 22:47:18 +0100 Subject: Put in temporary logging message to find out if scene objects are requesting land objects for co-ordinates outside the region --- OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 52e3718..fac2574 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -762,13 +762,14 @@ namespace OpenSim.Region.CoreModules.World.Land { try { - //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) - return m_landList[m_landIDList[x / 4, y / 4]]; - //else - // return null; + return m_landList[m_landIDList[x / 4, y / 4]]; } catch (IndexOutOfRangeException) { + m_log.WarnFormat( + "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}", + x, y, m_scene.RegionInfo.RegionName); + return null; } } -- cgit v1.1 From 6ae76ede98c3fa7731daf7149a8831f474770fee Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 31 Mar 2011 23:09:06 +0100 Subject: suspend check that IAR control file is loaded for now I was mistaken - some previous opensim versions don't save this file first. Will have to bump iar version number and only check iars after the bump --- .../Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 9b98de3..01170aa 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -77,7 +77,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// private Stream m_loadStream; - protected bool m_controlFileLoaded; + /// + /// FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things + /// (I thought they weren't). We will need to bump the version number and perform this check on all + /// subsequent IAR versions only + /// + protected bool m_controlFileLoaded = true; protected bool m_assetsLoaded; protected bool m_inventoryNodesLoaded; -- cgit v1.1 From 4d0cffa06e1c4071d137834e1d5c2cd06c933441 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 31 Mar 2011 23:56:26 +0100 Subject: If the prim count gets an object with invalid bounds, don't try to count it. This appears to be the more probable explanation for some failures seen. Either we're counting attachments which are temporarily out of bounds (shouldn't be due to the IsAttachment) check or we're counting scene objects which have out of bounds co-ordinates (seems more likely) --- OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 6 +++--- OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index fac2574..2b5f7a0 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -766,9 +766,9 @@ namespace OpenSim.Region.CoreModules.World.Land } catch (IndexOutOfRangeException) { - m_log.WarnFormat( - "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}", - x, y, m_scene.RegionInfo.RegionName); +// m_log.WarnFormat( +// "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}", +// x, y, m_scene.RegionInfo.RegionName); return null; } diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index d1e2328..f07ae31 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -183,6 +183,11 @@ namespace OpenSim.Region.CoreModules.World.Land Vector3 pos = obj.AbsolutePosition; ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y); + + // If for some reason there is no land object (perhaps the object is out of bounds) then we can't count it + if (landObject == null) + return; + LandData landData = landObject.LandData; // m_log.DebugFormat( -- cgit v1.1 From 39c610c16554de05dae975cb9258881dce1d17ed Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 1 Apr 2011 00:41:52 +0100 Subject: Log which address and port the UDP listener is configured for. This will match that given for InternalAddress in the config (e.g. 0.0.0.0) Can't obtain actually bound address until the UDP socket is used for the first time. --- OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs index d2779ba..6eebd9d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs @@ -100,6 +100,10 @@ namespace OpenMetaverse const int SIO_UDP_CONNRESET = -1744830452; IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort); + + m_log.DebugFormat( + "[UDPBASE]: Binding UDP listener using internal IP address config {0}:{1}", + ipep.Address, ipep.Port); m_udpSocket = new Socket( AddressFamily.InterNetwork, -- cgit v1.1 From e1ceb461c0e37cfe56fdfeb91a9ac4b4aa54b931 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 1 Apr 2011 00:51:10 +0100 Subject: Make default answer for 'do you wish to join region to an existing estate' yes instead of no. --- OpenSim/Region/Application/OpenSimBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 6405811..f98d702 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -860,7 +860,7 @@ namespace OpenSim = MainConsole.Instance.CmdPrompt( string.Format( "Do you wish to join region {0} to an existing estate (yes/no)?", regInfo.RegionName), - "no", + "yes", new List() { "yes", "no" }); if (response == "no") -- cgit v1.1 From 8f4bf435344af76d7ff6436ec74eab92399c3a99 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 1 Apr 2011 00:55:05 +0100 Subject: When asked to join region to existing estate, make first estate name the default instead of None --- OpenSim/Region/Application/OpenSimBase.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f98d702..ea9edf6 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -876,15 +876,12 @@ namespace OpenSim = MainConsole.Instance.CmdPrompt( string.Format( "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())), - "None"); - - if (response == "None") - continue; + estateNames[0]); List estateIDs = EstateDataService.GetEstates(response); if (estateIDs.Count < 1) { - MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again."); + MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again."); continue; } -- cgit v1.1 From 8c8a0a182e28f3486ce89fc0570b56fe53f69934 Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 31 Mar 2011 21:14:53 -0700 Subject: implement LSL "print()" API function --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 +++++++- OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 1 + OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 72ee495..e3e16bd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -81,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected IScriptEngine m_ScriptEngine; protected SceneObjectPart m_host; protected uint m_localID; @@ -10278,6 +10278,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return GetLinkPrimitiveParams(obj, rules); } + + public void print(string str) + { + // yes, this is a real LSL function. See: http://wiki.secondlife.com/wiki/Print + m_log.Info("LSL print():" + str); + } } public class NotecardCache diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 561e3b3..bd6a094 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -398,6 +398,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Vector llWind(LSL_Vector offset); LSL_String llXorBase64Strings(string str1, string str2); LSL_String llXorBase64StringsCorrect(string str1, string str2); + void print(string str); void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 451163f..3b29861 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1847,5 +1847,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_LSL_Functions.llClearPrimMedia(face); } + + public void print(string str) + { + m_LSL_Functions.print(str); + } } } -- cgit v1.1 From e974fde95313e17c239e4e35487da897f725a904 Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 31 Mar 2011 22:56:04 -0700 Subject: check threat configuration for LSL print() --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e3e16bd..43b0da3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10282,7 +10282,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void print(string str) { // yes, this is a real LSL function. See: http://wiki.secondlife.com/wiki/Print - m_log.Info("LSL print():" + str); + IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_itemID, "OSSL"); + if (ossl != null) + { + ossl.CheckThreatLevel(ThreatLevel.High, "print"); + m_log.Info("LSL print():" + str); + } } } -- cgit v1.1 From 3a113f9902b859d11c200f9b0db06c2317eb53cc Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 1 Apr 2011 22:04:29 +0100 Subject: A stab at making CHANGED_OWNER work --- .../InventoryAccess/InventoryAccessModule.cs | 24 +++++++--------------- .../Framework/Scenes/SceneObjectPartInventory.cs | 10 ++++----- 2 files changed, 12 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 798547a..8d0c35a 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -668,28 +668,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) part.GroupMask = item.GroupPermissions; } + + foreach (SceneObjectPart part in group.Parts) + { + part.LastOwnerID = part.OwnerID; + part.OwnerID = item.Owner; + part.Inventory.ChangeInventoryOwner(item.Owner); + } group.ApplyNextOwnerPermissions(); } } - foreach (SceneObjectPart part in group.Parts) - { - if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) - { - part.LastOwnerID = part.OwnerID; - part.OwnerID = item.Owner; - part.Inventory.ChangeInventoryOwner(item.Owner); - part.GroupMask = 0; // DO NOT propagate here - } - if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) - part.EveryoneMask = item.EveryOnePermissions; - if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) - part.NextOwnerMask = item.NextPermissions; - if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) - part.GroupMask = item.GroupPermissions; - } - rootPart.TrimPermissions(); if (!attachment) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index fa404c0..3281eab 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -175,12 +175,12 @@ namespace OpenSim.Region.Framework.Scenes foreach (TaskInventoryItem item in items) { if (ownerId != item.OwnerID) - { item.LastOwnerID = item.OwnerID; - item.OwnerID = ownerId; - item.PermsMask = 0; - item.PermsGranter = UUID.Zero; - } + + item.OwnerID = ownerId; + item.PermsMask = 0; + item.PermsGranter = UUID.Zero; + item.OwnerChanged = true; } } -- cgit v1.1 From 5b0936d4b52a972af4f9efa2e69c938e334ad3c7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 2 Apr 2011 01:07:52 +0100 Subject: If the land has no group ownership (it is UUID.Zero) then don't put prims in the group count when they are also not group owned. Also adds simple test for others owned count when an object is added --- .../CoreModules/World/Land/PrimCountModule.cs | 4 ++-- .../World/Land/Tests/PrimCountModuleTests.cs | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index f07ae31..992cd72 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.World.Land { if (obj.OwnerID == landData.GroupID) parcelCounts.Owner += partCount; - else if (obj.GroupID == landData.GroupID) + else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID) parcelCounts.Group += partCount; else parcelCounts.Others += partCount; @@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.World.Land { if (obj.OwnerID == landData.OwnerID) parcelCounts.Owner += partCount; - else if (obj.GroupID == landData.GroupID) + else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID) parcelCounts.Group += partCount; else parcelCounts.Others += partCount; diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 5a60f22..521effc 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -161,6 +161,27 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Simulator, Is.EqualTo(1)); } + [Test] + public void TestAddOthersObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + IPrimCounts pc = m_lo.PrimCounts; + + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_dummyUserId, 0x01); + m_scene.AddNewSceneObject(sog, false); + + Assert.That(pc.Owner, Is.EqualTo(0)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(3)); + Assert.That(pc.Total, Is.EqualTo(3)); + Assert.That(pc.Selected, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(0)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(3)); + Assert.That(pc.Simulator, Is.EqualTo(3)); + } + /// /// Test the count is correct after is has been tainted. /// -- cgit v1.1 From 2c86f6ba7ddcf4816618db5b19a8ca111a8425b5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 2 Apr 2011 01:13:10 +0100 Subject: refactor: rename m_dummyUserId to m_otherUserId --- .../World/Land/Tests/PrimCountModuleTests.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 521effc..49ad705 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests public class PrimCountModuleTests { protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000"); - protected UUID m_dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); + protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999"); protected TestScene m_scene; protected PrimCountModule m_pcm; protected ILandObject m_lo; @@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Total, Is.EqualTo(0)); Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(0)); - Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(0)); SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); @@ -93,7 +93,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Total, Is.EqualTo(3)); Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(3)); - Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(3)); // Add a second object and retest @@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Total, Is.EqualTo(5)); Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(5)); - Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(5)); } @@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Total, Is.EqualTo(6)); Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(6)); - Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(6)); } @@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Total, Is.EqualTo(1)); Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(1)); - Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(1)); } @@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_dummyUserId, 0x01); + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x01); m_scene.AddNewSceneObject(sog, false); Assert.That(pc.Owner, Is.EqualTo(0)); @@ -178,7 +178,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Total, Is.EqualTo(3)); Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(0)); - Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(3)); + Assert.That(pc.Users[m_otherUserId], Is.EqualTo(3)); Assert.That(pc.Simulator, Is.EqualTo(3)); } @@ -202,7 +202,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Total, Is.EqualTo(3)); Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(3)); - Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(3)); } } -- cgit v1.1 From c13502a5cf938e898ef27f471ac27f0707698543 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 2 Apr 2011 01:15:17 +0100 Subject: add remove others object prim count test --- .../World/Land/Tests/PrimCountModuleTests.cs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 49ad705..b9eef79 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -182,6 +182,29 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Simulator, Is.EqualTo(3)); } + [Test] + public void TestRemoveOthersObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + IPrimCounts pc = m_lo.PrimCounts; + + m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, 0x1), false); + SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x10); + m_scene.AddNewSceneObject(sogToDelete, false); + m_scene.DeleteSceneObject(sogToDelete, false); + + Assert.That(pc.Owner, Is.EqualTo(0)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(1)); + Assert.That(pc.Total, Is.EqualTo(1)); + Assert.That(pc.Selected, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(0)); + Assert.That(pc.Users[m_otherUserId], Is.EqualTo(1)); + Assert.That(pc.Simulator, Is.EqualTo(1)); + } + /// /// Test the count is correct after is has been tainted. /// -- cgit v1.1 From 01b399055b06b69848ffcdeb3cafec83cbeb06d2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 2 Apr 2011 01:37:46 +0100 Subject: add test for adding group object, factor out initial zero counts test --- .../World/Land/Tests/PrimCountModuleTests.cs | 52 +++++++++++++++++++--- 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index b9eef79..38b2356 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -45,6 +45,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests public class PrimCountModuleTests { protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000"); + protected UUID m_groupId = new UUID("00000000-0000-0000-8888-000000000000"); protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999"); protected TestScene m_scene; protected PrimCountModule m_pcm; @@ -65,14 +66,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests } /// - /// Test count after a parcel owner owned object is added. + /// Test that counts before we do anything are correct. /// [Test] - public void TestAddOwnerObject() + public void TestInitialCounts() { - TestHelper.InMethod(); -// log4net.Config.XmlConfigurator.Configure(); - IPrimCounts pc = m_lo.PrimCounts; Assert.That(pc.Owner, Is.EqualTo(0)); @@ -82,7 +80,19 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Selected, Is.EqualTo(0)); Assert.That(pc.Users[m_userId], Is.EqualTo(0)); Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); - Assert.That(pc.Simulator, Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(0)); + } + + /// + /// Test count after a parcel owner owned object is added. + /// + [Test] + public void TestAddOwnerObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + IPrimCounts pc = m_lo.PrimCounts; SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); m_scene.AddNewSceneObject(sog, false); @@ -159,7 +169,35 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Users[m_userId], Is.EqualTo(1)); Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(1)); - } + } + + [Test] + public void TestAddGroupObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + m_lo.DeedToGroup(m_groupId); + + IPrimCounts pc = m_lo.PrimCounts; + + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x01); + sog.GroupID = m_groupId; + m_scene.AddNewSceneObject(sog, false); + + Assert.That(pc.Owner, Is.EqualTo(0)); + Assert.That(pc.Group, Is.EqualTo(3)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(3)); + Assert.That(pc.Selected, Is.EqualTo(0)); + + // Is this desired behaviour? Not totally sure. + Assert.That(pc.Users[m_userId], Is.EqualTo(0)); + Assert.That(pc.Users[m_groupId], Is.EqualTo(0)); + Assert.That(pc.Users[m_otherUserId], Is.EqualTo(3)); + + Assert.That(pc.Simulator, Is.EqualTo(3)); + } [Test] public void TestAddOthersObject() -- cgit v1.1 From 8e668abc6db47eb21d6eb294cf696d6bc10d51a6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 2 Apr 2011 01:46:06 +0100 Subject: add test for removing group owned objects --- .../World/Land/Tests/PrimCountModuleTests.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 38b2356..f006db2 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -199,6 +199,38 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Simulator, Is.EqualTo(3)); } + /// + /// Test count after a parcel owner owned object is removed. + /// + [Test] + public void TestRemoveGroupObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + m_lo.DeedToGroup(m_groupId); + + IPrimCounts pc = m_lo.PrimCounts; + + SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1); + sogToKeep.GroupID = m_groupId; + m_scene.AddNewSceneObject(sogToKeep, false); + + SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); + m_scene.AddNewSceneObject(sogToDelete, false); + m_scene.DeleteSceneObject(sogToDelete, false); + + Assert.That(pc.Owner, Is.EqualTo(0)); + Assert.That(pc.Group, Is.EqualTo(1)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Total, Is.EqualTo(1)); + Assert.That(pc.Selected, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(1)); + Assert.That(pc.Users[m_groupId], Is.EqualTo(0)); + Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(1)); + } + [Test] public void TestAddOthersObject() { -- cgit v1.1 From 7bba0177fea621fa7116df8dfc1680dc9045fbd3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 2 Apr 2011 01:53:47 +0100 Subject: If land is not group owned (group ID is always UUID.Zero) then don't check if a prim should be added to the group count --- OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 992cd72..bc140ae 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -219,8 +219,6 @@ namespace OpenSim.Region.CoreModules.World.Land { if (obj.OwnerID == landData.OwnerID) parcelCounts.Owner += partCount; - else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID) - parcelCounts.Group += partCount; else parcelCounts.Others += partCount; } -- cgit v1.1 From 4f56c732bc00588cd8ced1be85bc4d13815f86bd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 2 Apr 2011 02:29:42 +0100 Subject: Comment out some startup logging lines to make up for the one I added earlier on. Most of these are where the region modules are telling us they are disabled. Convention is only to log when enabled (even that is really noisy) --- OpenSim/Region/Application/OpenSim.cs | 2 +- .../Region/CoreModules/Scripting/EMailModules/EmailModule.cs | 2 -- .../Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs | 9 ++------- .../Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 6 ------ .../Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | 8 -------- .../Avatar/XmlRpcGroups/GroupsMessagingModule.cs | 3 --- .../Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | 10 +--------- 7 files changed, 4 insertions(+), 36 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 4081888..ec1fb04 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -123,7 +123,7 @@ namespace OpenSim m_log.Info("===================================================================="); m_log.Info("========================= STARTING OPENSIM ========================="); m_log.Info("===================================================================="); - m_log.InfoFormat("[OPENSIM MAIN]: Running "); + //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString()); // http://msdn.microsoft.com/en-us/library/bb384202.aspx //GCSettings.LatencyMode = GCLatencyMode.Batch; diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs index c0975ea..9255791 100644 --- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs @@ -111,14 +111,12 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules { if ((SMTPConfig = m_Config.Configs["SMTP"]) == null) { - m_log.InfoFormat("[SMTP] SMTP server not configured"); m_Enabled = false; return; } if (!SMTPConfig.GetBoolean("enabled", false)) { - m_log.InfoFormat("[SMTP] module disabled in configuration"); m_Enabled = false; return; } diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs index 2fcc477..0d6313a 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs @@ -80,16 +80,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge m_config = config.Configs["Concierge"]; if (null == m_config) - { - m_log.Info("[Concierge]: no config found, plugin disabled"); return; - } if (!m_config.GetBoolean("enabled", false)) - { - m_log.Info("[Concierge]: plugin disabled by configuration"); return; - } + m_enabled = true; @@ -113,9 +108,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge { m_replacingChatModule = false; } + m_log.InfoFormat("[Concierge] {0} ChatModule", m_replacingChatModule ? "replacing" : "not replacing"); - // take note of concierge channel and of identity m_conciergeChannel = config.Configs["Concierge"].GetInt("concierge_channel", m_conciergeChannel); m_whoami = m_config.GetString("whoami", "conferencier"); diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 05a1c3b..7909d8a 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -106,16 +106,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice m_Config = config.Configs["FreeSwitchVoice"]; if (m_Config == null) - { - m_log.Info("[FreeSwitchVoice] no config found, plugin disabled"); return; - } if (!m_Config.GetBoolean("Enabled", false)) - { - m_log.Info("[FreeSwitchVoice] plugin disabled by configuration"); return; - } try { diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index 34d0e24..534bf92 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs @@ -121,16 +121,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice m_config = config.Configs["VivoxVoice"]; if (null == m_config) - { - m_log.Info("[VivoxVoice] no config found, plugin disabled"); return; - } if (!m_config.GetBoolean("enabled", false)) - { - m_log.Info("[VivoxVoice] plugin disabled by configuration"); return; - } try { @@ -218,7 +212,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice m_pluginEnabled = true; m_log.Info("[VivoxVoice] plugin enabled"); - } catch (Exception e) { @@ -228,7 +221,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice } } - // Called to indicate that the module has been added to the region public void AddRegion(Scene scene) { diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 3d34441..8c01d75 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs @@ -86,13 +86,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return; } - m_log.Info("[GROUPS-MESSAGING]: Initializing GroupsMessagingModule"); - m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); } m_log.Info("[GROUPS-MESSAGING]: GroupsMessagingModule starting up"); - } public void AddRegion(Scene scene) diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index df60709..74f5208 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs @@ -75,7 +75,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule if (source.Configs["MRM"].GetBoolean("Enabled", false)) { - m_log.Info("[MRM] Enabling MRM Module"); + m_log.Info("[MRM]: Enabling MRM Module"); m_scene = scene; // when hidden, we don't listen for client initiated script events @@ -90,14 +90,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule scene.RegisterModuleInterface(this); } - else - { - m_log.Info("[MRM] Disabled MRM Module (Disabled in ini)"); - } - } - else - { - m_log.Info("[MRM] Disabled MRM Module (Default disabled)"); } } -- cgit v1.1 From e8e940e33e458622ef3c1f6fbd206fcf13b2f700 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 3 Apr 2011 13:50:19 +0200 Subject: Make CHANGED_OWNER work for deeding and god-mode in-world change --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index fcbcf59..73dd531 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2069,7 +2069,10 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart[] partList = sog.Parts; foreach (SceneObjectPart child in partList) + { child.Inventory.ChangeInventoryOwner(ownerID); + child.TriggerScriptChangedEvent(Changed.OWNER); + } } else { @@ -2085,6 +2088,7 @@ namespace OpenSim.Region.Framework.Scenes { child.LastOwnerID = child.OwnerID; child.Inventory.ChangeInventoryOwner(groupID); + child.TriggerScriptChangedEvent(Changed.OWNER); } sog.SetOwnerId(groupID); -- cgit v1.1 From b385d4aa036ad7bf58d033a9923452535c82ef69 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 7 Oct 2010 01:13:17 +0200 Subject: Implement taking of coalesced objects. WARNING!!!!! You can TAKE them, but you can't REZ them again. Only the first of the contained objects will rez, the rest is inaccessible until rezzing them is implemented. Also, rotations are not explicitly stored. This MAY work. Or not. --- .../InventoryAccess/InventoryAccessModule.cs | 459 ++++++++++++--------- .../Scenes/AsyncSceneObjectGroupDeleter.cs | 4 +- OpenSim/Region/Framework/Scenes/Scene.cs | 9 + 3 files changed, 274 insertions(+), 198 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 8d0c35a..88dff02 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using System.Net; +using System.Xml; using System.Reflection; using System.Threading; @@ -205,11 +206,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, List objectGroups, IClientAPI remoteClient) { - // HACK: This is only working for lists containing a single item! - // It's just a hack to make this WIP compile and run. Nothing - // currently calls this with multiple items. UUID ret = UUID.Zero; + // The following code groups the SOG's by owner. No objects + // belonging to different people can be coalesced, for obvious + // reasons. Dictionary> deletes = new Dictionary>(); @@ -221,262 +222,328 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess deletes[g.OwnerID].Add(g); } + // This is pethod scoped and will be returned. It will be the + // last created asset id + UUID assetID = UUID.Zero; + + // Each iteration is really a separate asset being created, + // with distinct destinations as well. foreach (List objlist in deletes.Values) { - foreach (SceneObjectGroup g in objlist) - ret = DeleteToInventory(action, folderID, g, remoteClient); - } - - return ret; - } + Dictionary xmlStrings = + new Dictionary(); - private UUID DeleteToInventory(DeRezAction action, UUID folderID, - SceneObjectGroup objectGroup, IClientAPI remoteClient) - { - UUID assetID = UUID.Zero; + foreach (SceneObjectGroup objectGroup in objlist) + { + Vector3 inventoryStoredPosition = new Vector3 + (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) + ? 250 + : objectGroup.AbsolutePosition.X) + , + (objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) + ? 250 + : objectGroup.AbsolutePosition.X, + objectGroup.AbsolutePosition.Z); - Vector3 inventoryStoredPosition = new Vector3 - (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) - ? 250 - : objectGroup.AbsolutePosition.X) - , - (objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) - ? 250 - : objectGroup.AbsolutePosition.X, - objectGroup.AbsolutePosition.Z); + Vector3 originalPosition = objectGroup.AbsolutePosition; - Vector3 originalPosition = objectGroup.AbsolutePosition; + // Restore attachment data after trip through the sim + if (objectGroup.RootPart.AttachPoint > 0) + inventoryStoredPosition = objectGroup.RootPart.AttachOffset; + objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; - objectGroup.AbsolutePosition = inventoryStoredPosition; + objectGroup.AbsolutePosition = inventoryStoredPosition; - string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); + // Make sure all bits but the ones we want are clear + // on take. + // This will be applied to the current perms, so + // it will do what we want. + objectGroup.RootPart.NextOwnerMask &= + ((uint)PermissionMask.Copy | + (uint)PermissionMask.Transfer | + (uint)PermissionMask.Modify); + objectGroup.RootPart.NextOwnerMask |= + (uint)PermissionMask.Move; - objectGroup.AbsolutePosition = originalPosition; + string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); - // Get the user info of the item destination - // - UUID userID = UUID.Zero; + objectGroup.AbsolutePosition = originalPosition; - if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || - action == DeRezAction.SaveToExistingUserInventoryItem) - { - // Take or take copy require a taker - // Saving changes requires a local user - // - if (remoteClient == null) - return UUID.Zero; + xmlStrings[objectGroup.UUID] = sceneObjectXml; + } - userID = remoteClient.AgentId; - } - else - { - // All returns / deletes go to the object owner - // + string itemXml; - userID = objectGroup.RootPart.OwnerID; - } + if (objlist.Count > 1) + { + float minX, minY, minZ; + float maxX, maxY, maxZ; - if (userID == UUID.Zero) // Can't proceed - { - return UUID.Zero; - } + Vector3[] offsets = m_Scene.GetCombinedBoundingBox(objlist, + out minX, out maxX, out minY, out maxY, + out minZ, out maxZ); - // If we're returning someone's item, it goes back to the - // owner's Lost And Found folder. - // Delete is treated like return in this case - // Deleting your own items makes them go to trash - // + // CreateWrapper + XmlDocument itemDoc = new XmlDocument(); + XmlElement root = itemDoc.CreateElement("", "CoalescedObject", ""); + itemDoc.AppendChild(root); - InventoryFolderBase folder = null; - InventoryItemBase item = null; + // Embed the offsets into the group XML + for ( int i = 0 ; i < objlist.Count ; i++ ) + { + XmlDocument doc = new XmlDocument(); + SceneObjectGroup g = objlist[i]; + doc.LoadXml(xmlStrings[g.UUID]); + XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup"); + e.SetAttribute("offsetx", offsets[i].X.ToString()); + e.SetAttribute("offsety", offsets[i].Y.ToString()); + e.SetAttribute("offsetz", offsets[i].Z.ToString()); + + XmlNode objectNode = itemDoc.ImportNode(e, true); + root.AppendChild(objectNode); + } - if (DeRezAction.SaveToExistingUserInventoryItem == action) - { - item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID, userID); - item = m_Scene.InventoryService.GetItem(item); + float sizeX = maxX - minX; + float sizeY = maxY - minY; + float sizeZ = maxZ - minZ; - //item = userInfo.RootFolder.FindItem( - // objectGroup.RootPart.FromUserInventoryItemID); + root.SetAttribute("x", sizeX.ToString()); + root.SetAttribute("y", sizeY.ToString()); + root.SetAttribute("z", sizeZ.ToString()); - if (null == item) + itemXml = itemDoc.InnerXml; + } + else { - m_log.DebugFormat( - "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", - objectGroup.Name, objectGroup.UUID); - return UUID.Zero; + itemXml = xmlStrings[objlist[0].UUID]; } - } - else - { - // Folder magic + + // Get the user info of the item destination // - if (action == DeRezAction.Delete) + UUID userID = UUID.Zero; + + if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || + action == DeRezAction.SaveToExistingUserInventoryItem) { - // Deleting someone else's item + // Take or take copy require a taker + // Saving changes requires a local user // - if (remoteClient == null || - objectGroup.OwnerID != remoteClient.AgentId) - { + if (remoteClient == null) + return UUID.Zero; - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); - } - else - { - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); - } + userID = remoteClient.AgentId; } - else if (action == DeRezAction.Return) + else { - - // Dump to lost + found unconditionally + // All returns / deletes go to the object owner // - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); + + userID = objlist[0].RootPart.OwnerID; } - if (folderID == UUID.Zero && folder == null) + if (userID == UUID.Zero) // Can't proceed { - if (action == DeRezAction.Delete) + return UUID.Zero; + } + + // If we're returning someone's item, it goes back to the + // owner's Lost And Found folder. + // Delete is treated like return in this case + // Deleting your own items makes them go to trash + // + + InventoryFolderBase folder = null; + InventoryItemBase item = null; + + if (DeRezAction.SaveToExistingUserInventoryItem == action) + { + item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID); + item = m_Scene.InventoryService.GetItem(item); + + //item = userInfo.RootFolder.FindItem( + // objectGroup.RootPart.FromUserInventoryItemID); + + if (null == item) { - // Deletes go to trash by default - // - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); + m_log.DebugFormat( + "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", + objlist[0].Name, objlist[0].UUID); + return UUID.Zero; } - else + } + else + { + // Folder magic + // + if (action == DeRezAction.Delete) { + // Deleting someone else's item + // if (remoteClient == null || - objectGroup.OwnerID != remoteClient.AgentId) + objlist[0].OwnerID != remoteClient.AgentId) { - // Taking copy of another person's item. Take to - // Objects folder. - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); + + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); } else { - // Catch all. Use lost & found + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); + } + } + else if (action == DeRezAction.Return) + { + + // Dump to lost + found unconditionally + // + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); + } + + if (folderID == UUID.Zero && folder == null) + { + if (action == DeRezAction.Delete) + { + // Deletes go to trash by default // + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); + } + else + { + if (remoteClient == null || + objlist[0].OwnerID != remoteClient.AgentId) + { + // Taking copy of another person's item. Take to + // Objects folder. + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); + } + else + { + // Catch all. Use lost & found + // - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); + } } } - } - // Override and put into where it came from, if it came - // from anywhere in inventory - // - if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) - { - if (objectGroup.RootPart.FromFolderID != UUID.Zero) + // Override and put into where it came from, if it came + // from anywhere in inventory + // + if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) { - InventoryFolderBase f = new InventoryFolderBase(objectGroup.RootPart.FromFolderID, userID); - folder = m_Scene.InventoryService.GetFolder(f); + if (objlist[0].RootPart.FromFolderID != UUID.Zero) + { + InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID); + folder = m_Scene.InventoryService.GetFolder(f); + } } - } - - if (folder == null) // None of the above - { - folder = new InventoryFolderBase(folderID); - if (folder == null) // Nowhere to put it + if (folder == null) // None of the above { - return UUID.Zero; - } - } + folder = new InventoryFolderBase(folderID); - item = new InventoryItemBase(); - item.CreatorId = objectGroup.RootPart.CreatorID.ToString(); - item.CreatorData = objectGroup.RootPart.CreatorData; - item.ID = UUID.Random(); - item.InvType = (int)InventoryType.Object; - item.Folder = folder.ID; - item.Owner = userID; - } + if (folder == null) // Nowhere to put it + { + return UUID.Zero; + } + } - AssetBase asset = CreateAsset( - objectGroup.GetPartName(objectGroup.RootPart.LocalId), - objectGroup.GetPartDescription(objectGroup.RootPart.LocalId), - (sbyte)AssetType.Object, - Utils.StringToBytes(sceneObjectXml), - objectGroup.OwnerID.ToString()); - m_Scene.AssetService.Store(asset); - assetID = asset.FullID; + item = new InventoryItemBase(); + // Can't know creator is the same, so null it in inventory + if (objlist.Count > 1) + item.CreatorId = UUID.Zero.ToString(); + else + item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); + item.ID = UUID.Random(); + item.InvType = (int)InventoryType.Object; + item.Folder = folder.ID; + item.Owner = userID; + if (objlist.Count > 1) + item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; + } - if (DeRezAction.SaveToExistingUserInventoryItem == action) - { - item.AssetID = asset.FullID; - m_Scene.InventoryService.UpdateItem(item); - } - else - { - item.AssetID = asset.FullID; + AssetBase asset = CreateAsset( + objlist[0].GetPartName(objlist[0].RootPart.LocalId), + objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), + (sbyte)AssetType.Object, + Utils.StringToBytes(itemXml), + objlist[0].OwnerID.ToString()); + m_Scene.AssetService.Store(asset); + assetID = asset.FullID; - if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) + if (DeRezAction.SaveToExistingUserInventoryItem == action) { - uint perms = objectGroup.GetEffectivePermissions(); - uint nextPerms = (perms & 7) << 13; - if ((nextPerms & (uint)PermissionMask.Copy) == 0) - perms &= ~(uint)PermissionMask.Copy; - if ((nextPerms & (uint)PermissionMask.Transfer) == 0) - perms &= ~(uint)PermissionMask.Transfer; - if ((nextPerms & (uint)PermissionMask.Modify) == 0) - perms &= ~(uint)PermissionMask.Modify; - - // Make sure all bits but the ones we want are clear - // on take. - // This will be applied to the current perms, so - // it will do what we want. - objectGroup.RootPart.NextOwnerMask &= - ((uint)PermissionMask.Copy | - (uint)PermissionMask.Transfer | - (uint)PermissionMask.Modify); - objectGroup.RootPart.NextOwnerMask |= - (uint)PermissionMask.Move; - - item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; - item.CurrentPermissions = item.BasePermissions; - item.NextPermissions = objectGroup.RootPart.NextOwnerMask; - item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; - item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; - - item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; + item.AssetID = asset.FullID; + m_Scene.InventoryService.UpdateItem(item); } else { - item.BasePermissions = objectGroup.GetEffectivePermissions(); - item.CurrentPermissions = objectGroup.GetEffectivePermissions(); - item.NextPermissions = objectGroup.RootPart.NextOwnerMask; - item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; - item.GroupPermissions = objectGroup.RootPart.GroupMask; + item.AssetID = asset.FullID; - item.CurrentPermissions &= - ((uint)PermissionMask.Copy | - (uint)PermissionMask.Transfer | - (uint)PermissionMask.Modify | - (uint)PermissionMask.Move | - 7); // Preserve folded permissions - } + uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; + foreach (SceneObjectGroup grp in objlist) + effectivePerms &= grp.GetEffectivePermissions(); + effectivePerms |= (uint)PermissionMask.Move; - // TODO: add the new fields (Flags, Sale info, etc) - item.CreationDate = Util.UnixTimeSinceEpoch(); - item.Description = asset.Description; - item.Name = asset.Name; - item.AssetType = asset.Type; + if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) + { + uint perms = effectivePerms; + uint nextPerms = (perms & 7) << 13; + if ((nextPerms & (uint)PermissionMask.Copy) == 0) + perms &= ~(uint)PermissionMask.Copy; + if ((nextPerms & (uint)PermissionMask.Transfer) == 0) + perms &= ~(uint)PermissionMask.Transfer; + if ((nextPerms & (uint)PermissionMask.Modify) == 0) + perms &= ~(uint)PermissionMask.Modify; + + item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask; + item.CurrentPermissions = item.BasePermissions; + item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask; + item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask; + item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask; + + // Magic number badness. Maybe this deserves an enum. + // bit 4 (16) is the "Slam" bit, it means treat as passed + // and apply next owner perms on rez + item.CurrentPermissions |= 16; // Slam! + } + else + { + item.BasePermissions = effectivePerms; + item.CurrentPermissions = effectivePerms; + item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms; + item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms; + item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms; + + item.CurrentPermissions &= + ((uint)PermissionMask.Copy | + (uint)PermissionMask.Transfer | + (uint)PermissionMask.Modify | + (uint)PermissionMask.Move | + 7); // Preserve folded permissions + } - m_Scene.AddInventoryItem(item); + // TODO: add the new fields (Flags, Sale info, etc) + item.CreationDate = Util.UnixTimeSinceEpoch(); + item.Description = asset.Description; + item.Name = asset.Name; + item.AssetType = asset.Type; - if (remoteClient != null && item.Owner == remoteClient.AgentId) - { - remoteClient.SendInventoryItemCreateUpdate(item, 0); - } - else - { - ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); - if (notifyUser != null) + m_Scene.AddInventoryItem(item); + + if (remoteClient != null && item.Owner == remoteClient.AgentId) { - notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); + remoteClient.SendInventoryItemCreateUpdate(item, 0); + } + else + { + ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); + if (notifyUser != null) + { + notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); + } } } } - return assetID; } diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index 64567db..8feb022 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs @@ -137,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes x = m_inventoryDeletes.Dequeue(); m_log.DebugFormat( - "[ASYNC DELETER]: Sending object to user's inventory, {0} item(s) remaining.", left); + "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.", left, x.action, x.objectGroups.Count); try { @@ -177,4 +177,4 @@ namespace OpenSim.Region.Framework.Scenes return false; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 353b7c2..35a798e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4865,8 +4865,17 @@ namespace OpenSim.Region.Framework.Scenes { float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; + Vector3 vec = g.AbsolutePosition; + g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); + ominX += vec.X; + omaxX += vec.X; + ominY += vec.Y; + omaxY += vec.Y; + ominZ += vec.Z; + omaxZ += vec.Z; + if (minX > ominX) minX = ominX; if (minY > ominY) -- cgit v1.1 From a4b3439025f7ae8cf3a795f540675714d6324122 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 7 Oct 2010 05:12:39 +0200 Subject: Implement rezzing coalesced objects --- .../InventoryAccess/InventoryAccessModule.cs | 277 +++++++++++++-------- 1 file changed, 172 insertions(+), 105 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 88dff02..a7d59c7 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -458,7 +458,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess item.Folder = folder.ID; item.Owner = userID; if (objlist.Count > 1) + { item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; + } + else + { + item.SaleType = objlist[0].RootPart.ObjectSaleType; + item.SalePrice = objlist[0].RootPart.SalePrice; + } } AssetBase asset = CreateAsset( @@ -522,7 +529,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess 7); // Preserve folded permissions } - // TODO: add the new fields (Flags, Sale info, etc) item.CreationDate = Util.UnixTimeSinceEpoch(); item.Description = asset.Description; item.Name = asset.Name; @@ -598,6 +604,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); + SceneObjectGroup group = null; + if (rezAsset != null) { UUID itemId = UUID.Zero; @@ -606,34 +614,78 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // item that it came from. This allows us to enable 'save object to inventory' if (!m_Scene.Permissions.BypassPermissions()) { - if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy) + if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy && (item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) { itemId = item.ID; } } else { - // Brave new fullperm world - // - itemId = item.ID; + if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) + { + // Brave new fullperm world + itemId = item.ID; + } } string xmlData = Utils.BytesToString(rezAsset.Data); - SceneObjectGroup group - = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); + List objlist = + new List(); + List veclist = new List(); + + XmlDocument doc = new XmlDocument(); + doc.LoadXml(xmlData); + XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); + if (e == null || attachment) // Single + { + SceneObjectGroup g = + SceneObjectSerializer.FromOriginalXmlFormat( + itemId, xmlData); + objlist.Add(g); + veclist.Add(new Vector3(0, 0, 0)); - Util.FireAndForget(delegate { AddUserData(group); }); - - group.RootPart.FromFolderID = item.Folder; + float offsetHeight = 0; + pos = m_Scene.GetNewRezLocation( + RayStart, RayEnd, RayTargetID, Quaternion.Identity, + BypassRayCast, bRayEndIsIntersection, true, g.GetAxisAlignedBoundingBox(out offsetHeight), false); + pos.Z += offsetHeight; + } + else + { + XmlElement coll = (XmlElement)e; + float bx = Convert.ToSingle(coll.GetAttribute("x")); + float by = Convert.ToSingle(coll.GetAttribute("y")); + float bz = Convert.ToSingle(coll.GetAttribute("z")); + Vector3 bbox = new Vector3(bx, by, bz); - // If it's rezzed in world, select it. Much easier to - // find small items. - // - if (!attachment) - group.RootPart.CreateSelected = true; + pos = m_Scene.GetNewRezLocation(RayStart, RayEnd, + RayTargetID, Quaternion.Identity, + BypassRayCast, bRayEndIsIntersection, true, + bbox, false); + + pos -= bbox / 2; + + XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); + foreach (XmlNode n in groups) + { + SceneObjectGroup g = + SceneObjectSerializer.FromOriginalXmlFormat( + itemId, n.OuterXml); + objlist.Add(g); + XmlElement el = (XmlElement)n; + float x = Convert.ToSingle(el.GetAttribute("offsetx")); + float y = Convert.ToSingle(el.GetAttribute("offsety")); + float z = Convert.ToSingle(el.GetAttribute("offsetz")); + veclist.Add(new Vector3(x, y, z)); + } + } + + int primcount = 0; + foreach (SceneObjectGroup g in objlist) + primcount += g.PrimCount; if (!m_Scene.Permissions.CanRezObject( - group.PrimCount, remoteClient.AgentId, pos) + primcount, remoteClient.AgentId, pos) && !attachment) { // The client operates in no fail mode. It will @@ -646,121 +698,137 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return null; } - group.ResetIDs(); - - if (attachment) + for (int i = 0 ; i < objlist.Count ; i++ ) { - group.RootPart.Flags |= PrimFlags.Phantom; - group.RootPart.IsAttachment = true; + group = objlist[i]; + + Vector3 storedPosition = group.AbsolutePosition; + if (group.UUID == UUID.Zero) + { + m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 3"); + } + group.RootPart.FromFolderID = item.Folder; + + // If it's rezzed in world, select it. Much easier to + // find small items. + // + if (!attachment) + { + group.RootPart.CreateSelected = true; + foreach (SceneObjectPart child in group.Parts) + child.CreateSelected = true; + } + group.ResetIDs(); + + if (attachment) + { + group.RootPart.Flags |= PrimFlags.Phantom; + group.RootPart.IsAttachment = true; + } // If we're rezzing an attachment then don't ask // AddNewSceneObject() to update the client since - // we'll be doing that later on. Scheduling more - // than one full update during the attachment - // process causes some clients to fail to display - // the attachment properly. - // Also, don't persist attachments. - m_Scene.AddNewSceneObject(group, false, false); - } - else - { + // we'll be doing that later on. Scheduling more than + // one full update during the attachment + // process causes some clients to fail to display the + // attachment properly. m_Scene.AddNewSceneObject(group, true, false); - } - // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); - // if attachment we set it's asset id so object updates can reflect that - // if not, we set it's position in world. - if (!attachment) - { - group.ScheduleGroupForFullUpdate(); - - float offsetHeight = 0; - pos = m_Scene.GetNewRezLocation( - RayStart, RayEnd, RayTargetID, Quaternion.Identity, - BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(out offsetHeight), false); - pos.Z += offsetHeight; - group.AbsolutePosition = pos; - // m_log.InfoFormat("rezx point for inventory rezz is {0} {1} {2} and offsetheight was {3}", pos.X, pos.Y, pos.Z, offsetHeight); - - } - else - { - group.SetFromItemID(itemID); - } + // if attachment we set it's asset id so object updates + // can reflect that, if not, we set it's position in world. + if (!attachment) + { + group.ScheduleGroupForFullUpdate(); + + group.AbsolutePosition = pos + veclist[i]; + } + else + { + group.SetFromItemID(itemID); + } - SceneObjectPart rootPart = null; - try - { - rootPart = group.GetChildPart(group.UUID); - } - catch (NullReferenceException) - { - string isAttachment = ""; + SceneObjectPart rootPart = null; - if (attachment) - isAttachment = " Object was an attachment"; + try + { + rootPart = group.GetChildPart(group.UUID); + } + catch (NullReferenceException) + { + string isAttachment = ""; - m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); - } + if (attachment) + isAttachment = " Object was an attachment"; - // Since renaming the item in the inventory does not affect the name stored - // in the serialization, transfer the correct name from the inventory to the - // object itself before we rez. - rootPart.Name = item.Name; - rootPart.Description = item.Description; + m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); + } - if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0) - { + // Since renaming the item in the inventory does not + // affect the name stored in the serialization, transfer + // the correct name from the inventory to the + // object itself before we rez. + rootPart.Name = item.Name; + rootPart.Description = item.Description; rootPart.ObjectSaleType = item.SaleType; rootPart.SalePrice = item.SalePrice; - } - group.SetGroup(remoteClient.ActiveGroupId, remoteClient); - if ((rootPart.OwnerID != item.Owner) || - (item.CurrentPermissions & 16) != 0 || // Magic number - (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) - { - //Need to kill the for sale here - rootPart.ObjectSaleType = 0; - rootPart.SalePrice = 10; - - if (m_Scene.Permissions.PropagatePermissions()) + group.SetGroup(remoteClient.ActiveGroupId, remoteClient); + if ((rootPart.OwnerID != item.Owner) || + (item.CurrentPermissions & 16) != 0) { - foreach (SceneObjectPart part in group.Parts) + //Need to kill the for sale here + rootPart.ObjectSaleType = 0; + rootPart.SalePrice = 10; + + if (m_Scene.Permissions.PropagatePermissions()) { - if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) - part.EveryoneMask = item.EveryOnePermissions; - if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) - part.NextOwnerMask = item.NextPermissions; - if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) - part.GroupMask = item.GroupPermissions; + foreach (SceneObjectPart part in group.Parts) + { + if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) + { + part.EveryoneMask = item.EveryOnePermissions; + part.NextOwnerMask = item.NextPermissions; + } + part.GroupMask = 0; // DO NOT propagate here + } + + group.ApplyNextOwnerPermissions(); } + } - foreach (SceneObjectPart part in group.Parts) + foreach (SceneObjectPart part in group.Parts) + { + if ((part.OwnerID != item.Owner) || + (item.CurrentPermissions & 16) != 0) { part.LastOwnerID = part.OwnerID; part.OwnerID = item.Owner; part.Inventory.ChangeInventoryOwner(item.Owner); + part.GroupMask = 0; // DO NOT propagate here } - - group.ApplyNextOwnerPermissions(); + part.EveryoneMask = item.EveryOnePermissions; + part.NextOwnerMask = item.NextPermissions; } - } - rootPart.TrimPermissions(); + rootPart.TrimPermissions(); - if (!attachment) - { - if (group.RootPart.Shape.PCode == (byte)PCode.Prim) + if (!attachment) { - group.ClearPartAttachmentData(); - } - - // Fire on_rez - group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); - rootPart.ParentGroup.ResumeScripts(); + if (group.RootPart.Shape.PCode == (byte)PCode.Prim) + { + // Save attachment data + group.RootPart.AttachPoint = group.RootPart.Shape.State; + group.RootPart.AttachOffset = storedPosition; - rootPart.ScheduleFullUpdate(); + group.ClearPartAttachmentData(); + } + + // Fire on_rez + group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); + rootPart.ParentGroup.ResumeScripts(); + + rootPart.ScheduleFullUpdate(); + } } if (!m_Scene.Permissions.BypassPermissions()) @@ -778,9 +846,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } } } - - return rootPart.ParentGroup; } + return group; } return null; -- cgit v1.1 From adb14ad20acce44cb4b269b0d518b210f9f5eae4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 7 Oct 2010 05:12:39 +0200 Subject: Implement rezzing coalesced objects --- .../Framework/InventoryAccess/InventoryAccessModule.cs | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index a7d59c7..9fbfc34 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -247,11 +247,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess Vector3 originalPosition = objectGroup.AbsolutePosition; - // Restore attachment data after trip through the sim - if (objectGroup.RootPart.AttachPoint > 0) - inventoryStoredPosition = objectGroup.RootPart.AttachOffset; - objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; - objectGroup.AbsolutePosition = inventoryStoredPosition; // Make sure all bits but the ones we want are clear @@ -815,13 +810,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (!attachment) { if (group.RootPart.Shape.PCode == (byte)PCode.Prim) - { - // Save attachment data - group.RootPart.AttachPoint = group.RootPart.Shape.State; - group.RootPart.AttachOffset = storedPosition; - group.ClearPartAttachmentData(); - } // Fire on_rez group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); -- cgit v1.1 From 6885b7220c6f782034d7c0220762244adf00e3d3 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 28 Mar 2011 10:00:53 -0700 Subject: Implements adaptive queue management and fair queueing for improved networking performance. Reprioritization algorithms need to be ported still. One is in place. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 353 ++++++++++++++------- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 71 ++++- 2 files changed, 304 insertions(+), 120 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2faffae..e9e1fa3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -49,6 +49,8 @@ using Timer = System.Timers.Timer; using AssetLandmark = OpenSim.Framework.AssetLandmark; using Nini.Config; +using System.IO; + namespace OpenSim.Region.ClientStack.LindenUDP { public delegate bool PacketMethod(IClientAPI simClient, Packet packet); @@ -298,6 +300,77 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Used to adjust Sun Orbit values so Linden based viewers properly position sun private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f; + // First log file or time has expired, start writing to a new log file +// +// ----------------------------------------------------------------- +// ----------------------------------------------------------------- +// THIS IS DEBUGGING CODE & SHOULD BE REMOVED +// ----------------------------------------------------------------- +// ----------------------------------------------------------------- + public class QueueLogger + { + public Int32 start = 0; + public StreamWriter Log = null; + private Dictionary m_idMap = new Dictionary(); + + public QueueLogger() + { + DateTime now = DateTime.Now; + String fname = String.Format("queue-{0}.log", now.ToString("yyyyMMddHHmmss")); + Log = new StreamWriter(fname); + + start = Util.EnvironmentTickCount(); + } + + public int LookupID(UUID uuid) + { + int localid; + if (! m_idMap.TryGetValue(uuid,out localid)) + { + localid = m_idMap.Count + 1; + m_idMap[uuid] = localid; + } + + return localid; + } + } + + public static QueueLogger QueueLog = null; + + // ----------------------------------------------------------------- + public void LogAvatarUpdateEvent(UUID client, UUID avatar, Int32 timeinqueue) + { + if (QueueLog == null) + QueueLog = new QueueLogger(); + + Int32 ticks = Util.EnvironmentTickCountSubtract(QueueLog.start); + lock(QueueLog) + { + int cid = QueueLog.LookupID(client); + int aid = QueueLog.LookupID(avatar); + QueueLog.Log.WriteLine("{0},AU,AV{1:D4},AV{2:D4},{3}",ticks,cid,aid,timeinqueue); + } + } + + // ----------------------------------------------------------------- + public void LogQueueProcessEvent(UUID client, PriorityQueue queue, uint maxup) + { + if (QueueLog == null) + QueueLog = new QueueLogger(); + + Int32 ticks = Util.EnvironmentTickCountSubtract(QueueLog.start); + lock(QueueLog) + { + int cid = QueueLog.LookupID(client); + QueueLog.Log.WriteLine("{0},PQ,AV{1:D4},{2},{3}",ticks,cid,maxup,queue.ToString()); + } + } +// ----------------------------------------------------------------- +// ----------------------------------------------------------------- +// ----------------------------------------------------------------- +// ----------------------------------------------------------------- +// + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected static Dictionary PacketHandlers = new Dictionary(); //Global/static handlers for all clients @@ -3547,18 +3620,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Primitive Packet/Data Sending Methods + /// /// Generate one of the object update packets based on PrimUpdateFlags /// and broadcast the packet to clients /// public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) { - double priority = m_prioritizer.GetUpdatePriority(this, entity); + //double priority = m_prioritizer.GetUpdatePriority(this, entity); + uint priority = m_prioritizer.GetUpdatePriority(this, entity); lock (m_entityUpdates.SyncRoot) - m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation), entity.LocalId); + m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); } + private Int32 m_LastQueueFill = 0; + private uint m_maxUpdates = 0; + private void ProcessEntityUpdates(int maxUpdates) { OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); @@ -3566,23 +3644,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP OpenSim.Framework.Lazy> terseUpdateBlocks = new OpenSim.Framework.Lazy>(); OpenSim.Framework.Lazy> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy>(); - if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; + if (maxUpdates <= 0) + { + m_maxUpdates = Int32.MaxValue; + } + else + { + if (m_maxUpdates == 0 || m_LastQueueFill == 0) + { + m_maxUpdates = (uint)maxUpdates; + } + else + { + if (Util.EnvironmentTickCountSubtract(m_LastQueueFill) < 200) + m_maxUpdates += 5; + else + m_maxUpdates = m_maxUpdates >> 1; + } + m_maxUpdates = Util.Clamp(m_maxUpdates,10,500); + } + m_LastQueueFill = Util.EnvironmentTickCount(); + int updatesThisCall = 0; +// +// DEBUGGING CODE... REMOVE +// LogQueueProcessEvent(this.m_agentId,m_entityUpdates,m_maxUpdates); +// // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race // condition where a kill can be processed before an out-of-date update for the same object. lock (m_killRecord) { float avgTimeDilation = 1.0f; EntityUpdate update; - while (updatesThisCall < maxUpdates) + Int32 timeinqueue; // this is just debugging code & can be dropped later + + while (updatesThisCall < m_maxUpdates) { lock (m_entityUpdates.SyncRoot) - if (!m_entityUpdates.TryDequeue(out update)) + if (!m_entityUpdates.TryDequeue(out update, out timeinqueue)) break; avgTimeDilation += update.TimeDilation; avgTimeDilation *= 0.5f; +// +// DEBUGGING CODE... REMOVE +// if (update.Entity is ScenePresence) +// LogAvatarUpdateEvent(this.m_agentId,update.Entity.UUID,timeinqueue); +// + if (update.Entity is SceneObjectPart) { SceneObjectPart part = (SceneObjectPart)update.Entity; @@ -3679,36 +3789,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - // if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment) - // { - // SceneObjectPart sop = (SceneObjectPart)update.Entity; - // string text = sop.Text; - // if (text.IndexOf("\n") >= 0) - // text = text.Remove(text.IndexOf("\n")); - // - // if (m_attachmentsSent.Contains(sop.ParentID)) - // { - //// m_log.DebugFormat( - //// "[CLIENT]: Sending full info about attached prim {0} text {1}", - //// sop.LocalId, text); - // - // objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId)); - // - // m_attachmentsSent.Add(sop.LocalId); - // } - // else - // { - // m_log.DebugFormat( - // "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", - // sop.LocalId, text, sop.ParentID); - // - // m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); - // } - // } - // else - // { - objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); - // } + objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); } } else if (!canUseImproved) @@ -3802,26 +3883,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void ReprioritizeUpdates() { - //m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName); - lock (m_entityUpdates.SyncRoot) m_entityUpdates.Reprioritize(UpdatePriorityHandler); } - private bool UpdatePriorityHandler(ref double priority, uint localID) + private bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity) { - EntityBase entity; - if (m_scene.Entities.TryGetValue(localID, out entity)) + if (entity != null) { priority = m_prioritizer.GetUpdatePriority(this, entity); + return true; } - return priority != double.NaN; + return false; } public void FlushPrimUpdates() { - m_log.Debug("[CLIENT]: Flushing prim updates to " + m_firstName + " " + m_lastName); + m_log.WarnFormat("[CLIENT]: Flushing prim updates to " + m_firstName + " " + m_lastName); while (m_entityUpdates.Count > 0) ProcessEntityUpdates(-1); @@ -11713,86 +11792,85 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region PriorityQueue public class PriorityQueue { - internal delegate bool UpdatePriorityHandler(ref double priority, uint local_id); + internal delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity); + + // Heap[0] for self updates + // Heap[1..12] for entity updates - private MinHeap[] m_heaps = new MinHeap[1]; + internal const uint m_numberOfQueues = 12; + private MinHeap[] m_heaps = new MinHeap[m_numberOfQueues]; private Dictionary m_lookupTable; - private Comparison m_comparison; private object m_syncRoot = new object(); - + private uint m_nextQueue = 0; + private UInt64 m_nextRequest = 0; + internal PriorityQueue() : - this(MinHeap.DEFAULT_CAPACITY, Comparer.Default) { } - internal PriorityQueue(int capacity) : - this(capacity, Comparer.Default) { } - internal PriorityQueue(IComparer comparer) : - this(new Comparison(comparer.Compare)) { } - internal PriorityQueue(Comparison comparison) : - this(MinHeap.DEFAULT_CAPACITY, comparison) { } - internal PriorityQueue(int capacity, IComparer comparer) : - this(capacity, new Comparison(comparer.Compare)) { } - internal PriorityQueue(int capacity, Comparison comparison) + this(MinHeap.DEFAULT_CAPACITY) { } + internal PriorityQueue(int capacity) { m_lookupTable = new Dictionary(capacity); for (int i = 0; i < m_heaps.Length; ++i) m_heaps[i] = new MinHeap(capacity); - this.m_comparison = comparison; } public object SyncRoot { get { return this.m_syncRoot; } } + internal int Count { get { int count = 0; for (int i = 0; i < m_heaps.Length; ++i) - count = m_heaps[i].Count; + count += m_heaps[i].Count; return count; } } - public bool Enqueue(double priority, EntityUpdate value, uint local_id) + public bool Enqueue(uint pqueue, EntityUpdate value) { - LookupItem item; + LookupItem lookup; - if (m_lookupTable.TryGetValue(local_id, out item)) + uint localid = value.Entity.LocalId; + UInt64 entry = m_nextRequest++; + if (m_lookupTable.TryGetValue(localid, out lookup)) { - // Combine flags - value.Flags |= item.Heap[item.Handle].Value.Flags; - - item.Heap[item.Handle] = new MinHeapItem(priority, value, local_id, this.m_comparison); - return false; - } - else - { - item.Heap = m_heaps[0]; - item.Heap.Add(new MinHeapItem(priority, value, local_id, this.m_comparison), ref item.Handle); - m_lookupTable.Add(local_id, item); - return true; + entry = lookup.Heap[lookup.Handle].EntryOrder; + value.Flags |= lookup.Heap[lookup.Handle].Value.Flags; + lookup.Heap.Remove(lookup.Handle); } - } - internal EntityUpdate Peek() - { - for (int i = 0; i < m_heaps.Length; ++i) - if (m_heaps[i].Count > 0) - return m_heaps[i].Min().Value; - throw new InvalidOperationException(string.Format("The {0} is empty", this.GetType().ToString())); + pqueue = Util.Clamp(pqueue, 0, m_numberOfQueues - 1); + lookup.Heap = m_heaps[pqueue]; + lookup.Heap.Add(new MinHeapItem(pqueue, entry, value), ref lookup.Handle); + m_lookupTable[localid] = lookup; + + return true; } - internal bool TryDequeue(out EntityUpdate value) + internal bool TryDequeue(out EntityUpdate value, out Int32 timeinqueue) { - for (int i = 0; i < m_heaps.Length; ++i) + for (int i = 0; i < m_numberOfQueues; ++i) { - if (m_heaps[i].Count > 0) + // To get the fair queing, we cycle through each of the + // queues when finding an element to dequeue, this code + // assumes that the distribution of updates in the queues + // is polynomial, probably quadractic (eg distance of PI * R^2) + uint h = (uint)((m_nextQueue + i) % m_numberOfQueues); + if (m_heaps[h].Count > 0) { - MinHeapItem item = m_heaps[i].RemoveMin(); - m_lookupTable.Remove(item.LocalID); + m_nextQueue = (uint)((h + 1) % m_numberOfQueues); + + MinHeapItem item = m_heaps[h].RemoveMin(); + m_lookupTable.Remove(item.Value.Entity.LocalId); + timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); value = item.Value; + return true; } } + timeinqueue = 0; value = default(EntityUpdate); return false; } @@ -11800,68 +11878,107 @@ namespace OpenSim.Region.ClientStack.LindenUDP internal void Reprioritize(UpdatePriorityHandler handler) { MinHeapItem item; - double priority; - foreach (LookupItem lookup in new List(this.m_lookupTable.Values)) { if (lookup.Heap.TryGetValue(lookup.Handle, out item)) { - priority = item.Priority; - if (handler(ref priority, item.LocalID)) + uint pqueue = item.PriorityQueue; + uint localid = item.Value.Entity.LocalId; + + if (handler(ref pqueue, item.Value.Entity)) { - if (lookup.Heap.ContainsHandle(lookup.Handle)) - lookup.Heap[lookup.Handle] = - new MinHeapItem(priority, item.Value, item.LocalID, this.m_comparison); + // unless the priority queue has changed, there is no need to modify + // the entry + pqueue = Util.Clamp(pqueue, 0, m_numberOfQueues - 1); + if (pqueue != item.PriorityQueue) + { + lookup.Heap.Remove(lookup.Handle); + + LookupItem litem = lookup; + litem.Heap = m_heaps[pqueue]; + litem.Heap.Add(new MinHeapItem(pqueue, item), ref litem.Handle); + m_lookupTable[localid] = litem; + } } else { - m_log.Warn("[LLCLIENTVIEW]: UpdatePriorityHandler returned false, dropping update"); + m_log.WarnFormat("[LLCLIENTVIEW]: UpdatePriorityHandler returned false for {0}",item.Value.Entity.UUID); lookup.Heap.Remove(lookup.Handle); - this.m_lookupTable.Remove(item.LocalID); + this.m_lookupTable.Remove(localid); } } } } + public override string ToString() + { + string s = ""; + for (int i = 0; i < m_numberOfQueues; i++) + { + if (s != "") s += ","; + s += m_heaps[i].Count.ToString(); + } + return s; + } + #region MinHeapItem private struct MinHeapItem : IComparable { - private double priority; private EntityUpdate value; - private uint local_id; - private Comparison comparison; + internal EntityUpdate Value { + get { + return this.value; + } + } + + private uint pqueue; + internal uint PriorityQueue { + get { + return this.pqueue; + } + } - internal MinHeapItem(double priority, EntityUpdate value, uint local_id) : - this(priority, value, local_id, Comparer.Default) { } - internal MinHeapItem(double priority, EntityUpdate value, uint local_id, IComparer comparer) : - this(priority, value, local_id, new Comparison(comparer.Compare)) { } - internal MinHeapItem(double priority, EntityUpdate value, uint local_id, Comparison comparison) + private Int32 entrytime; + internal Int32 EntryTime { + get { + return this.entrytime; + } + } + + private UInt64 entryorder; + internal UInt64 EntryOrder { - this.priority = priority; + get { + return this.entryorder; + } + } + + internal MinHeapItem(uint pqueue, MinHeapItem other) + { + this.entrytime = other.entrytime; + this.entryorder = other.entryorder; + this.value = other.value; + this.pqueue = pqueue; + } + + internal MinHeapItem(uint pqueue, UInt64 entryorder, EntityUpdate value) + { + this.entrytime = Util.EnvironmentTickCount(); + this.entryorder = entryorder; this.value = value; - this.local_id = local_id; - this.comparison = comparison; + this.pqueue = pqueue; } - internal double Priority { get { return this.priority; } } - internal EntityUpdate Value { get { return this.value; } } - internal uint LocalID { get { return this.local_id; } } - public override string ToString() { - StringBuilder sb = new StringBuilder(); - sb.Append("["); - sb.Append(this.priority.ToString()); - sb.Append(","); - if (this.value != null) - sb.Append(this.value.ToString()); - sb.Append("]"); - return sb.ToString(); + return String.Format("[{0},{1},{2}]",pqueue,entryorder,value.Entity.LocalId); } public int CompareTo(MinHeapItem other) { - return this.comparison(this.priority, other.priority); + // I'm assuming that the root part of an SOG is added to the update queue + // before the component parts + return Comparer.Default.Compare(this.EntryOrder, other.EntryOrder); } } #endregion diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index f9599f5..2764b05 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Scenes public class Prioritizer { -// private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); /// /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the @@ -76,7 +76,74 @@ namespace OpenSim.Region.Framework.Scenes m_scene = scene; } - public double GetUpdatePriority(IClientAPI client, ISceneEntity entity) +// + public uint GetUpdatePriority(IClientAPI client, ISceneEntity entity) + { + if (entity == null) + { + m_log.WarnFormat("[PRIORITIZER] attempt to prioritize null entity"); + throw new InvalidOperationException("Prioritization entity not defined"); + } + + // If this is an update for our own avatar give it the highest priority + if (client.AgentId == entity.UUID) + return 0; + + // Get this agent's position + ScenePresence presence = m_scene.GetScenePresence(client.AgentId); + if (presence == null) + { + m_log.WarnFormat("[PRIORITIZER] attempt to prioritize agent no longer in the scene"); + throw new InvalidOperationException("Prioritization agent not defined"); + } + + // Use group position for child prims + Vector3 entityPos = entity.AbsolutePosition; + if (entity is SceneObjectPart) + { + SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; + if (group != null) + entityPos = group.AbsolutePosition; + } + + // Use the camera position for local agents and avatar position for remote agents + Vector3 presencePos = (presence.IsChildAgent) ? + presence.AbsolutePosition : + presence.CameraPosition; + + // Compute the distance... + double distance = Vector3.Distance(presencePos, entityPos); + + // And convert the distance to a priority queue, this computation gives queues + // at 10, 20, 40, 80, 160, 320, 640, and 1280m + uint pqueue = 1; + for (int i = 0; i < 8; i++) + { + if (distance < 10 * Math.Pow(2.0,i)) + break; + pqueue++; + } + + // If this is a root agent, then determine front & back + // Bump up the priority queue for any objects behind the avatar + if (! presence.IsChildAgent) + { + // Root agent, decrease priority for objects behind us + Vector3 camPosition = presence.CameraPosition; + Vector3 camAtAxis = presence.CameraAtAxis; + + // Plane equation + float d = -Vector3.Dot(camPosition, camAtAxis); + float p = Vector3.Dot(camAtAxis, entityPos) + d; + if (p < 0.0f) + pqueue++; + } + + return pqueue; + } +// + + public double bGetUpdatePriority(IClientAPI client, ISceneEntity entity) { double priority = 0; -- cgit v1.1 From 15c4bbea59066c5d5ed3d76d253a096788ac295a Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 4 Apr 2011 13:19:45 -0700 Subject: Fixed the prioritizer functions for the new priority queues --- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 292 +++++++------------------ 1 file changed, 82 insertions(+), 210 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 2764b05..a14bb70 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -60,15 +60,6 @@ namespace OpenSim.Region.Framework.Scenes { private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - /// - /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the - /// viewer before child prim updates. - /// The adjustment is added to child prims and subtracted from root prims, so the gap ends up - /// being double. We do it both ways so that there is a still a priority delta even if the priority is already - /// double.MinValue or double.MaxValue. - /// - private double m_childPrimAdjustmentFactor = 0.05; - private Scene m_scene; public Prioritizer(Scene scene) @@ -76,9 +67,19 @@ namespace OpenSim.Region.Framework.Scenes m_scene = scene; } -// + /// + /// Returns the priority queue into which the update should be placed. Updates within a + /// queue will be processed in arrival order. There are currently 12 priority queues + /// implemented in PriorityQueue class in LLClientView. Queue 0 is generally retained + /// for avatar updates. The fair queuing discipline for processing the priority queues + /// assumes that the number of entities in each priority queues increases exponentially. + /// So for example... if queue 1 contains all updates within 10m of the avatar or camera + /// then queue 2 at 20m is about 3X bigger in space & about 3X bigger in total number + /// of updates. + /// public uint GetUpdatePriority(IClientAPI client, ISceneEntity entity) { + // If entity is null we have a serious problem if (entity == null) { m_log.WarnFormat("[PRIORITIZER] attempt to prioritize null entity"); @@ -89,71 +90,12 @@ namespace OpenSim.Region.Framework.Scenes if (client.AgentId == entity.UUID) return 0; - // Get this agent's position - ScenePresence presence = m_scene.GetScenePresence(client.AgentId); - if (presence == null) - { - m_log.WarnFormat("[PRIORITIZER] attempt to prioritize agent no longer in the scene"); - throw new InvalidOperationException("Prioritization agent not defined"); - } - - // Use group position for child prims - Vector3 entityPos = entity.AbsolutePosition; - if (entity is SceneObjectPart) - { - SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; - if (group != null) - entityPos = group.AbsolutePosition; - } - - // Use the camera position for local agents and avatar position for remote agents - Vector3 presencePos = (presence.IsChildAgent) ? - presence.AbsolutePosition : - presence.CameraPosition; - - // Compute the distance... - double distance = Vector3.Distance(presencePos, entityPos); - - // And convert the distance to a priority queue, this computation gives queues - // at 10, 20, 40, 80, 160, 320, 640, and 1280m - uint pqueue = 1; - for (int i = 0; i < 8; i++) - { - if (distance < 10 * Math.Pow(2.0,i)) - break; - pqueue++; - } - - // If this is a root agent, then determine front & back - // Bump up the priority queue for any objects behind the avatar - if (! presence.IsChildAgent) - { - // Root agent, decrease priority for objects behind us - Vector3 camPosition = presence.CameraPosition; - Vector3 camAtAxis = presence.CameraAtAxis; - - // Plane equation - float d = -Vector3.Dot(camPosition, camAtAxis); - float p = Vector3.Dot(camAtAxis, entityPos) + d; - if (p < 0.0f) - pqueue++; - } - - return pqueue; - } -// - - public double bGetUpdatePriority(IClientAPI client, ISceneEntity entity) - { - double priority = 0; - - if (entity == null) - return 100000; + uint priority; switch (m_scene.UpdatePrioritizationScheme) { case UpdatePrioritizationSchemes.Time: - priority = GetPriorityByTime(); + priority = GetPriorityByTime(client, entity); break; case UpdatePrioritizationSchemes.Distance: priority = GetPriorityByDistance(client, entity); @@ -171,180 +113,110 @@ namespace OpenSim.Region.Framework.Scenes throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); } - // Adjust priority so that root prims are sent to the viewer first. This is especially important for - // attachments acting as huds, since current viewers fail to display hud child prims if their updates - // arrive before the root one. - if (entity is SceneObjectPart) - { - SceneObjectPart sop = ((SceneObjectPart)entity); - - if (sop.IsRoot) - { - if (priority >= double.MinValue + m_childPrimAdjustmentFactor) - priority -= m_childPrimAdjustmentFactor; - } - else - { - if (priority <= double.MaxValue - m_childPrimAdjustmentFactor) - priority += m_childPrimAdjustmentFactor; - } - } - return priority; } - private double GetPriorityByTime() + + private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) { - return DateTime.UtcNow.ToOADate(); + return 1; } - private double GetPriorityByDistance(IClientAPI client, ISceneEntity entity) + private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity) { - ScenePresence presence = m_scene.GetScenePresence(client.AgentId); - if (presence != null) - { - // If this is an update for our own avatar give it the highest priority - if (presence == entity) - return 0.0; - - // Use the camera position for local agents and avatar position for remote agents - Vector3 presencePos = (presence.IsChildAgent) ? - presence.AbsolutePosition : - presence.CameraPosition; - - // Use group position for child prims - Vector3 entityPos; - if (entity is SceneObjectPart) - { - // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene - // before its scheduled update was triggered - //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; - entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; - } - else - { - entityPos = entity.AbsolutePosition; - } - - return Vector3.DistanceSquared(presencePos, entityPos); - } - - return double.NaN; + return ComputeDistancePriority(client,entity,false); + } + + private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) + { + return ComputeDistancePriority(client,entity,true); } - private double GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) + private uint GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity) { + uint pqueue = ComputeDistancePriority(client,entity,true); + ScenePresence presence = m_scene.GetScenePresence(client.AgentId); if (presence != null) { - // If this is an update for our own avatar give it the highest priority - if (presence == entity) - return 0.0; - - // Use group position for child prims - Vector3 entityPos = entity.AbsolutePosition; - if (entity is SceneObjectPart) - { - // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene - // before its scheduled update was triggered - //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; - entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; - } - else - { - entityPos = entity.AbsolutePosition; - } - if (!presence.IsChildAgent) { - // Root agent. Use distance from camera and a priority decrease for objects behind us - Vector3 camPosition = presence.CameraPosition; - Vector3 camAtAxis = presence.CameraAtAxis; - - // Distance - double priority = Vector3.DistanceSquared(camPosition, entityPos); - - // Plane equation - float d = -Vector3.Dot(camPosition, camAtAxis); - float p = Vector3.Dot(camAtAxis, entityPos) + d; - if (p < 0.0f) priority *= 2.0; - - return priority; - } - else - { - // Child agent. Use the normal distance method - Vector3 presencePos = presence.AbsolutePosition; + if (entity is SceneObjectPart) + { + // Non physical prims are lower priority than physical prims + PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; + if (physActor == null || !physActor.IsPhysical) + pqueue++; - return Vector3.DistanceSquared(presencePos, entityPos); + // Attachments are high priority, + // MIC: shouldn't these already be in the highest priority queue already + // since their root position is same as the avatars? + if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) + pqueue = 1; + } } } - return double.NaN; + return pqueue; } - private double GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity) + private uint ComputeDistancePriority(IClientAPI client, ISceneEntity entity, bool useFrontBack) { - // If this is an update for our own avatar give it the highest priority - if (client.AgentId == entity.UUID) - return 0.0; - if (entity == null) - return double.NaN; - - // Use group position for child prims + // Get this agent's position + ScenePresence presence = m_scene.GetScenePresence(client.AgentId); + if (presence == null) + { + m_log.WarnFormat("[PRIORITIZER] attempt to prioritize agent no longer in the scene"); + throw new InvalidOperationException("Prioritization agent not defined"); + } + + // Use group position for child prims, since we are putting child prims in + // the same queue with the root of the group, the root prim (which goes into + // the queue first) should always be sent first, no need to adjust child prim + // priorities Vector3 entityPos = entity.AbsolutePosition; if (entity is SceneObjectPart) { SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; if (group != null) entityPos = group.AbsolutePosition; - else - entityPos = entity.AbsolutePosition; } - else - entityPos = entity.AbsolutePosition; - - ScenePresence presence = m_scene.GetScenePresence(client.AgentId); - if (presence != null) - { - if (!presence.IsChildAgent) - { - if (entity is ScenePresence) - return 1.0; - // Root agent. Use distance from camera and a priority decrease for objects behind us - Vector3 camPosition = presence.CameraPosition; - Vector3 camAtAxis = presence.CameraAtAxis; - - // Distance - double priority = Vector3.DistanceSquared(camPosition, entityPos); - - // Plane equation - float d = -Vector3.Dot(camPosition, camAtAxis); - float p = Vector3.Dot(camAtAxis, entityPos) + d; - if (p < 0.0f) priority *= 2.0; + // Use the camera position for local agents and avatar position for remote agents + Vector3 presencePos = (presence.IsChildAgent) ? + presence.AbsolutePosition : + presence.CameraPosition; - if (entity is SceneObjectPart) - { - PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; - if (physActor == null || !physActor.IsPhysical) - priority += 100; + // Compute the distance... + double distance = Vector3.Distance(presencePos, entityPos); - if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) - priority = 1.0; - } - return priority; - } - else - { - // Child agent. Use the normal distance method - Vector3 presencePos = presence.AbsolutePosition; + // And convert the distance to a priority queue, this computation gives queues + // at 10, 20, 40, 80, 160, 320, 640, and 1280m + uint pqueue = 1; + for (int i = 0; i < 8; i++) + { + if (distance < 10 * Math.Pow(2.0,i)) + break; + pqueue++; + } + + // If this is a root agent, then determine front & back + // Bump up the priority queue (drop the priority) for any objects behind the avatar + if (useFrontBack && ! presence.IsChildAgent) + { + // Root agent, decrease priority for objects behind us + Vector3 camPosition = presence.CameraPosition; + Vector3 camAtAxis = presence.CameraAtAxis; - return Vector3.DistanceSquared(presencePos, entityPos); - } + // Plane equation + float d = -Vector3.Dot(camPosition, camAtAxis); + float p = Vector3.Dot(camAtAxis, entityPos) + d; + if (p < 0.0f) + pqueue++; } - return double.NaN; + return pqueue; } + } } -- cgit v1.1 From 8b134f37f2c8cc7895153af2fdc79e785f3b93e2 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 4 Apr 2011 14:18:26 -0700 Subject: Fix a bug in the computation of the RTO. Basically... the RTO (the time to wait to retransmit packets) always maxed out (no retransmissions for 24 or 48 seconds. Note that this is going to cause faster (and more) retransmissions. Fix for dynamic throttling needs to go with this. --- OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 65a8fe3..9a8bfd3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -149,7 +149,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Caches packed throttle information private byte[] m_packedThrottles; - private int m_defaultRTO = 3000; + private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC private int m_maxRTO = 60000; /// @@ -557,7 +557,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR)); // Clamp the retransmission timeout to manageable values - rto = Utils.Clamp(RTO, m_defaultRTO, m_maxRTO); + rto = Utils.Clamp(rto, m_defaultRTO, m_maxRTO); RTO = rto; -- cgit v1.1 From f58941e89f122c2e1fd54a2f817fb8114e6c80ed Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Apr 2011 01:30:13 +0100 Subject: Make the "All Estates" option work from the client (this makes chosen changes to all the estates that the user owns). This applies to adding/removing estate users, groups, managers and bans. This is the application of the AllEstates_0.5.patch from http://opensimulator.org/mantis/view.php?id=5420 Thanks very much, Snoopy! --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 24 +++- .../World/Estate/EstateManagementModule.cs | 149 ++++++++++++++++++++- OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 6 +- .../Framework/Interfaces/IEstateDataService.cs | 6 + .../Framework/Interfaces/IEstateDataStore.cs | 6 + .../BareBonesShared/BareBonesSharedModule.cs | 3 + 6 files changed, 183 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2faffae..f8a0e07 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -8809,13 +8809,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP case "instantmessage": if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) { - if (messagePacket.ParamList.Length < 5) + if (messagePacket.ParamList.Length < 2) return true; + UUID invoice = messagePacket.MethodData.Invoice; - UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)); - string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter); - string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter); UUID sessionID = messagePacket.AgentData.SessionID; + + UUID SenderID; + string SenderName; + string Message; + + if (messagePacket.ParamList.Length < 5) + { + SenderID = AgentId; + SenderName = Utils.BytesToString(messagePacket.ParamList[0].Parameter); + Message = Utils.BytesToString(messagePacket.ParamList[1].Parameter); + } + else + { + SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter)); + SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter); + Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter); + } + OnEstateBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message); } return true; diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 57ab135..b6d64ac 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -200,12 +200,13 @@ namespace OpenSim.Region.CoreModules.World.Estate } Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); + sendRegionHandshakeToAll(); sendRegionInfoPacketToAll(); } private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) { - sendRegionHandshakeToAll(); + // sendRegionHandshakeToAll(); } public void setRegionTerrainSettings(float WaterHeight, @@ -274,8 +275,25 @@ namespace OpenSim.Region.CoreModules.World.Estate { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.AddEstateUser(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.AddEstateUser(user); Scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); } @@ -289,10 +307,26 @@ namespace OpenSim.Region.CoreModules.World.Estate { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.RemoveEstateUser(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.RemoveEstateUser(user); Scene.RegionInfo.EstateSettings.Save(); - TriggerEstateInfoChange(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); } else @@ -304,8 +338,25 @@ namespace OpenSim.Region.CoreModules.World.Estate { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.AddEstateGroup(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.AddEstateGroup(user); Scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); } @@ -318,10 +369,26 @@ namespace OpenSim.Region.CoreModules.World.Estate { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.RemoveEstateGroup(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); Scene.RegionInfo.EstateSettings.Save(); - TriggerEstateInfoChange(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); } else @@ -349,6 +416,29 @@ namespace OpenSim.Region.CoreModules.World.Estate if (!alreadyInList) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + EstateBan bitem = new EstateBan(); + + bitem.BannedUserID = user; + bitem.EstateID = (uint)estateID; + bitem.BannedHostAddress = "0.0.0.0"; + bitem.BannedHostIPMask = "0.0.0.0"; + + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.AddBan(bitem); + estateSettings.Save(); + } + } + } + EstateBan item = new EstateBan(); item.BannedUserID = user; @@ -358,6 +448,7 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.EstateSettings.AddBan(item); Scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); ScenePresence s = Scene.GetScenePresence(user); @@ -403,8 +494,25 @@ namespace OpenSim.Region.CoreModules.World.Estate if (alreadyInList && listitem != null) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.RemoveBan(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); Scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); } else @@ -424,8 +532,25 @@ namespace OpenSim.Region.CoreModules.World.Estate { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.AddEstateManager(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.AddEstateManager(user); Scene.RegionInfo.EstateSettings.Save(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); } @@ -438,10 +563,26 @@ namespace OpenSim.Region.CoreModules.World.Estate { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) { + if ((estateAccessType & 1) != 0) // All estates + { + List estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); + EstateSettings estateSettings; + + foreach (int estateID in estateIDs) + { + if (estateID != Scene.RegionInfo.EstateSettings.EstateID) + { + estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); + estateSettings.RemoveEstateManager(user); + estateSettings.Save(); + } + } + } + Scene.RegionInfo.EstateSettings.RemoveEstateManager(user); Scene.RegionInfo.EstateSettings.Save(); - TriggerEstateInfoChange(); + TriggerEstateInfoChange(); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); } else diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index cea7c78..4e14c73 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs @@ -469,8 +469,8 @@ namespace OpenSim.Region.CoreModules m_SunFixedHour = FixedSunHour; m_SunFixed = FixedSun; - m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString()); - m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString()); + // m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString()); + // m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString()); receivedEstateToolsSunUpdate = true; @@ -480,7 +480,7 @@ namespace OpenSim.Region.CoreModules // When sun settings are updated, we should update all clients with new settings. SunUpdateToAllClients(); - m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); + // m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); } } diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs index 38c10a6..7066cf2 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs @@ -71,6 +71,12 @@ namespace OpenSim.Region.Framework.Interfaces List GetEstates(string search); /// + /// Get the IDs of all estates owned by the given user. + /// + /// An empty list if no estates were found. + List GetEstatesByOwner(UUID ownerID); + + /// /// Get the IDs of all estates. /// /// An empty list if no estates were found. diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs index c82661d..d790a30 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs @@ -74,6 +74,12 @@ namespace OpenSim.Region.Framework.Interfaces /// Name of estate to search for. This is the exact name, no parttern matching is done. /// List GetEstates(string search); + + /// + /// Get the IDs of all estates owned by the given user. + /// + /// An empty list if no estates were found. + List GetEstatesByOwner(UUID ownerID); /// /// Get the IDs of all estates. diff --git a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs index 781fe95..dddea3e 100644 --- a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs +++ b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs @@ -33,6 +33,9 @@ using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +[assembly: Addin("BareBonesSharedModule", "0.1")] +[assembly: AddinDependency("OpenSim", "0.5")] + namespace OpenSim.Region.OptionalModules.Example.BareBonesShared { /// -- cgit v1.1 From c1dec225abd09efc5061b2ffd40996ad13fd16e9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Apr 2011 17:47:11 +0100 Subject: Handle the client's parcel info requests asynchronously rather than synchronously. Handling these synchronously kills the inbound packet loop if many requests are made for remote land and those requests are handled slowly or timeout (timeout is 10s) This can happen if a user searches for "land for sale" and then clicks many of the parcels in the list (or just presses down arrow to move through every entry). --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f8a0e07..34d72ac 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4938,7 +4938,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.TeleportLocationRequest, HandleTeleportLocationRequest); AddLocalPacketHandler(PacketType.UUIDNameRequest, HandleUUIDNameRequest, false); AddLocalPacketHandler(PacketType.RegionHandleRequest, HandleRegionHandleRequest); - AddLocalPacketHandler(PacketType.ParcelInfoRequest, HandleParcelInfoRequest, false); + AddLocalPacketHandler(PacketType.ParcelInfoRequest, HandleParcelInfoRequest); AddLocalPacketHandler(PacketType.ParcelAccessListRequest, HandleParcelAccessListRequest, false); AddLocalPacketHandler(PacketType.ParcelAccessListUpdate, HandleParcelAccessListUpdate, false); AddLocalPacketHandler(PacketType.ParcelPropertiesRequest, HandleParcelPropertiesRequest, false); -- cgit v1.1 From 3d400fc663104b6d899ee37afeb7f83c68af45d4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Apr 2011 18:24:23 +0100 Subject: If an object is selected, then don't include it in owner/group/others prim counts. This fixes the total prim count that the viewer displays when prims are selected - it appears to ignore the total that we pass it and adds up the counts separately. --- .../CoreModules/World/Land/PrimCountModule.cs | 31 +++++++++++++--------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index bc140ae..7a04eb1 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -206,25 +206,29 @@ namespace OpenSim.Region.CoreModules.World.Land else parcelCounts.Users[obj.OwnerID] = partCount; - if (landData.IsGroupOwned) + if (obj.IsSelected) { - if (obj.OwnerID == landData.GroupID) - parcelCounts.Owner += partCount; - else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID) - parcelCounts.Group += partCount; - else - parcelCounts.Others += partCount; + parcelCounts.Selected += partCount; } else { - if (obj.OwnerID == landData.OwnerID) - parcelCounts.Owner += partCount; + if (landData.IsGroupOwned) + { + if (obj.OwnerID == landData.GroupID) + parcelCounts.Owner += partCount; + else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID) + parcelCounts.Group += partCount; + else + parcelCounts.Others += partCount; + } else - parcelCounts.Others += partCount; + { + if (obj.OwnerID == landData.OwnerID) + parcelCounts.Owner += partCount; + else + parcelCounts.Others += partCount; + } } - - if (obj.IsSelected) - parcelCounts.Selected += partCount; } } @@ -380,6 +384,7 @@ namespace OpenSim.Region.CoreModules.World.Land count = counts.Owner; count += counts.Group; count += counts.Others; + count += counts.Selected; } } -- cgit v1.1 From dc6ce2444385730a3ea1ba1104f2e2caa15a907a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Apr 2011 20:31:52 +0100 Subject: switch llGetParcelPrimCount() to use new prim counts module --- .../Shared/Api/Implementation/LSL_Api.cs | 85 ++++++++++------------ 1 file changed, 39 insertions(+), 46 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 43b0da3..5f8ca91 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9835,63 +9835,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) { m_host.AddScriptLPS(1); + + ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); + + //LandData land = World.GetLandData((float)pos.x, (float)pos.y); - LandData land = World.GetLandData((float)pos.x, (float)pos.y); + if (lo == null) + return 0; + + IPrimCounts pc = lo.PrimCounts; - if (land == null) + if (sim_wide != 0) { - return 0; + if (category == 0) + { + return pc.Simulator; + } + else + { + // counts not implemented yet + return 0; + } } - else { - if (sim_wide != 0) + if (category == 0)//Total Prims { - if (category == 0) - { - return land.SimwidePrims; - } - - else - { - //public int simwideArea = 0; - return 0; - } + return pc.Total; } - - else + else if (category == 1)//Owner Prims { - if (category == 0)//Total Prims - { - return 0;//land. - } - - else if (category == 1)//Owner Prims - { - return land.OwnerPrims; - } - - else if (category == 2)//Group Prims - { - return land.GroupPrims; - } - - else if (category == 3)//Other Prims - { - return land.OtherPrims; - } - - else if (category == 4)//Selected - { - return land.SelectedPrims; - } - - else if (category == 5)//Temp - { - return 0;//land. - } + return pc.Owner; + } + else if (category == 2)//Group Prims + { + return pc.Group; + } + else if (category == 3)//Other Prims + { + return pc.Others; + } + else if (category == 4)//Selected + { + return pc.Selected; + } + else if (category == 5)//Temp + { + return 0; // counts not implemented yet } } + return 0; } -- cgit v1.1 From f030ba8992a17553b5824955c95096b8326b23c8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Apr 2011 20:39:58 +0100 Subject: replace magic numbers in llGetParcelPrimCount() with constants --- .../Shared/Api/Implementation/LSL_Api.cs | 30 ++++++---------------- 1 file changed, 8 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5f8ca91..e5be641 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9837,17 +9837,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); - - //LandData land = World.GetLandData((float)pos.x, (float)pos.y); if (lo == null) return 0; IPrimCounts pc = lo.PrimCounts; - if (sim_wide != 0) + if (sim_wide != ScriptBaseClass.FALSE) { - if (category == 0) + if (category == ScriptBaseClass.PARCEL_COUNT_TOTAL) { return pc.Simulator; } @@ -9859,30 +9857,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - if (category == 0)//Total Prims - { + if (category == ScriptBaseClass.PARCEL_COUNT_TOTAL) return pc.Total; - } - else if (category == 1)//Owner Prims - { + else if (category == ScriptBaseClass.PARCEL_COUNT_OWNER) return pc.Owner; - } - else if (category == 2)//Group Prims - { + else if (category == ScriptBaseClass.PARCEL_COUNT_GROUP) return pc.Group; - } - else if (category == 3)//Other Prims - { + else if (category == ScriptBaseClass.PARCEL_COUNT_OTHER) return pc.Others; - } - else if (category == 4)//Selected - { + else if (category == ScriptBaseClass.PARCEL_COUNT_SELECTED) return pc.Selected; - } - else if (category == 5)//Temp - { + else if (category == ScriptBaseClass.PARCEL_COUNT_TEMP) return 0; // counts not implemented yet - } } return 0; -- cgit v1.1 From 0e465da187c93e7ff21f91742f75ee9f3b76b04e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Apr 2011 21:25:54 +0100 Subject: remove now unused individual LandData prim counts. However, the calls to the land management module to record prims need to remain, since they were also being used to return owner object lists, etc. This is probably why prim counts were being done there in the first place. --- .../Region/CoreModules/World/Land/LandChannel.cs | 10 --- .../CoreModules/World/Land/LandManagementModule.cs | 39 +++------- .../Region/CoreModules/World/Land/LandObject.cs | 83 +++++----------------- OpenSim/Region/Framework/Scenes/Scene.cs | 14 ---- .../RegionCombinerLargeLandChannel.cs | 5 -- 5 files changed, 27 insertions(+), 124 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 7d990c2..7fc358d 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs @@ -133,16 +133,6 @@ namespace OpenSim.Region.CoreModules.World.Land return new List(); } - public bool IsLandPrimCountTainted() - { - if (m_landManagementModule != null) - { - return m_landManagementModule.IsLandPrimCountTainted(); - } - - return false; - } - public bool IsForcefulBansAllowed() { if (m_landManagementModule != null) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 2b5f7a0..adfac05 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -89,7 +89,6 @@ namespace OpenSim.Region.CoreModules.World.Land /// private readonly Dictionary m_landList = new Dictionary(); - private bool m_landPrimCountTainted; private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; private bool m_allowedForcefulBans = true; @@ -122,18 +121,18 @@ namespace OpenSim.Region.CoreModules.World.Land m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd; m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate; + m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene; + m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; + m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel; m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement; m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy; m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy; m_scene.EventManager.OnNewClient += EventManagerOnNewClient; m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement; - m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene; m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage; m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; - m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; - m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; - m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted; + m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; @@ -779,34 +778,24 @@ namespace OpenSim.Region.CoreModules.World.Land #region Parcel Modification - public void ResetAllLandPrimCounts() + public void ResetOverMeRecord() { lock (m_landList) { foreach (LandObject p in m_landList.Values) { - p.ResetLandPrimCounts(); + p.ResetOverMeRecord(); } } } - public void EventManagerOnParcelPrimCountTainted() - { - m_landPrimCountTainted = true; - } - - public bool IsLandPrimCountTainted() - { - return m_landPrimCountTainted; - } - public void EventManagerOnParcelPrimCountAdd(SceneObjectGroup obj) { Vector3 position = obj.AbsolutePosition; ILandObject landUnderPrim = GetLandObject(position.X, position.Y); if (landUnderPrim != null) { - ((LandObject)landUnderPrim).AddPrimToCount(obj); + ((LandObject)landUnderPrim).AddPrimOverMe(obj); } } @@ -816,7 +805,7 @@ namespace OpenSim.Region.CoreModules.World.Land { foreach (LandObject p in m_landList.Values) { - p.RemovePrimFromCount(obj); + p.RemovePrimFromOverMe(obj); } } } @@ -849,8 +838,7 @@ namespace OpenSim.Region.CoreModules.World.Land foreach (LandObject p in landOwnersAndParcels[owner]) { simArea += p.LandData.Area; - simPrims += p.LandData.OwnerPrims + p.LandData.OtherPrims + p.LandData.GroupPrims + - p.LandData.SelectedPrims; + simPrims += p.PrimCounts.Total; } foreach (LandObject p in landOwnersAndParcels[owner]) @@ -867,7 +855,7 @@ namespace OpenSim.Region.CoreModules.World.Land // "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}", // m_scene.RegionInfo.RegionName); - ResetAllLandPrimCounts(); + ResetOverMeRecord(); EntityBase[] entities = m_scene.Entities.GetEntities(); foreach (EntityBase obj in entities) { @@ -880,15 +868,13 @@ namespace OpenSim.Region.CoreModules.World.Land } } FinalizeLandPrimCountUpdate(); - m_landPrimCountTainted = false; } public void EventManagerOnRequestParcelPrimCountUpdate() { - ResetAllLandPrimCounts(); + ResetOverMeRecord(); m_scene.EventManager.TriggerParcelPrimCountUpdate(); FinalizeLandPrimCountUpdate(); - m_landPrimCountTainted = false; } /// @@ -952,8 +938,6 @@ namespace OpenSim.Region.CoreModules.World.Land m_landList[startLandObjectIndex].ForceUpdateLandInfo(); } - EventManagerOnParcelPrimCountTainted(); - //Now add the new land object ILandObject result = AddLandObject(newLand); UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); @@ -1020,7 +1004,6 @@ namespace OpenSim.Region.CoreModules.World.Land performFinalLandJoin(masterLandObject, slaveLandObject); } } - EventManagerOnParcelPrimCountTainted(); masterLandObject.SendLandUpdateToAvatarsOverMe(); } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index e7bdb19..9803bdf 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -64,8 +64,6 @@ namespace OpenSim.Region.CoreModules.World.Land #endregion - #region ILandObject Members - public int GetPrimsFree() { m_scene.EventManager.TriggerParcelPrimCountUpdate(); @@ -213,6 +211,7 @@ namespace OpenSim.Region.CoreModules.World.Land return simMax; } } + #endregion #region Packet Request Handling @@ -909,9 +908,12 @@ namespace OpenSim.Region.CoreModules.World.Land lock (primsOverMe) { +// m_log.DebugFormat( +// "[LAND OBJECT]: Request for SendLandObjectOwners() from {0} with {1} known prims on region", +// remote_client.Name, primsOverMe.Count); + try { - foreach (SceneObjectGroup obj in primsOverMe) { try @@ -950,6 +952,7 @@ namespace OpenSim.Region.CoreModules.World.Land public Dictionary GetLandObjectOwners() { Dictionary ownersAndCount = new Dictionary(); + lock (primsOverMe) { try @@ -986,8 +989,10 @@ namespace OpenSim.Region.CoreModules.World.Land public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) { - Dictionary> returns = - new Dictionary>(); +// m_log.DebugFormat( +// "[LAND OBJECT]: Request to return objects in {0} from {1}", LandData.Name, remote_client.Name); + + Dictionary> returns = new Dictionary>(); lock (primsOverMe) { @@ -1060,83 +1065,25 @@ namespace OpenSim.Region.CoreModules.World.Land #region Object Adding/Removing from Parcel - public void ResetLandPrimCounts() + public void ResetOverMeRecord() { - LandData.GroupPrims = 0; - LandData.OwnerPrims = 0; - LandData.OtherPrims = 0; - LandData.SelectedPrims = 0; - - lock (primsOverMe) primsOverMe.Clear(); } - public void AddPrimToCount(SceneObjectGroup obj) + public void AddPrimOverMe(SceneObjectGroup obj) { - - UUID prim_owner = obj.OwnerID; - int prim_count = obj.PrimCount; - - if (obj.IsSelected) - { - LandData.SelectedPrims += prim_count; - } - else - { - if (prim_owner == LandData.OwnerID) - { - LandData.OwnerPrims += prim_count; - } - else if ((obj.GroupID == LandData.GroupID || - prim_owner == LandData.GroupID) && - LandData.GroupID != UUID.Zero) - { - LandData.GroupPrims += prim_count; - } - else - { - LandData.OtherPrims += prim_count; - } - } - lock (primsOverMe) primsOverMe.Add(obj); } - public void RemovePrimFromCount(SceneObjectGroup obj) + public void RemovePrimFromOverMe(SceneObjectGroup obj) { lock (primsOverMe) - { - if (primsOverMe.Contains(obj)) - { - UUID prim_owner = obj.OwnerID; - int prim_count = obj.PrimCount; - - if (prim_owner == LandData.OwnerID) - { - LandData.OwnerPrims -= prim_count; - } - else if (obj.GroupID == LandData.GroupID || - prim_owner == LandData.GroupID) - { - LandData.GroupPrims -= prim_count; - } - else - { - LandData.OtherPrims -= prim_count; - } - - primsOverMe.Remove(obj); - } - } + primsOverMe.Remove(obj); } #endregion - - #endregion - - #endregion /// /// Set the media url for this land parcel @@ -1157,5 +1104,7 @@ namespace OpenSim.Region.CoreModules.World.Land LandData.MusicURL = url; SendLandUpdateToAvatarsOverMe(); } + + #endregion } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 35a798e..a62d6d7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1428,20 +1428,6 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Recount SceneObjectPart in parcel aabb - /// - private void UpdateLand() - { - if (LandChannel != null) - { - if (LandChannel.IsLandPrimCountTainted()) - { - EventManager.TriggerParcelPrimCountUpdate(); - } - } - } - - /// /// Update the terrain if it needs to be updated. /// private void UpdateTerrain() diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs index 98e5453..a133e51 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs @@ -130,11 +130,6 @@ public class RegionCombinerLargeLandChannel : ILandChannel } } - public bool IsLandPrimCountTainted() - { - return RootRegionLandChannel.IsLandPrimCountTainted(); - } - public bool IsForcefulBansAllowed() { return RootRegionLandChannel.IsForcefulBansAllowed(); -- cgit v1.1 From acacee98c6e4398b0ea808f23333a31689966133 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Apr 2011 22:15:06 +0100 Subject: properly refresh object owner list when refresh button is hit on land parcel object tab --- .../CoreModules/World/Land/LandManagementModule.cs | 17 +++++++++-------- OpenSim/Region/CoreModules/World/Land/LandObject.cs | 6 +++++- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index adfac05..abc7a3a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -62,8 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Land public class LandManagementModule : INonSharedRegionModule { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly string remoteParcelRequestPath = "0009/"; @@ -307,8 +306,8 @@ namespace OpenSim.Region.CoreModules.World.Land /// The parcel created. protected ILandObject CreateDefaultParcel() { -// m_log.DebugFormat( -// "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); + m_log.DebugFormat( + "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); @@ -778,7 +777,7 @@ namespace OpenSim.Region.CoreModules.World.Land #region Parcel Modification - public void ResetOverMeRecord() + public void ResetOverMeRecords() { lock (m_landList) { @@ -855,7 +854,7 @@ namespace OpenSim.Region.CoreModules.World.Land // "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}", // m_scene.RegionInfo.RegionName); - ResetOverMeRecord(); + ResetOverMeRecords(); EntityBase[] entities = m_scene.Entities.GetEntities(); foreach (EntityBase obj in entities) { @@ -872,7 +871,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnRequestParcelPrimCountUpdate() { - ResetOverMeRecord(); + ResetOverMeRecords(); m_scene.EventManager.TriggerParcelPrimCountUpdate(); FinalizeLandPrimCountUpdate(); } @@ -1193,6 +1192,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (land != null) { + m_scene.EventManager.TriggerParcelPrimCountUpdate(); m_landList[local_id].SendLandObjectOwners(remote_client); } else @@ -1424,7 +1424,8 @@ namespace OpenSim.Region.CoreModules.World.Land private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) { IClientAPI client; - if (! m_scene.TryGetClient(agentID, out client)) { + if (!m_scene.TryGetClient(agentID, out client)) + { m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to retrieve IClientAPI for {0}", agentID); return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 9803bdf..c4fb11e 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -925,7 +925,7 @@ namespace OpenSim.Region.CoreModules.World.Land } catch (NullReferenceException) { - m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); + m_log.Error("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); } try { @@ -1073,12 +1073,16 @@ namespace OpenSim.Region.CoreModules.World.Land public void AddPrimOverMe(SceneObjectGroup obj) { +// m_log.DebugFormat("[LAND OBJECT]: Adding scene object {0} {1} over {2}", obj.Name, obj.LocalId, LandData.Name); + lock (primsOverMe) primsOverMe.Add(obj); } public void RemovePrimFromOverMe(SceneObjectGroup obj) { +// m_log.DebugFormat("[LAND OBJECT]: Removing scene object {0} {1} from over {2}", obj.Name, obj.LocalId, LandData.Name); + lock (primsOverMe) primsOverMe.Remove(obj); } -- cgit v1.1 From 2497962360258eb6cb1a78c7b4d5227d88eabb87 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Apr 2011 22:25:00 +0100 Subject: Change some text to make the autoreturn mechanism more obvious, and align with the fact that it's one word rather than two. --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++++- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a62d6d7..f0acc38 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1521,8 +1521,11 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Return object to avatar Message + /// Tell an agent that their object has been returned. /// + /// + /// The actual return is handled by the caller. + /// /// Avatar Unique Id /// Name of object returned /// Location of object returned diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f17fb28..a7107f0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1313,8 +1313,10 @@ namespace OpenSim.Region.Framework.Scenes parcel.LandData.OtherCleanTime) { DetachFromBackup(); - m_log.InfoFormat("[SCENE]: Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); - m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return"); + m_log.DebugFormat( + "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn", + RootPart.UUID); + m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel autoreturn"); m_scene.DeRezObjects(null, new List() { RootPart.LocalId }, UUID.Zero, DeRezAction.Return, UUID.Zero); -- cgit v1.1 From fa202a05e914395d5a1facf8bdadb6a553516bfe Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 6 Apr 2011 17:19:31 +0100 Subject: Add method doc to some land bitmap methods in ILandObject. Also changes prim count tests to use the correct upper region bounds, though the method actually ignores the overage. --- .../Region/CoreModules/World/Land/LandObject.cs | 14 +----- .../World/Land/Tests/PrimCountModuleTests.cs | 52 +++++++++++++++++++--- 2 files changed, 48 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index c4fb11e..c2f104e 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -701,23 +701,11 @@ namespace OpenSim.Region.CoreModules.World.Land return LandBitmap; } - /// - /// Full sim land object creation - /// - /// public bool[,] BasicFullRegionLandBitmap() { return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); } - - /// - /// Used to modify the bitmap between the x and y points. Points use 64 scale - /// - /// - /// - /// - /// - /// + public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) { bool[,] tempBitmap = new bool[64,64]; diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index f006db2..4acba18 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -49,6 +49,10 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999"); protected TestScene m_scene; protected PrimCountModule m_pcm; + + /// + /// A parcel that covers the entire sim. + /// protected ILandObject m_lo; [SetUp] @@ -60,9 +64,9 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); ILandObject lo = new LandObject(m_userId, false, m_scene); - lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); - m_lo = lmm.AddLandObject(lo); - //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); + lo.SetLandBitmap( + lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize / 4 - 1, (int)Constants.RegionSize / 4 - 1)); + m_lo = lmm.AddLandObject(lo); } /// @@ -124,7 +128,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests /// Test count after a parcel owner owned copied object is added. /// [Test] - public void TestCopiedOwnerObject() + public void TestCopyOwnerObject() { TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -143,7 +147,45 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Users[m_userId], Is.EqualTo(6)); Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); Assert.That(pc.Simulator, Is.EqualTo(6)); - } + } + + /// + /// Test that parcel counts update correctly when an object is moved between parcels, where that movement + /// is not done directly by the user/ + /// + //[Test] + public void TestMoveOwnerObject() + { +// TestHelper.InMethod(); +//// log4net.Config.XmlConfigurator.Configure(); +// +// IPrimCounts pc = m_lo.PrimCounts; +// +// SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); +// m_scene.AddNewSceneObject(sog, false); +// +// Assert.That(pc.Owner, Is.EqualTo(3)); +// Assert.That(pc.Group, Is.EqualTo(0)); +// Assert.That(pc.Others, Is.EqualTo(0)); +// Assert.That(pc.Total, Is.EqualTo(3)); +// Assert.That(pc.Selected, Is.EqualTo(0)); +// Assert.That(pc.Users[m_userId], Is.EqualTo(3)); +// Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); +// Assert.That(pc.Simulator, Is.EqualTo(3)); +// +// // Add a second object and retest +// SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); +// m_scene.AddNewSceneObject(sog2, false); +// +// Assert.That(pc.Owner, Is.EqualTo(5)); +// Assert.That(pc.Group, Is.EqualTo(0)); +// Assert.That(pc.Others, Is.EqualTo(0)); +// Assert.That(pc.Total, Is.EqualTo(5)); +// Assert.That(pc.Selected, Is.EqualTo(0)); +// Assert.That(pc.Users[m_userId], Is.EqualTo(5)); +// Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); +// Assert.That(pc.Simulator, Is.EqualTo(5)); + } /// /// Test count after a parcel owner owned object is removed. -- cgit v1.1 From 63533412f882fd55c0c40989d97f8a8262bc4e3c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 6 Apr 2011 18:57:50 +0100 Subject: Improve previous ILandObject method doc. For test code, take a part name prefix when creating objects, so that these can be more easily identified in the logs --- .../CoreModules/World/Land/LandManagementModule.cs | 12 +++ .../CoreModules/World/Land/PrimCountModule.cs | 22 +++-- .../World/Land/Tests/PrimCountModuleTests.cs | 102 ++++++++++++--------- 3 files changed, 87 insertions(+), 49 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index abc7a3a..bfab7b8 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -612,6 +612,10 @@ namespace OpenSim.Region.CoreModules.World.Land { if (landBitmap[x, y]) { +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", +// new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); + m_landIDList[x, y] = newLandLocalID; } } @@ -741,8 +745,16 @@ namespace OpenSim.Region.CoreModules.World.Land // Corner case. If an autoreturn happens during sim startup // we will come here with the list uninitialized // + int landId = m_landIDList[x, y]; + +// if (landId == 0) +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}", +// x, y, m_scene.RegionInfo.RegionName); + if (m_landList.ContainsKey(m_landIDList[x, y])) return m_landList[m_landIDList[x, y]]; + return null; } } diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 7a04eb1..dca842a 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -173,24 +173,32 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: Call under Taint Lock private void AddObject(SceneObjectGroup obj) - { -// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} {1} to prim count", obj.Name, obj.UUID); - + { if (obj.IsAttachment) return; if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)) - return; + return; Vector3 pos = obj.AbsolutePosition; ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y); // If for some reason there is no land object (perhaps the object is out of bounds) then we can't count it if (landObject == null) + { +// m_log.WarnFormat( +// "[PRIM COUNT MODULE]: Found no land object for {0} at position ({1}, {2}) on {3}", +// obj.Name, pos.X, pos.Y, m_Scene.RegionInfo.RegionName); + return; + } LandData landData = landObject.LandData; // m_log.DebugFormat( +// "[PRIM COUNT MODULE]: Adding object {0} with {1} parts to prim count for parcel {2} on {3}", +// obj.Name, obj.Parts.Length, landData.Name, m_Scene.RegionInfo.RegionName); + +// m_log.DebugFormat( // "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}", // obj.Name, obj.OwnerID, landData.OwnerID); @@ -473,7 +481,9 @@ namespace OpenSim.Region.CoreModules.World.Land m_OwnerMap[landData.GlobalID] = landData.OwnerID; m_SimwideCounts[landData.OwnerID] = 0; -// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding parcel count for {0}", landData.GlobalID); +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: Initializing parcel count for {0} on {1}", +// landData.Name, m_Scene.RegionInfo.RegionName); m_ParcelCounts[landData.GlobalID] = new ParcelCounts(); } @@ -583,4 +593,4 @@ namespace OpenSim.Region.CoreModules.World.Land } } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 4acba18..d161bb8 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -51,9 +51,14 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests protected PrimCountModule m_pcm; /// - /// A parcel that covers the entire sim. + /// A parcel that covers the entire sim except for a 1 unit wide strip on the eastern side. /// protected ILandObject m_lo; + + /// + /// A parcel that covers just the eastern strip of the sim. + /// + protected ILandObject m_lo2; [SetUp] public void SetUp() @@ -63,10 +68,19 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests m_scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); + int xParcelDivider = (int)Constants.RegionSize - 1; + ILandObject lo = new LandObject(m_userId, false, m_scene); + lo.LandData.Name = "m_lo"; lo.SetLandBitmap( - lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize / 4 - 1, (int)Constants.RegionSize / 4 - 1)); + lo.GetSquareLandBitmap(0, 0, xParcelDivider, (int)Constants.RegionSize)); m_lo = lmm.AddLandObject(lo); + + ILandObject lo2 = new LandObject(m_userId, false, m_scene); + lo2.SetLandBitmap( + lo2.GetSquareLandBitmap(xParcelDivider, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); + lo2.LandData.Name = "m_lo2"; + m_lo2 = lmm.AddLandObject(lo2); } /// @@ -98,7 +112,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); Assert.That(pc.Owner, Is.EqualTo(3)); @@ -111,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Simulator, Is.EqualTo(3)); // Add a second object and retest - SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); + SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); m_scene.AddNewSceneObject(sog2, false); Assert.That(pc.Owner, Is.EqualTo(5)); @@ -135,7 +149,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity); @@ -156,35 +170,37 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests //[Test] public void TestMoveOwnerObject() { -// TestHelper.InMethod(); -//// log4net.Config.XmlConfigurator.Configure(); -// -// IPrimCounts pc = m_lo.PrimCounts; -// -// SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); -// m_scene.AddNewSceneObject(sog, false); -// -// Assert.That(pc.Owner, Is.EqualTo(3)); -// Assert.That(pc.Group, Is.EqualTo(0)); -// Assert.That(pc.Others, Is.EqualTo(0)); -// Assert.That(pc.Total, Is.EqualTo(3)); -// Assert.That(pc.Selected, Is.EqualTo(0)); -// Assert.That(pc.Users[m_userId], Is.EqualTo(3)); -// Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); -// Assert.That(pc.Simulator, Is.EqualTo(3)); -// -// // Add a second object and retest -// SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); -// m_scene.AddNewSceneObject(sog2, false); -// -// Assert.That(pc.Owner, Is.EqualTo(5)); -// Assert.That(pc.Group, Is.EqualTo(0)); -// Assert.That(pc.Others, Is.EqualTo(0)); -// Assert.That(pc.Total, Is.EqualTo(5)); -// Assert.That(pc.Selected, Is.EqualTo(0)); -// Assert.That(pc.Users[m_userId], Is.EqualTo(5)); -// Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); -// Assert.That(pc.Simulator, Is.EqualTo(5)); + TestHelper.InMethod(); + log4net.Config.XmlConfigurator.Configure(); + + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); + m_scene.AddNewSceneObject(sog, false); + SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); + m_scene.AddNewSceneObject(sog2, false); + + sog.AbsolutePosition = new Vector3(254, 2, 2); + + IPrimCounts pclo1 = m_lo.PrimCounts; + + Assert.That(pclo1.Owner, Is.EqualTo(2)); + Assert.That(pclo1.Group, Is.EqualTo(0)); + Assert.That(pclo1.Others, Is.EqualTo(0)); + Assert.That(pclo1.Total, Is.EqualTo(2)); + Assert.That(pclo1.Selected, Is.EqualTo(0)); + Assert.That(pclo1.Users[m_userId], Is.EqualTo(2)); + Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0)); + Assert.That(pclo1.Simulator, Is.EqualTo(2)); + + IPrimCounts pclo2 = m_lo2.PrimCounts; + + Assert.That(pclo2.Owner, Is.EqualTo(3)); + Assert.That(pclo2.Group, Is.EqualTo(0)); + Assert.That(pclo2.Others, Is.EqualTo(0)); + Assert.That(pclo2.Total, Is.EqualTo(3)); + Assert.That(pclo2.Selected, Is.EqualTo(0)); + Assert.That(pclo2.Users[m_userId], Is.EqualTo(3)); + Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0)); + Assert.That(pclo2.Simulator, Is.EqualTo(3)); } /// @@ -198,8 +214,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false); - SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); + m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false); + SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); m_scene.AddNewSceneObject(sogToDelete, false); m_scene.DeleteSceneObject(sogToDelete, false); @@ -223,7 +239,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x01); + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); sog.GroupID = m_groupId; m_scene.AddNewSceneObject(sog, false); @@ -254,11 +270,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1); + SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1); sogToKeep.GroupID = m_groupId; m_scene.AddNewSceneObject(sogToKeep, false); - SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); + SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); m_scene.AddNewSceneObject(sogToDelete, false); m_scene.DeleteSceneObject(sogToDelete, false); @@ -281,7 +297,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x01); + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); Assert.That(pc.Owner, Is.EqualTo(0)); @@ -302,8 +318,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, 0x1), false); - SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x10); + m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false); + SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10); m_scene.AddNewSceneObject(sogToDelete, false); m_scene.DeleteSceneObject(sogToDelete, false); @@ -326,7 +342,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests TestHelper.InMethod(); IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); m_pcm.TaintPrimCount(); -- cgit v1.1 From 8318915d7ec7ed3bd25ff1027a9a8dfb695f2609 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 6 Apr 2011 20:45:59 +0100 Subject: Signal prim count taint if the AbsolutePosition of a scene object changes. This updates prim counts correctly if an object is moved by something other than an avatar (e.g. scripts, region modules) Create TestMoveOwnerObject() regression test for this case. --- .../World/Land/Tests/PrimCountModuleTests.cs | 30 +++++++++++++++++++--- .../Region/Framework/Scenes/SceneObjectGroup.cs | 2 ++ 2 files changed, 28 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index d161bb8..67b00ac 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -167,17 +167,18 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests /// Test that parcel counts update correctly when an object is moved between parcels, where that movement /// is not done directly by the user/ /// - //[Test] + [Test] public void TestMoveOwnerObject() { TestHelper.InMethod(); - log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); m_scene.AddNewSceneObject(sog2, false); + // Move the first scene object to the eastern strip parcel sog.AbsolutePosition = new Vector3(254, 2, 2); IPrimCounts pclo1 = m_lo.PrimCounts; @@ -189,7 +190,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pclo1.Selected, Is.EqualTo(0)); Assert.That(pclo1.Users[m_userId], Is.EqualTo(2)); Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0)); - Assert.That(pclo1.Simulator, Is.EqualTo(2)); + Assert.That(pclo1.Simulator, Is.EqualTo(5)); IPrimCounts pclo2 = m_lo2.PrimCounts; @@ -200,7 +201,28 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pclo2.Selected, Is.EqualTo(0)); Assert.That(pclo2.Users[m_userId], Is.EqualTo(3)); Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0)); - Assert.That(pclo2.Simulator, Is.EqualTo(3)); + Assert.That(pclo2.Simulator, Is.EqualTo(5)); + + // Now move it back again + sog.AbsolutePosition = new Vector3(2, 2, 2); + + Assert.That(pclo1.Owner, Is.EqualTo(5)); + Assert.That(pclo1.Group, Is.EqualTo(0)); + Assert.That(pclo1.Others, Is.EqualTo(0)); + Assert.That(pclo1.Total, Is.EqualTo(5)); + Assert.That(pclo1.Selected, Is.EqualTo(0)); + Assert.That(pclo1.Users[m_userId], Is.EqualTo(5)); + Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0)); + Assert.That(pclo1.Simulator, Is.EqualTo(5)); + + Assert.That(pclo2.Owner, Is.EqualTo(0)); + Assert.That(pclo2.Group, Is.EqualTo(0)); + Assert.That(pclo2.Others, Is.EqualTo(0)); + Assert.That(pclo2.Total, Is.EqualTo(0)); + Assert.That(pclo2.Selected, Is.EqualTo(0)); + Assert.That(pclo2.Users[m_userId], Is.EqualTo(0)); + Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0)); + Assert.That(pclo2.Simulator, Is.EqualTo(5)); } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a7107f0..ca7d9d9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -325,6 +325,8 @@ namespace OpenSim.Region.Framework.Scenes //m_rootPart.GroupPosition.Z); //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); //} + + m_scene.EventManager.TriggerParcelPrimCountTainted(); } } -- cgit v1.1 From 9bc2705f37bfc057cdb74a4479d1c72fda4e0aa9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 6 Apr 2011 20:52:36 +0100 Subject: Fix bug where on duplication, the root part local id was continually used in populating the local id scene object index instead of each part's local id --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 60855b2..97af0a0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1855,7 +1855,7 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; foreach (SceneObjectPart part in children) - SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; + SceneObjectGroupsByLocalPartID[part.LocalId] = copy; } // PROBABLE END OF FIXME -- cgit v1.1 From d31175060f8133c42c84da5b8e701ff1fb16eed8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 8 Apr 2011 00:42:35 +0100 Subject: trivial whitespace removal to trigger a panda rebuild --- OpenSim/Region/Application/Application.cs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index d120f03..7e320e6 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -250,9 +250,7 @@ namespace OpenSim m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false); // load Crash directory config - m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); - - + m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); if (background) { @@ -260,15 +258,9 @@ namespace OpenSim m_sim.Startup(); } else - { - - - - + { m_sim = new OpenSim(configSource); - - - + m_sim.Startup(); while (true) -- cgit v1.1 From abea0c74c2b092d0474880a30433d9d0a2400aa8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Apr 2011 04:19:17 +0100 Subject: Add support for the new display name related functions in LSL. This does not implement the display names functionality as such, but it allows scripts that are display name aware to function as if the display name were implemented and set to the avatar name. --- .../Shared/Api/Implementation/LSL_Api.cs | 49 ++++++++++++++++++++++ .../Api/Implementation/Plugins/SensorRepeat.cs | 26 ++++++++++-- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 4 ++ .../Shared/Api/Runtime/LSL_Constants.cs | 2 + .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 20 +++++++++ 5 files changed, 97 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e5be641..c16a985 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10268,6 +10268,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_log.Info("LSL print():" + str); } } + + private string Name2Username(string name) + { + string[] parts = name.Split(new char[] {' '}); + if (parts.Length < 2) + return name.ToLower(); + if (parts[1] == "Resident") + return parts[0].ToLower(); + + return name.Replace(" ", ".").ToLower(); + } + + public LSL_String llGetUsername(string id) + { + return Name2Username(llKey2Name(id)); + } + + public LSL_String llRequestUsername(string id) + { + UUID rq = UUID.Random(); + + UUID tid = AsyncCommands. + DataserverPlugin.RegisterRequest(m_localID, + m_itemID, rq.ToString()); + + AsyncCommands. + DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); + + return rq.ToString(); + } + + public LSL_String llGetDisplayName(string id) + { + return llKey2Name(id); + } + + public LSL_String llRequestDisplayName(string id) + { + UUID rq = UUID.Random(); + + UUID tid = AsyncCommands. + DataserverPlugin.RegisterRequest(m_localID, + m_itemID, rq.ToString()); + + AsyncCommands. + DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); + + return rq.ToString(); + } } public class NotecardCache diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index fefbb35..47c7915 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -50,6 +50,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins private Object SenseLock = new Object(); private const int AGENT = 1; + private const int AGENT_BY_USERNAME = 0x10; private const int ACTIVE = 2; private const int PASSIVE = 4; private const int SCRIPTED = 8; @@ -202,7 +203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins List sensedEntities = new List(); // Is the sensor type is AGENT and not SCRIPTED then include agents - if ((ts.type & AGENT) != 0 && (ts.type & SCRIPTED) == 0) + if ((ts.type & (AGENT | AGENT_BY_USERNAME)) != 0 && (ts.type & SCRIPTED) == 0) { sensedEntities.AddRange(doAgentSensor(ts)); } @@ -493,9 +494,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins { ScenePresence sp; // Try lookup by name will return if/when found - if (!m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp)) - return sensedEntities; - senseEntity(sp); + if (((ts.type & AGENT) != 0) && m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp)) + senseEntity(sp); + if ((ts.type & AGENT_BY_USERNAME) != 0) + { + m_CmdManager.m_ScriptEngine.World.ForEachScenePresence( + delegate (ScenePresence ssp) + { + if (ssp.Lastname == "Resident") + { + if (ssp.Firstname.ToLower() == ts.name) + senseEntity(ssp); + return; + } + if (ssp.Name.Replace(" ", ".").ToLower() == ts.name) + senseEntity(ssp); + } + ); + } + + return sensedEntities; } else { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index bd6a094..654ea81 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -209,6 +209,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llInstantMessage(string user, string message); LSL_String llIntegerToBase64(int number); LSL_String llKey2Name(string id); + LSL_String llGetUsername(string id); + LSL_String llRequestUsername(string id); + LSL_String llGetDisplayName(string id); + LSL_String llRequestDisplayName(string id); void llLinkParticleSystem(int linknum, LSL_List rules); LSL_String llList2CSV(LSL_List src); LSL_Float llList2Float(LSL_List src, int index); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index b3c4d95..9377cda 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -50,6 +50,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int STATUS_CAST_SHADOWS = 512; public const int AGENT = 1; + public const int AGENT_BY_LEGACY_NAME = 1; + public const int AGENT_BY_USERNAME = 0x10; public const int ACTIVE = 2; public const int PASSIVE = 4; public const int SCRIPTED = 8; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 3b29861..303d75e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -894,6 +894,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llKey2Name(id); } + public LSL_String llGetUsername(string id) + { + return m_LSL_Functions.llGetUsername(id); + } + + public LSL_String llRequestUsername(string id) + { + return m_LSL_Functions.llRequestUsername(id); + } + + public LSL_String llGetDisplayName(string id) + { + return m_LSL_Functions.llGetDisplayName(id); + } + + public LSL_String llRequestDisplayName(string id) + { + return m_LSL_Functions.llRequestDisplayName(id); + } + public void llLinkParticleSystem(int linknum, LSL_List rules) { m_LSL_Functions.llLinkParticleSystem(linknum, rules); -- cgit v1.1 From 77cf9405de10f016d85d67b6016ed27d28ed898f Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 28 Mar 2011 10:00:53 -0700 Subject: Implements adaptive queue management and fair queueing for improved networking performance. Reprioritization algorithms need to be ported still. One is in place. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 353 ++++++++++++++------- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 71 ++++- 2 files changed, 304 insertions(+), 120 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 34d72ac..a3f2c15 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -49,6 +49,8 @@ using Timer = System.Timers.Timer; using AssetLandmark = OpenSim.Framework.AssetLandmark; using Nini.Config; +using System.IO; + namespace OpenSim.Region.ClientStack.LindenUDP { public delegate bool PacketMethod(IClientAPI simClient, Packet packet); @@ -298,6 +300,77 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Used to adjust Sun Orbit values so Linden based viewers properly position sun private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f; + // First log file or time has expired, start writing to a new log file +// +// ----------------------------------------------------------------- +// ----------------------------------------------------------------- +// THIS IS DEBUGGING CODE & SHOULD BE REMOVED +// ----------------------------------------------------------------- +// ----------------------------------------------------------------- + public class QueueLogger + { + public Int32 start = 0; + public StreamWriter Log = null; + private Dictionary m_idMap = new Dictionary(); + + public QueueLogger() + { + DateTime now = DateTime.Now; + String fname = String.Format("queue-{0}.log", now.ToString("yyyyMMddHHmmss")); + Log = new StreamWriter(fname); + + start = Util.EnvironmentTickCount(); + } + + public int LookupID(UUID uuid) + { + int localid; + if (! m_idMap.TryGetValue(uuid,out localid)) + { + localid = m_idMap.Count + 1; + m_idMap[uuid] = localid; + } + + return localid; + } + } + + public static QueueLogger QueueLog = null; + + // ----------------------------------------------------------------- + public void LogAvatarUpdateEvent(UUID client, UUID avatar, Int32 timeinqueue) + { + if (QueueLog == null) + QueueLog = new QueueLogger(); + + Int32 ticks = Util.EnvironmentTickCountSubtract(QueueLog.start); + lock(QueueLog) + { + int cid = QueueLog.LookupID(client); + int aid = QueueLog.LookupID(avatar); + QueueLog.Log.WriteLine("{0},AU,AV{1:D4},AV{2:D4},{3}",ticks,cid,aid,timeinqueue); + } + } + + // ----------------------------------------------------------------- + public void LogQueueProcessEvent(UUID client, PriorityQueue queue, uint maxup) + { + if (QueueLog == null) + QueueLog = new QueueLogger(); + + Int32 ticks = Util.EnvironmentTickCountSubtract(QueueLog.start); + lock(QueueLog) + { + int cid = QueueLog.LookupID(client); + QueueLog.Log.WriteLine("{0},PQ,AV{1:D4},{2},{3}",ticks,cid,maxup,queue.ToString()); + } + } +// ----------------------------------------------------------------- +// ----------------------------------------------------------------- +// ----------------------------------------------------------------- +// ----------------------------------------------------------------- +// + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected static Dictionary PacketHandlers = new Dictionary(); //Global/static handlers for all clients @@ -3547,18 +3620,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Primitive Packet/Data Sending Methods + /// /// Generate one of the object update packets based on PrimUpdateFlags /// and broadcast the packet to clients /// public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) { - double priority = m_prioritizer.GetUpdatePriority(this, entity); + //double priority = m_prioritizer.GetUpdatePriority(this, entity); + uint priority = m_prioritizer.GetUpdatePriority(this, entity); lock (m_entityUpdates.SyncRoot) - m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation), entity.LocalId); + m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); } + private Int32 m_LastQueueFill = 0; + private uint m_maxUpdates = 0; + private void ProcessEntityUpdates(int maxUpdates) { OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); @@ -3566,23 +3644,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP OpenSim.Framework.Lazy> terseUpdateBlocks = new OpenSim.Framework.Lazy>(); OpenSim.Framework.Lazy> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy>(); - if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; + if (maxUpdates <= 0) + { + m_maxUpdates = Int32.MaxValue; + } + else + { + if (m_maxUpdates == 0 || m_LastQueueFill == 0) + { + m_maxUpdates = (uint)maxUpdates; + } + else + { + if (Util.EnvironmentTickCountSubtract(m_LastQueueFill) < 200) + m_maxUpdates += 5; + else + m_maxUpdates = m_maxUpdates >> 1; + } + m_maxUpdates = Util.Clamp(m_maxUpdates,10,500); + } + m_LastQueueFill = Util.EnvironmentTickCount(); + int updatesThisCall = 0; +// +// DEBUGGING CODE... REMOVE +// LogQueueProcessEvent(this.m_agentId,m_entityUpdates,m_maxUpdates); +// // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race // condition where a kill can be processed before an out-of-date update for the same object. lock (m_killRecord) { float avgTimeDilation = 1.0f; EntityUpdate update; - while (updatesThisCall < maxUpdates) + Int32 timeinqueue; // this is just debugging code & can be dropped later + + while (updatesThisCall < m_maxUpdates) { lock (m_entityUpdates.SyncRoot) - if (!m_entityUpdates.TryDequeue(out update)) + if (!m_entityUpdates.TryDequeue(out update, out timeinqueue)) break; avgTimeDilation += update.TimeDilation; avgTimeDilation *= 0.5f; +// +// DEBUGGING CODE... REMOVE +// if (update.Entity is ScenePresence) +// LogAvatarUpdateEvent(this.m_agentId,update.Entity.UUID,timeinqueue); +// + if (update.Entity is SceneObjectPart) { SceneObjectPart part = (SceneObjectPart)update.Entity; @@ -3679,36 +3789,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - // if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment) - // { - // SceneObjectPart sop = (SceneObjectPart)update.Entity; - // string text = sop.Text; - // if (text.IndexOf("\n") >= 0) - // text = text.Remove(text.IndexOf("\n")); - // - // if (m_attachmentsSent.Contains(sop.ParentID)) - // { - //// m_log.DebugFormat( - //// "[CLIENT]: Sending full info about attached prim {0} text {1}", - //// sop.LocalId, text); - // - // objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId)); - // - // m_attachmentsSent.Add(sop.LocalId); - // } - // else - // { - // m_log.DebugFormat( - // "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", - // sop.LocalId, text, sop.ParentID); - // - // m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); - // } - // } - // else - // { - objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); - // } + objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); } } else if (!canUseImproved) @@ -3802,26 +3883,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void ReprioritizeUpdates() { - //m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName); - lock (m_entityUpdates.SyncRoot) m_entityUpdates.Reprioritize(UpdatePriorityHandler); } - private bool UpdatePriorityHandler(ref double priority, uint localID) + private bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity) { - EntityBase entity; - if (m_scene.Entities.TryGetValue(localID, out entity)) + if (entity != null) { priority = m_prioritizer.GetUpdatePriority(this, entity); + return true; } - return priority != double.NaN; + return false; } public void FlushPrimUpdates() { - m_log.Debug("[CLIENT]: Flushing prim updates to " + m_firstName + " " + m_lastName); + m_log.WarnFormat("[CLIENT]: Flushing prim updates to " + m_firstName + " " + m_lastName); while (m_entityUpdates.Count > 0) ProcessEntityUpdates(-1); @@ -11729,86 +11808,85 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region PriorityQueue public class PriorityQueue { - internal delegate bool UpdatePriorityHandler(ref double priority, uint local_id); + internal delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity); + + // Heap[0] for self updates + // Heap[1..12] for entity updates - private MinHeap[] m_heaps = new MinHeap[1]; + internal const uint m_numberOfQueues = 12; + private MinHeap[] m_heaps = new MinHeap[m_numberOfQueues]; private Dictionary m_lookupTable; - private Comparison m_comparison; private object m_syncRoot = new object(); - + private uint m_nextQueue = 0; + private UInt64 m_nextRequest = 0; + internal PriorityQueue() : - this(MinHeap.DEFAULT_CAPACITY, Comparer.Default) { } - internal PriorityQueue(int capacity) : - this(capacity, Comparer.Default) { } - internal PriorityQueue(IComparer comparer) : - this(new Comparison(comparer.Compare)) { } - internal PriorityQueue(Comparison comparison) : - this(MinHeap.DEFAULT_CAPACITY, comparison) { } - internal PriorityQueue(int capacity, IComparer comparer) : - this(capacity, new Comparison(comparer.Compare)) { } - internal PriorityQueue(int capacity, Comparison comparison) + this(MinHeap.DEFAULT_CAPACITY) { } + internal PriorityQueue(int capacity) { m_lookupTable = new Dictionary(capacity); for (int i = 0; i < m_heaps.Length; ++i) m_heaps[i] = new MinHeap(capacity); - this.m_comparison = comparison; } public object SyncRoot { get { return this.m_syncRoot; } } + internal int Count { get { int count = 0; for (int i = 0; i < m_heaps.Length; ++i) - count = m_heaps[i].Count; + count += m_heaps[i].Count; return count; } } - public bool Enqueue(double priority, EntityUpdate value, uint local_id) + public bool Enqueue(uint pqueue, EntityUpdate value) { - LookupItem item; + LookupItem lookup; - if (m_lookupTable.TryGetValue(local_id, out item)) + uint localid = value.Entity.LocalId; + UInt64 entry = m_nextRequest++; + if (m_lookupTable.TryGetValue(localid, out lookup)) { - // Combine flags - value.Flags |= item.Heap[item.Handle].Value.Flags; - - item.Heap[item.Handle] = new MinHeapItem(priority, value, local_id, this.m_comparison); - return false; - } - else - { - item.Heap = m_heaps[0]; - item.Heap.Add(new MinHeapItem(priority, value, local_id, this.m_comparison), ref item.Handle); - m_lookupTable.Add(local_id, item); - return true; + entry = lookup.Heap[lookup.Handle].EntryOrder; + value.Flags |= lookup.Heap[lookup.Handle].Value.Flags; + lookup.Heap.Remove(lookup.Handle); } - } - internal EntityUpdate Peek() - { - for (int i = 0; i < m_heaps.Length; ++i) - if (m_heaps[i].Count > 0) - return m_heaps[i].Min().Value; - throw new InvalidOperationException(string.Format("The {0} is empty", this.GetType().ToString())); + pqueue = Util.Clamp(pqueue, 0, m_numberOfQueues - 1); + lookup.Heap = m_heaps[pqueue]; + lookup.Heap.Add(new MinHeapItem(pqueue, entry, value), ref lookup.Handle); + m_lookupTable[localid] = lookup; + + return true; } - internal bool TryDequeue(out EntityUpdate value) + internal bool TryDequeue(out EntityUpdate value, out Int32 timeinqueue) { - for (int i = 0; i < m_heaps.Length; ++i) + for (int i = 0; i < m_numberOfQueues; ++i) { - if (m_heaps[i].Count > 0) + // To get the fair queing, we cycle through each of the + // queues when finding an element to dequeue, this code + // assumes that the distribution of updates in the queues + // is polynomial, probably quadractic (eg distance of PI * R^2) + uint h = (uint)((m_nextQueue + i) % m_numberOfQueues); + if (m_heaps[h].Count > 0) { - MinHeapItem item = m_heaps[i].RemoveMin(); - m_lookupTable.Remove(item.LocalID); + m_nextQueue = (uint)((h + 1) % m_numberOfQueues); + + MinHeapItem item = m_heaps[h].RemoveMin(); + m_lookupTable.Remove(item.Value.Entity.LocalId); + timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); value = item.Value; + return true; } } + timeinqueue = 0; value = default(EntityUpdate); return false; } @@ -11816,68 +11894,107 @@ namespace OpenSim.Region.ClientStack.LindenUDP internal void Reprioritize(UpdatePriorityHandler handler) { MinHeapItem item; - double priority; - foreach (LookupItem lookup in new List(this.m_lookupTable.Values)) { if (lookup.Heap.TryGetValue(lookup.Handle, out item)) { - priority = item.Priority; - if (handler(ref priority, item.LocalID)) + uint pqueue = item.PriorityQueue; + uint localid = item.Value.Entity.LocalId; + + if (handler(ref pqueue, item.Value.Entity)) { - if (lookup.Heap.ContainsHandle(lookup.Handle)) - lookup.Heap[lookup.Handle] = - new MinHeapItem(priority, item.Value, item.LocalID, this.m_comparison); + // unless the priority queue has changed, there is no need to modify + // the entry + pqueue = Util.Clamp(pqueue, 0, m_numberOfQueues - 1); + if (pqueue != item.PriorityQueue) + { + lookup.Heap.Remove(lookup.Handle); + + LookupItem litem = lookup; + litem.Heap = m_heaps[pqueue]; + litem.Heap.Add(new MinHeapItem(pqueue, item), ref litem.Handle); + m_lookupTable[localid] = litem; + } } else { - m_log.Warn("[LLCLIENTVIEW]: UpdatePriorityHandler returned false, dropping update"); + m_log.WarnFormat("[LLCLIENTVIEW]: UpdatePriorityHandler returned false for {0}",item.Value.Entity.UUID); lookup.Heap.Remove(lookup.Handle); - this.m_lookupTable.Remove(item.LocalID); + this.m_lookupTable.Remove(localid); } } } } + public override string ToString() + { + string s = ""; + for (int i = 0; i < m_numberOfQueues; i++) + { + if (s != "") s += ","; + s += m_heaps[i].Count.ToString(); + } + return s; + } + #region MinHeapItem private struct MinHeapItem : IComparable { - private double priority; private EntityUpdate value; - private uint local_id; - private Comparison comparison; + internal EntityUpdate Value { + get { + return this.value; + } + } + + private uint pqueue; + internal uint PriorityQueue { + get { + return this.pqueue; + } + } - internal MinHeapItem(double priority, EntityUpdate value, uint local_id) : - this(priority, value, local_id, Comparer.Default) { } - internal MinHeapItem(double priority, EntityUpdate value, uint local_id, IComparer comparer) : - this(priority, value, local_id, new Comparison(comparer.Compare)) { } - internal MinHeapItem(double priority, EntityUpdate value, uint local_id, Comparison comparison) + private Int32 entrytime; + internal Int32 EntryTime { + get { + return this.entrytime; + } + } + + private UInt64 entryorder; + internal UInt64 EntryOrder { - this.priority = priority; + get { + return this.entryorder; + } + } + + internal MinHeapItem(uint pqueue, MinHeapItem other) + { + this.entrytime = other.entrytime; + this.entryorder = other.entryorder; + this.value = other.value; + this.pqueue = pqueue; + } + + internal MinHeapItem(uint pqueue, UInt64 entryorder, EntityUpdate value) + { + this.entrytime = Util.EnvironmentTickCount(); + this.entryorder = entryorder; this.value = value; - this.local_id = local_id; - this.comparison = comparison; + this.pqueue = pqueue; } - internal double Priority { get { return this.priority; } } - internal EntityUpdate Value { get { return this.value; } } - internal uint LocalID { get { return this.local_id; } } - public override string ToString() { - StringBuilder sb = new StringBuilder(); - sb.Append("["); - sb.Append(this.priority.ToString()); - sb.Append(","); - if (this.value != null) - sb.Append(this.value.ToString()); - sb.Append("]"); - return sb.ToString(); + return String.Format("[{0},{1},{2}]",pqueue,entryorder,value.Entity.LocalId); } public int CompareTo(MinHeapItem other) { - return this.comparison(this.priority, other.priority); + // I'm assuming that the root part of an SOG is added to the update queue + // before the component parts + return Comparer.Default.Compare(this.EntryOrder, other.EntryOrder); } } #endregion diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index f9599f5..2764b05 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Scenes public class Prioritizer { -// private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); /// /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the @@ -76,7 +76,74 @@ namespace OpenSim.Region.Framework.Scenes m_scene = scene; } - public double GetUpdatePriority(IClientAPI client, ISceneEntity entity) +// + public uint GetUpdatePriority(IClientAPI client, ISceneEntity entity) + { + if (entity == null) + { + m_log.WarnFormat("[PRIORITIZER] attempt to prioritize null entity"); + throw new InvalidOperationException("Prioritization entity not defined"); + } + + // If this is an update for our own avatar give it the highest priority + if (client.AgentId == entity.UUID) + return 0; + + // Get this agent's position + ScenePresence presence = m_scene.GetScenePresence(client.AgentId); + if (presence == null) + { + m_log.WarnFormat("[PRIORITIZER] attempt to prioritize agent no longer in the scene"); + throw new InvalidOperationException("Prioritization agent not defined"); + } + + // Use group position for child prims + Vector3 entityPos = entity.AbsolutePosition; + if (entity is SceneObjectPart) + { + SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; + if (group != null) + entityPos = group.AbsolutePosition; + } + + // Use the camera position for local agents and avatar position for remote agents + Vector3 presencePos = (presence.IsChildAgent) ? + presence.AbsolutePosition : + presence.CameraPosition; + + // Compute the distance... + double distance = Vector3.Distance(presencePos, entityPos); + + // And convert the distance to a priority queue, this computation gives queues + // at 10, 20, 40, 80, 160, 320, 640, and 1280m + uint pqueue = 1; + for (int i = 0; i < 8; i++) + { + if (distance < 10 * Math.Pow(2.0,i)) + break; + pqueue++; + } + + // If this is a root agent, then determine front & back + // Bump up the priority queue for any objects behind the avatar + if (! presence.IsChildAgent) + { + // Root agent, decrease priority for objects behind us + Vector3 camPosition = presence.CameraPosition; + Vector3 camAtAxis = presence.CameraAtAxis; + + // Plane equation + float d = -Vector3.Dot(camPosition, camAtAxis); + float p = Vector3.Dot(camAtAxis, entityPos) + d; + if (p < 0.0f) + pqueue++; + } + + return pqueue; + } +// + + public double bGetUpdatePriority(IClientAPI client, ISceneEntity entity) { double priority = 0; -- cgit v1.1 From 0bd06d8ba85595a1707d2093a08a901b950ca120 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 4 Apr 2011 13:19:45 -0700 Subject: Fixed the prioritizer functions for the new priority queues --- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 292 +++++++------------------ 1 file changed, 82 insertions(+), 210 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 2764b05..a14bb70 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -60,15 +60,6 @@ namespace OpenSim.Region.Framework.Scenes { private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - /// - /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the - /// viewer before child prim updates. - /// The adjustment is added to child prims and subtracted from root prims, so the gap ends up - /// being double. We do it both ways so that there is a still a priority delta even if the priority is already - /// double.MinValue or double.MaxValue. - /// - private double m_childPrimAdjustmentFactor = 0.05; - private Scene m_scene; public Prioritizer(Scene scene) @@ -76,9 +67,19 @@ namespace OpenSim.Region.Framework.Scenes m_scene = scene; } -// + /// + /// Returns the priority queue into which the update should be placed. Updates within a + /// queue will be processed in arrival order. There are currently 12 priority queues + /// implemented in PriorityQueue class in LLClientView. Queue 0 is generally retained + /// for avatar updates. The fair queuing discipline for processing the priority queues + /// assumes that the number of entities in each priority queues increases exponentially. + /// So for example... if queue 1 contains all updates within 10m of the avatar or camera + /// then queue 2 at 20m is about 3X bigger in space & about 3X bigger in total number + /// of updates. + /// public uint GetUpdatePriority(IClientAPI client, ISceneEntity entity) { + // If entity is null we have a serious problem if (entity == null) { m_log.WarnFormat("[PRIORITIZER] attempt to prioritize null entity"); @@ -89,71 +90,12 @@ namespace OpenSim.Region.Framework.Scenes if (client.AgentId == entity.UUID) return 0; - // Get this agent's position - ScenePresence presence = m_scene.GetScenePresence(client.AgentId); - if (presence == null) - { - m_log.WarnFormat("[PRIORITIZER] attempt to prioritize agent no longer in the scene"); - throw new InvalidOperationException("Prioritization agent not defined"); - } - - // Use group position for child prims - Vector3 entityPos = entity.AbsolutePosition; - if (entity is SceneObjectPart) - { - SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; - if (group != null) - entityPos = group.AbsolutePosition; - } - - // Use the camera position for local agents and avatar position for remote agents - Vector3 presencePos = (presence.IsChildAgent) ? - presence.AbsolutePosition : - presence.CameraPosition; - - // Compute the distance... - double distance = Vector3.Distance(presencePos, entityPos); - - // And convert the distance to a priority queue, this computation gives queues - // at 10, 20, 40, 80, 160, 320, 640, and 1280m - uint pqueue = 1; - for (int i = 0; i < 8; i++) - { - if (distance < 10 * Math.Pow(2.0,i)) - break; - pqueue++; - } - - // If this is a root agent, then determine front & back - // Bump up the priority queue for any objects behind the avatar - if (! presence.IsChildAgent) - { - // Root agent, decrease priority for objects behind us - Vector3 camPosition = presence.CameraPosition; - Vector3 camAtAxis = presence.CameraAtAxis; - - // Plane equation - float d = -Vector3.Dot(camPosition, camAtAxis); - float p = Vector3.Dot(camAtAxis, entityPos) + d; - if (p < 0.0f) - pqueue++; - } - - return pqueue; - } -// - - public double bGetUpdatePriority(IClientAPI client, ISceneEntity entity) - { - double priority = 0; - - if (entity == null) - return 100000; + uint priority; switch (m_scene.UpdatePrioritizationScheme) { case UpdatePrioritizationSchemes.Time: - priority = GetPriorityByTime(); + priority = GetPriorityByTime(client, entity); break; case UpdatePrioritizationSchemes.Distance: priority = GetPriorityByDistance(client, entity); @@ -171,180 +113,110 @@ namespace OpenSim.Region.Framework.Scenes throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); } - // Adjust priority so that root prims are sent to the viewer first. This is especially important for - // attachments acting as huds, since current viewers fail to display hud child prims if their updates - // arrive before the root one. - if (entity is SceneObjectPart) - { - SceneObjectPart sop = ((SceneObjectPart)entity); - - if (sop.IsRoot) - { - if (priority >= double.MinValue + m_childPrimAdjustmentFactor) - priority -= m_childPrimAdjustmentFactor; - } - else - { - if (priority <= double.MaxValue - m_childPrimAdjustmentFactor) - priority += m_childPrimAdjustmentFactor; - } - } - return priority; } - private double GetPriorityByTime() + + private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) { - return DateTime.UtcNow.ToOADate(); + return 1; } - private double GetPriorityByDistance(IClientAPI client, ISceneEntity entity) + private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity) { - ScenePresence presence = m_scene.GetScenePresence(client.AgentId); - if (presence != null) - { - // If this is an update for our own avatar give it the highest priority - if (presence == entity) - return 0.0; - - // Use the camera position for local agents and avatar position for remote agents - Vector3 presencePos = (presence.IsChildAgent) ? - presence.AbsolutePosition : - presence.CameraPosition; - - // Use group position for child prims - Vector3 entityPos; - if (entity is SceneObjectPart) - { - // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene - // before its scheduled update was triggered - //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; - entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; - } - else - { - entityPos = entity.AbsolutePosition; - } - - return Vector3.DistanceSquared(presencePos, entityPos); - } - - return double.NaN; + return ComputeDistancePriority(client,entity,false); + } + + private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) + { + return ComputeDistancePriority(client,entity,true); } - private double GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) + private uint GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity) { + uint pqueue = ComputeDistancePriority(client,entity,true); + ScenePresence presence = m_scene.GetScenePresence(client.AgentId); if (presence != null) { - // If this is an update for our own avatar give it the highest priority - if (presence == entity) - return 0.0; - - // Use group position for child prims - Vector3 entityPos = entity.AbsolutePosition; - if (entity is SceneObjectPart) - { - // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene - // before its scheduled update was triggered - //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; - entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; - } - else - { - entityPos = entity.AbsolutePosition; - } - if (!presence.IsChildAgent) { - // Root agent. Use distance from camera and a priority decrease for objects behind us - Vector3 camPosition = presence.CameraPosition; - Vector3 camAtAxis = presence.CameraAtAxis; - - // Distance - double priority = Vector3.DistanceSquared(camPosition, entityPos); - - // Plane equation - float d = -Vector3.Dot(camPosition, camAtAxis); - float p = Vector3.Dot(camAtAxis, entityPos) + d; - if (p < 0.0f) priority *= 2.0; - - return priority; - } - else - { - // Child agent. Use the normal distance method - Vector3 presencePos = presence.AbsolutePosition; + if (entity is SceneObjectPart) + { + // Non physical prims are lower priority than physical prims + PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; + if (physActor == null || !physActor.IsPhysical) + pqueue++; - return Vector3.DistanceSquared(presencePos, entityPos); + // Attachments are high priority, + // MIC: shouldn't these already be in the highest priority queue already + // since their root position is same as the avatars? + if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) + pqueue = 1; + } } } - return double.NaN; + return pqueue; } - private double GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity) + private uint ComputeDistancePriority(IClientAPI client, ISceneEntity entity, bool useFrontBack) { - // If this is an update for our own avatar give it the highest priority - if (client.AgentId == entity.UUID) - return 0.0; - if (entity == null) - return double.NaN; - - // Use group position for child prims + // Get this agent's position + ScenePresence presence = m_scene.GetScenePresence(client.AgentId); + if (presence == null) + { + m_log.WarnFormat("[PRIORITIZER] attempt to prioritize agent no longer in the scene"); + throw new InvalidOperationException("Prioritization agent not defined"); + } + + // Use group position for child prims, since we are putting child prims in + // the same queue with the root of the group, the root prim (which goes into + // the queue first) should always be sent first, no need to adjust child prim + // priorities Vector3 entityPos = entity.AbsolutePosition; if (entity is SceneObjectPart) { SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; if (group != null) entityPos = group.AbsolutePosition; - else - entityPos = entity.AbsolutePosition; } - else - entityPos = entity.AbsolutePosition; - - ScenePresence presence = m_scene.GetScenePresence(client.AgentId); - if (presence != null) - { - if (!presence.IsChildAgent) - { - if (entity is ScenePresence) - return 1.0; - // Root agent. Use distance from camera and a priority decrease for objects behind us - Vector3 camPosition = presence.CameraPosition; - Vector3 camAtAxis = presence.CameraAtAxis; - - // Distance - double priority = Vector3.DistanceSquared(camPosition, entityPos); - - // Plane equation - float d = -Vector3.Dot(camPosition, camAtAxis); - float p = Vector3.Dot(camAtAxis, entityPos) + d; - if (p < 0.0f) priority *= 2.0; + // Use the camera position for local agents and avatar position for remote agents + Vector3 presencePos = (presence.IsChildAgent) ? + presence.AbsolutePosition : + presence.CameraPosition; - if (entity is SceneObjectPart) - { - PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; - if (physActor == null || !physActor.IsPhysical) - priority += 100; + // Compute the distance... + double distance = Vector3.Distance(presencePos, entityPos); - if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) - priority = 1.0; - } - return priority; - } - else - { - // Child agent. Use the normal distance method - Vector3 presencePos = presence.AbsolutePosition; + // And convert the distance to a priority queue, this computation gives queues + // at 10, 20, 40, 80, 160, 320, 640, and 1280m + uint pqueue = 1; + for (int i = 0; i < 8; i++) + { + if (distance < 10 * Math.Pow(2.0,i)) + break; + pqueue++; + } + + // If this is a root agent, then determine front & back + // Bump up the priority queue (drop the priority) for any objects behind the avatar + if (useFrontBack && ! presence.IsChildAgent) + { + // Root agent, decrease priority for objects behind us + Vector3 camPosition = presence.CameraPosition; + Vector3 camAtAxis = presence.CameraAtAxis; - return Vector3.DistanceSquared(presencePos, entityPos); - } + // Plane equation + float d = -Vector3.Dot(camPosition, camAtAxis); + float p = Vector3.Dot(camAtAxis, entityPos) + d; + if (p < 0.0f) + pqueue++; } - return double.NaN; + return pqueue; } + } } -- cgit v1.1 From 83dc2470f2e815f6f9d469104be3a2806438a29a Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 4 Apr 2011 14:18:26 -0700 Subject: Fix a bug in the computation of the RTO. Basically... the RTO (the time to wait to retransmit packets) always maxed out (no retransmissions for 24 or 48 seconds. Note that this is going to cause faster (and more) retransmissions. Fix for dynamic throttling needs to go with this. --- OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 65a8fe3..9a8bfd3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -149,7 +149,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Caches packed throttle information private byte[] m_packedThrottles; - private int m_defaultRTO = 3000; + private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC private int m_maxRTO = 60000; /// @@ -557,7 +557,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR)); // Clamp the retransmission timeout to manageable values - rto = Utils.Clamp(RTO, m_defaultRTO, m_maxRTO); + rto = Utils.Clamp(rto, m_defaultRTO, m_maxRTO); RTO = rto; -- cgit v1.1 From 19c6d1d569e081418e139d139c15ea66640288ba Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Wed, 6 Apr 2011 09:26:38 -0700 Subject: Split the priority queue class into a seperate file. LLClientView is big enough. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 205 ----------------- .../Region/ClientStack/LindenUDP/PriorityQueue.cs | 245 +++++++++++++++++++++ 2 files changed, 245 insertions(+), 205 deletions(-) create mode 100644 OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index a3f2c15..a724099 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -11805,209 +11805,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(pack, ThrottleOutPacketType.Task); } - #region PriorityQueue - public class PriorityQueue - { - internal delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity); - - // Heap[0] for self updates - // Heap[1..12] for entity updates - - internal const uint m_numberOfQueues = 12; - private MinHeap[] m_heaps = new MinHeap[m_numberOfQueues]; - private Dictionary m_lookupTable; - private object m_syncRoot = new object(); - private uint m_nextQueue = 0; - private UInt64 m_nextRequest = 0; - - internal PriorityQueue() : - this(MinHeap.DEFAULT_CAPACITY) { } - internal PriorityQueue(int capacity) - { - m_lookupTable = new Dictionary(capacity); - - for (int i = 0; i < m_heaps.Length; ++i) - m_heaps[i] = new MinHeap(capacity); - } - - public object SyncRoot { get { return this.m_syncRoot; } } - - internal int Count - { - get - { - int count = 0; - for (int i = 0; i < m_heaps.Length; ++i) - count += m_heaps[i].Count; - return count; - } - } - - public bool Enqueue(uint pqueue, EntityUpdate value) - { - LookupItem lookup; - - uint localid = value.Entity.LocalId; - UInt64 entry = m_nextRequest++; - if (m_lookupTable.TryGetValue(localid, out lookup)) - { - entry = lookup.Heap[lookup.Handle].EntryOrder; - value.Flags |= lookup.Heap[lookup.Handle].Value.Flags; - lookup.Heap.Remove(lookup.Handle); - } - - pqueue = Util.Clamp(pqueue, 0, m_numberOfQueues - 1); - lookup.Heap = m_heaps[pqueue]; - lookup.Heap.Add(new MinHeapItem(pqueue, entry, value), ref lookup.Handle); - m_lookupTable[localid] = lookup; - - return true; - } - - internal bool TryDequeue(out EntityUpdate value, out Int32 timeinqueue) - { - for (int i = 0; i < m_numberOfQueues; ++i) - { - // To get the fair queing, we cycle through each of the - // queues when finding an element to dequeue, this code - // assumes that the distribution of updates in the queues - // is polynomial, probably quadractic (eg distance of PI * R^2) - uint h = (uint)((m_nextQueue + i) % m_numberOfQueues); - if (m_heaps[h].Count > 0) - { - m_nextQueue = (uint)((h + 1) % m_numberOfQueues); - - MinHeapItem item = m_heaps[h].RemoveMin(); - m_lookupTable.Remove(item.Value.Entity.LocalId); - timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); - value = item.Value; - - return true; - } - } - - timeinqueue = 0; - value = default(EntityUpdate); - return false; - } - - internal void Reprioritize(UpdatePriorityHandler handler) - { - MinHeapItem item; - foreach (LookupItem lookup in new List(this.m_lookupTable.Values)) - { - if (lookup.Heap.TryGetValue(lookup.Handle, out item)) - { - uint pqueue = item.PriorityQueue; - uint localid = item.Value.Entity.LocalId; - - if (handler(ref pqueue, item.Value.Entity)) - { - // unless the priority queue has changed, there is no need to modify - // the entry - pqueue = Util.Clamp(pqueue, 0, m_numberOfQueues - 1); - if (pqueue != item.PriorityQueue) - { - lookup.Heap.Remove(lookup.Handle); - - LookupItem litem = lookup; - litem.Heap = m_heaps[pqueue]; - litem.Heap.Add(new MinHeapItem(pqueue, item), ref litem.Handle); - m_lookupTable[localid] = litem; - } - } - else - { - m_log.WarnFormat("[LLCLIENTVIEW]: UpdatePriorityHandler returned false for {0}",item.Value.Entity.UUID); - lookup.Heap.Remove(lookup.Handle); - this.m_lookupTable.Remove(localid); - } - } - } - } - - public override string ToString() - { - string s = ""; - for (int i = 0; i < m_numberOfQueues; i++) - { - if (s != "") s += ","; - s += m_heaps[i].Count.ToString(); - } - return s; - } - - #region MinHeapItem - private struct MinHeapItem : IComparable - { - private EntityUpdate value; - internal EntityUpdate Value { - get { - return this.value; - } - } - - private uint pqueue; - internal uint PriorityQueue { - get { - return this.pqueue; - } - } - - private Int32 entrytime; - internal Int32 EntryTime { - get { - return this.entrytime; - } - } - - private UInt64 entryorder; - internal UInt64 EntryOrder - { - get { - return this.entryorder; - } - } - - internal MinHeapItem(uint pqueue, MinHeapItem other) - { - this.entrytime = other.entrytime; - this.entryorder = other.entryorder; - this.value = other.value; - this.pqueue = pqueue; - } - - internal MinHeapItem(uint pqueue, UInt64 entryorder, EntityUpdate value) - { - this.entrytime = Util.EnvironmentTickCount(); - this.entryorder = entryorder; - this.value = value; - this.pqueue = pqueue; - } - - public override string ToString() - { - return String.Format("[{0},{1},{2}]",pqueue,entryorder,value.Entity.LocalId); - } - - public int CompareTo(MinHeapItem other) - { - // I'm assuming that the root part of an SOG is added to the update queue - // before the component parts - return Comparer.Default.Compare(this.EntryOrder, other.EntryOrder); - } - } - #endregion - - #region LookupItem - private struct LookupItem - { - internal MinHeap Heap; - internal IHandle Handle; - } - #endregion - } - public struct PacketProcessor { public PacketMethod method; @@ -12028,8 +11825,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - #endregion - public static OSD BuildEvent(string eventName, OSD eventBody) { OSDMap osdEvent = new OSDMap(2); diff --git a/OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs new file mode 100644 index 0000000..364ce4b --- /dev/null +++ b/OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs @@ -0,0 +1,245 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; + +using OpenSim.Framework; +using OpenSim.Framework.Client; +using log4net; + +namespace OpenSim.Region.ClientStack.LindenUDP +{ + public class PriorityQueue + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + internal delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity); + + // Heap[0] for self updates + // Heap[1..12] for entity updates + + internal const uint m_numberOfQueues = 12; + + private MinHeap[] m_heaps = new MinHeap[m_numberOfQueues]; + private Dictionary m_lookupTable; + private uint m_nextQueue = 0; + private UInt64 m_nextRequest = 0; + + private object m_syncRoot = new object(); + public object SyncRoot { + get { return this.m_syncRoot; } + } + + internal PriorityQueue() : this(MinHeap.DEFAULT_CAPACITY) { } + + internal PriorityQueue(int capacity) + { + m_lookupTable = new Dictionary(capacity); + + for (int i = 0; i < m_heaps.Length; ++i) + m_heaps[i] = new MinHeap(capacity); + } + + internal int Count + { + get + { + int count = 0; + for (int i = 0; i < m_heaps.Length; ++i) + count += m_heaps[i].Count; + return count; + } + } + + public bool Enqueue(uint pqueue, EntityUpdate value) + { + LookupItem lookup; + + uint localid = value.Entity.LocalId; + UInt64 entry = m_nextRequest++; + if (m_lookupTable.TryGetValue(localid, out lookup)) + { + entry = lookup.Heap[lookup.Handle].EntryOrder; + value.Flags |= lookup.Heap[lookup.Handle].Value.Flags; + lookup.Heap.Remove(lookup.Handle); + } + + pqueue = Util.Clamp(pqueue, 0, m_numberOfQueues - 1); + lookup.Heap = m_heaps[pqueue]; + lookup.Heap.Add(new MinHeapItem(pqueue, entry, value), ref lookup.Handle); + m_lookupTable[localid] = lookup; + + return true; + } + + internal bool TryDequeue(out EntityUpdate value, out Int32 timeinqueue) + { + for (int i = 0; i < m_numberOfQueues; ++i) + { + // To get the fair queing, we cycle through each of the + // queues when finding an element to dequeue, this code + // assumes that the distribution of updates in the queues + // is polynomial, probably quadractic (eg distance of PI * R^2) + uint h = (uint)((m_nextQueue + i) % m_numberOfQueues); + if (m_heaps[h].Count > 0) + { + m_nextQueue = (uint)((h + 1) % m_numberOfQueues); + + MinHeapItem item = m_heaps[h].RemoveMin(); + m_lookupTable.Remove(item.Value.Entity.LocalId); + timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); + value = item.Value; + + return true; + } + } + + timeinqueue = 0; + value = default(EntityUpdate); + return false; + } + + internal void Reprioritize(UpdatePriorityHandler handler) + { + MinHeapItem item; + foreach (LookupItem lookup in new List(this.m_lookupTable.Values)) + { + if (lookup.Heap.TryGetValue(lookup.Handle, out item)) + { + uint pqueue = item.PriorityQueue; + uint localid = item.Value.Entity.LocalId; + + if (handler(ref pqueue, item.Value.Entity)) + { + // unless the priority queue has changed, there is no need to modify + // the entry + pqueue = Util.Clamp(pqueue, 0, m_numberOfQueues - 1); + if (pqueue != item.PriorityQueue) + { + lookup.Heap.Remove(lookup.Handle); + + LookupItem litem = lookup; + litem.Heap = m_heaps[pqueue]; + litem.Heap.Add(new MinHeapItem(pqueue, item), ref litem.Handle); + m_lookupTable[localid] = litem; + } + } + else + { + // m_log.WarnFormat("[PQUEUE]: UpdatePriorityHandler returned false for {0}",item.Value.Entity.UUID); + lookup.Heap.Remove(lookup.Handle); + this.m_lookupTable.Remove(localid); + } + } + } + } + + public override string ToString() + { + string s = ""; + for (int i = 0; i < m_numberOfQueues; i++) + { + if (s != "") s += ","; + s += m_heaps[i].Count.ToString(); + } + return s; + } + +#region MinHeapItem + private struct MinHeapItem : IComparable + { + private EntityUpdate value; + internal EntityUpdate Value { + get { + return this.value; + } + } + + private uint pqueue; + internal uint PriorityQueue { + get { + return this.pqueue; + } + } + + private Int32 entrytime; + internal Int32 EntryTime { + get { + return this.entrytime; + } + } + + private UInt64 entryorder; + internal UInt64 EntryOrder + { + get { + return this.entryorder; + } + } + + internal MinHeapItem(uint pqueue, MinHeapItem other) + { + this.entrytime = other.entrytime; + this.entryorder = other.entryorder; + this.value = other.value; + this.pqueue = pqueue; + } + + internal MinHeapItem(uint pqueue, UInt64 entryorder, EntityUpdate value) + { + this.entrytime = Util.EnvironmentTickCount(); + this.entryorder = entryorder; + this.value = value; + this.pqueue = pqueue; + } + + public override string ToString() + { + return String.Format("[{0},{1},{2}]",pqueue,entryorder,value.Entity.LocalId); + } + + public int CompareTo(MinHeapItem other) + { + // I'm assuming that the root part of an SOG is added to the update queue + // before the component parts + return Comparer.Default.Compare(this.EntryOrder, other.EntryOrder); + } + } +#endregion + +#region LookupItem + private struct LookupItem + { + internal MinHeap Heap; + internal IHandle Handle; + } +#endregion + } +} -- cgit v1.1 From ebc249e3bef57aee656936f5e63842d83ee29fff Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Sun, 10 Apr 2011 17:02:40 -0700 Subject: Changed the "not in scene" check in the prioritizier to just a warning. There appears to be a race condition on slow logins that attempts to prioritize before the scene presence is fully initialized. --- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index a14bb70..4694e2b 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -166,8 +166,9 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence presence = m_scene.GetScenePresence(client.AgentId); if (presence == null) { - m_log.WarnFormat("[PRIORITIZER] attempt to prioritize agent no longer in the scene"); - throw new InvalidOperationException("Prioritization agent not defined"); + m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId); + // throw new InvalidOperationException("Prioritization agent not defined"); + return Int32.MaxValue; } // Use group position for child prims, since we are putting child prims in -- cgit v1.1 From f778056c7a81443b11c0c4288979af3a8c6b5b9f Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 11 Apr 2011 08:37:43 -0700 Subject: Removed some priority queue debugging code --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 80 ---------------------- 1 file changed, 80 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index a724099..b5bf26d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -300,77 +300,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Used to adjust Sun Orbit values so Linden based viewers properly position sun private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f; - // First log file or time has expired, start writing to a new log file -// -// ----------------------------------------------------------------- -// ----------------------------------------------------------------- -// THIS IS DEBUGGING CODE & SHOULD BE REMOVED -// ----------------------------------------------------------------- -// ----------------------------------------------------------------- - public class QueueLogger - { - public Int32 start = 0; - public StreamWriter Log = null; - private Dictionary m_idMap = new Dictionary(); - - public QueueLogger() - { - DateTime now = DateTime.Now; - String fname = String.Format("queue-{0}.log", now.ToString("yyyyMMddHHmmss")); - Log = new StreamWriter(fname); - - start = Util.EnvironmentTickCount(); - } - - public int LookupID(UUID uuid) - { - int localid; - if (! m_idMap.TryGetValue(uuid,out localid)) - { - localid = m_idMap.Count + 1; - m_idMap[uuid] = localid; - } - - return localid; - } - } - - public static QueueLogger QueueLog = null; - - // ----------------------------------------------------------------- - public void LogAvatarUpdateEvent(UUID client, UUID avatar, Int32 timeinqueue) - { - if (QueueLog == null) - QueueLog = new QueueLogger(); - - Int32 ticks = Util.EnvironmentTickCountSubtract(QueueLog.start); - lock(QueueLog) - { - int cid = QueueLog.LookupID(client); - int aid = QueueLog.LookupID(avatar); - QueueLog.Log.WriteLine("{0},AU,AV{1:D4},AV{2:D4},{3}",ticks,cid,aid,timeinqueue); - } - } - - // ----------------------------------------------------------------- - public void LogQueueProcessEvent(UUID client, PriorityQueue queue, uint maxup) - { - if (QueueLog == null) - QueueLog = new QueueLogger(); - - Int32 ticks = Util.EnvironmentTickCountSubtract(QueueLog.start); - lock(QueueLog) - { - int cid = QueueLog.LookupID(client); - QueueLog.Log.WriteLine("{0},PQ,AV{1:D4},{2},{3}",ticks,cid,maxup,queue.ToString()); - } - } -// ----------------------------------------------------------------- -// ----------------------------------------------------------------- -// ----------------------------------------------------------------- -// ----------------------------------------------------------------- -// - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected static Dictionary PacketHandlers = new Dictionary(); //Global/static handlers for all clients @@ -3667,10 +3596,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP int updatesThisCall = 0; -// -// DEBUGGING CODE... REMOVE -// LogQueueProcessEvent(this.m_agentId,m_entityUpdates,m_maxUpdates); -// // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race // condition where a kill can be processed before an out-of-date update for the same object. lock (m_killRecord) @@ -3687,11 +3612,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP avgTimeDilation += update.TimeDilation; avgTimeDilation *= 0.5f; -// -// DEBUGGING CODE... REMOVE -// if (update.Entity is ScenePresence) -// LogAvatarUpdateEvent(this.m_agentId,update.Entity.UUID,timeinqueue); -// if (update.Entity is SceneObjectPart) { -- cgit v1.1 From d6948b15c47fd067be6d7cef31caf8e49e9c9afa Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 11 Apr 2011 21:51:17 +0100 Subject: Make it more obvious when it happens that DLL plugin loading fails. Improve exception output on Windows. --- OpenSim/Region/Framework/ModuleLoader.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/ModuleLoader.cs b/OpenSim/Region/Framework/ModuleLoader.cs index 23be9c2..14ecd44 100644 --- a/OpenSim/Region/Framework/ModuleLoader.cs +++ b/OpenSim/Region/Framework/ModuleLoader.cs @@ -223,7 +223,8 @@ namespace OpenSim.Region.Framework catch (Exception e) { m_log.ErrorFormat( - "[MODULES]: Could not load types for [{0}]. Exception {1}", pluginAssembly.FullName, e); + "[MODULES]: Could not load types for plugin DLL {0}. Exception {1} {2}", + pluginAssembly.FullName, e.Message, e.StackTrace); // justincc: Right now this is fatal to really get the user's attention throw e; -- cgit v1.1 From 0bd6bc8fba1ed35344218e2aa25e30a3294f2ed1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 11 Apr 2011 21:59:26 +0100 Subject: create "config show" as a region console command synonym for "config get". This is to create greater consistency with all the other show commands. --- OpenSim/Region/Application/OpenSim.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index ec1fb04..39004d4 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -341,10 +341,15 @@ namespace OpenSim m_console.Commands.AddCommand("region", false, "config get", "config get [
] []", - "Show a config option", + "Synonym for config show", + HandleConfig); + + m_console.Commands.AddCommand("region", false, "config show", + "config show [
] []", + "Show config information", "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine + "If a section is given but not a field, then all fields in that section are printed.", - HandleConfig); + HandleConfig); m_console.Commands.AddCommand("region", false, "config save", "config save ", @@ -593,7 +598,9 @@ namespace OpenSim if (cmdparams.Length > 0) { - switch (cmdparams[0].ToLower()) + string firstParam = cmdparams[0].ToLower(); + + switch (firstParam) { case "set": if (cmdparams.Length < 4) @@ -618,6 +625,7 @@ namespace OpenSim break; case "get": + case "show": if (cmdparams.Length == 1) { foreach (IConfig config in m_config.Source.Configs) @@ -654,8 +662,8 @@ namespace OpenSim } else { - Notice("Syntax: config get [
] []"); - Notice("Example: config get ScriptEngine.DotNetEngine NumberOfScriptThreads"); + Notice("Syntax: config {0} [
] []", firstParam); + Notice("Example: config {0} ScriptEngine.DotNetEngine NumberOfScriptThreads", firstParam); } break; -- cgit v1.1 From 464fa45ec90767af13bd8edcc7c67de4ec3db6a7 Mon Sep 17 00:00:00 2001 From: E. Allen Soard Date: Fri, 8 Apr 2011 18:30:20 -0700 Subject: Implimented HTTP_VERIFY_CERT for llHttpRequest --- .../Scripting/HttpRequest/ScriptsHttpRequests.cs | 34 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index d78931a..a37c781 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -29,8 +29,10 @@ using System; using System.Collections.Generic; using System.IO; using System.Net; +using System.Net.Security; using System.Text; using System.Threading; +using System.Security.Cryptography.X509Certificates; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -84,6 +86,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Scripting.HttpRequest { + public class HttpRequestModule : IRegionModule, IHttpRequestModule { private object HttpListLock = new object(); @@ -100,8 +103,23 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest public HttpRequestModule() { + ServicePointManager.ServerCertificateValidationCallback +=ValidateServerCertificate; } + public static bool ValidateServerCertificate( + object sender, + X509Certificate certificate, + X509Chain chain, + SslPolicyErrors sslPolicyErrors) + { + HttpWebRequest Request = (HttpWebRequest)sender; + + if(Request.Headers.Get("NoVerifyCert") != null) + { + return true; + } + return chain.Build(new X509Certificate2(certificate)); + } #region IHttpRequestModule Members public UUID MakeHttpRequest(string url, string parameters, string body) @@ -141,8 +159,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest break; case (int)HttpRequestConstants.HTTP_VERIFY_CERT: - - // TODO implement me + htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0); break; } } @@ -282,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest public string HttpMethod = "GET"; public string HttpMIMEType = "text/plain;charset=utf-8"; public int HttpTimeout; - // public bool HttpVerifyCert = true; // not implemented + public bool HttpVerifyCert = true; // not implemented private Thread httpThread; // Request info @@ -344,6 +361,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest Request.Method = HttpMethod; Request.ContentType = HttpMIMEType; + if(!HttpVerifyCert) + { + // Connection Group Name is probably not used so we hijack it to identify + // a desired security exception +// Request.ConnectionGroupName="NoVerify"; + Request.Headers.Add("NoVerifyCert" , "true"); + } +// else +// { +// Request.ConnectionGroupName="Verify"; +// } if (proxyurl != null && proxyurl.Length > 0) { if (proxyexcepts != null && proxyexcepts.Length > 0) -- cgit v1.1 From 3a98fb080a751d21999bb2baa769462426b5d776 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 11 Apr 2011 22:29:08 +0100 Subject: minor: adjust some spacing and indentation --- .../Scripting/HttpRequest/ScriptsHttpRequests.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index a37c781..23e15ef 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -86,7 +86,6 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Scripting.HttpRequest { - public class HttpRequestModule : IRegionModule, IHttpRequestModule { private object HttpListLock = new object(); @@ -114,10 +113,11 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest { HttpWebRequest Request = (HttpWebRequest)sender; - if(Request.Headers.Get("NoVerifyCert") != null) + if (Request.Headers.Get("NoVerifyCert") != null) { return true; } + return chain.Build(new X509Certificate2(certificate)); } #region IHttpRequestModule Members @@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest * Not sure how important ordering is is here - the next first * one completed in the list is returned, based soley on its list * position, not the order in which the request was started or - * finsihed. I thought about setting up a queue for this, but + * finished. I thought about setting up a queue for this, but * it will need some refactoring and this works 'enough' right now */ @@ -254,8 +254,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest m_scene.RegisterModuleInterface(this); - m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); - m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); + m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); + m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); m_pendingRequests = new Dictionary(); } @@ -363,10 +363,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest if(!HttpVerifyCert) { - // Connection Group Name is probably not used so we hijack it to identify - // a desired security exception -// Request.ConnectionGroupName="NoVerify"; - Request.Headers.Add("NoVerifyCert" , "true"); + // We could hijack Connection Group Name to identify + // a desired security exception. But at the moment we'll use a dummy header instead. +// Request.ConnectionGroupName = "NoVerify"; + Request.Headers.Add("NoVerifyCert", "true"); } // else // { @@ -464,4 +464,4 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest } } } -} +} \ No newline at end of file -- cgit v1.1 From e8ecb2898c55bb97d47e9b1efb7dac98d40609cd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 11 Apr 2011 22:33:24 +0100 Subject: minor: remove some mono compiler warnings --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c16a985..aa28fa0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10289,12 +10289,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID rq = UUID.Random(); - UUID tid = AsyncCommands. - DataserverPlugin.RegisterRequest(m_localID, - m_itemID, rq.ToString()); + AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); - AsyncCommands. - DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); + AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); return rq.ToString(); } @@ -10308,12 +10305,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID rq = UUID.Random(); - UUID tid = AsyncCommands. - DataserverPlugin.RegisterRequest(m_localID, - m_itemID, rq.ToString()); + AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); - AsyncCommands. - DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); + AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); return rq.ToString(); } -- cgit v1.1 From 64dc7e9f141fd0f168ed90c11f932a8bdb077dc7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 11 Apr 2011 22:35:07 +0100 Subject: minor: remove now inaccurate comment --- OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 23e15ef..4c8424d 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -299,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest public string HttpMethod = "GET"; public string HttpMIMEType = "text/plain;charset=utf-8"; public int HttpTimeout; - public bool HttpVerifyCert = true; // not implemented + public bool HttpVerifyCert = true; private Thread httpThread; // Request info -- cgit v1.1 From 98d7de22dc44ca1e5971301c02a6a1fe49620889 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Apr 2011 18:31:41 +0100 Subject: Fix (add) ability to rez objects by dragging them out of another prim's inventory. This should happen if the client supplies a task ID with the RezObject call. The rez goes through the same code as llRezObject(), so the same perms are applied. Rotation isn't yet preserved, this should be fixed shortly. --- .../InventoryAccess/InventoryAccessModule.cs | 4 ++ OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 59 ++++++++++++++++++++-- 2 files changed, 58 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 9fbfc34..cdee53c 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -552,8 +552,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess /// /// Rez an object into the scene from the user's inventory /// + /// /// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing /// things to the scene. The caller should be doing that, I think. + /// /// /// /// @@ -570,6 +572,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) { +// m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); + // Work out position details byte bRayEndIsIntersection = (byte)0; diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 73dd531..4370850 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1955,11 +1955,60 @@ namespace OpenSim.Region.Framework.Scenes UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID) { - IInventoryAccessModule invAccess = RequestModuleInterface(); - if (invAccess != null) - invAccess.RezObject( - remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, - RezSelected, RemoveItem, fromTaskID, false); +// m_log.DebugFormat( +// "[PRIM INVENTORY]: RezObject from {0} for item {1} from task id {2}", +// remoteClient.Name, itemID, fromTaskID); + + if (fromTaskID == UUID.Zero) + { + IInventoryAccessModule invAccess = RequestModuleInterface(); + if (invAccess != null) + invAccess.RezObject( + remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, + RezSelected, RemoveItem, fromTaskID, false); + } + else + { + SceneObjectPart part = GetSceneObjectPart(fromTaskID); + if (part == null) + { + m_log.ErrorFormat( + "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such scene object", + remoteClient.Name, itemID, fromTaskID); + + return; + } + + TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID); + if (item == null) + { + m_log.ErrorFormat( + "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such item", + remoteClient.Name, itemID, fromTaskID); + + return; + } + + // Work out position details + byte bRayEndIsIntersection = (byte)0; + + if (RayEndIsIntersection) + { + bRayEndIsIntersection = (byte)1; + } + else + { + bRayEndIsIntersection = (byte)0; + } + + Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); + Vector3 pos + = GetNewRezLocation( + RayStart, RayEnd, RayTargetID, Quaternion.Identity, + BypassRayCast, bRayEndIsIntersection, true, scale, false); + + RezObject(part, item, pos, Quaternion.Identity, Vector3.Zero, 0); + } } /// -- cgit v1.1 From 3ba5eeb6c3b7c6381ca1e0ed87bce44049f96e37 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Apr 2011 22:15:40 +0100 Subject: Allow a null rotation to be passed in to RezObject so that we can control whether to use the serialized rotation or not. Not used yet. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 4370850..87b4cb8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2016,14 +2016,14 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - /// - /// - /// + /// The position of the rezzed object. + /// The rotation of the rezzed object. If null, then the rotation stored with the object + /// will be used if it exists. + /// The velocity of the rezzed object. /// /// The SceneObjectGroup rezzed or null if rez was unsuccessful public virtual SceneObjectGroup RezObject( - SceneObjectPart sourcePart, TaskInventoryItem item, - Vector3 pos, Quaternion rot, Vector3 vel, int param) + SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param) { if (null == item) return null; @@ -2041,8 +2041,14 @@ namespace OpenSim.Region.Framework.Scenes if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) sourcePart.Inventory.RemoveInventoryItem(item.ItemID); } - - AddNewSceneObject(group, true, pos, rot, vel); + + AddNewSceneObject(group, true); + + group.AbsolutePosition = pos; + group.Velocity = vel; + + if (rot != null) + group.UpdateGroupRotationR((Quaternion)rot); // We can only call this after adding the scene object, since the scene object references the scene // to find out if scripts should be activated at all. -- cgit v1.1 From 8e0d2cc43b63046b0dd6b9a3a7dafd70a70362d0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Apr 2011 22:21:46 +0100 Subject: If an object is rezzed directly from a prim inventory then give it the rotation it was stored with. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 87b4cb8..254879b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2007,7 +2007,7 @@ namespace OpenSim.Region.Framework.Scenes RayStart, RayEnd, RayTargetID, Quaternion.Identity, BypassRayCast, bRayEndIsIntersection, true, scale, false); - RezObject(part, item, pos, Quaternion.Identity, Vector3.Zero, 0); + RezObject(part, item, pos, null, Vector3.Zero, 0); } } -- cgit v1.1 From b0889ed92a3c7d152f9b05aec1ce00dfc010e34e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Apr 2011 22:30:43 +0100 Subject: refactor: simplify bRayEndIsIntersection boolean set from RayEndIsIntersection byte --- .../Framework/InventoryAccess/InventoryAccessModule.cs | 15 +-------------- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 13 +------------ 2 files changed, 2 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index cdee53c..73b0a35 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -574,21 +574,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); - // Work out position details - byte bRayEndIsIntersection = (byte)0; - - if (RayEndIsIntersection) - { - bRayEndIsIntersection = (byte)1; - } - else - { - bRayEndIsIntersection = (byte)0; - } - + byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); - - Vector3 pos = m_Scene.GetNewRezLocation( RayStart, RayEnd, RayTargetID, Quaternion.Identity, BypassRayCast, bRayEndIsIntersection, true, scale, false); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 254879b..0f85925 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1989,18 +1989,7 @@ namespace OpenSim.Region.Framework.Scenes return; } - // Work out position details - byte bRayEndIsIntersection = (byte)0; - - if (RayEndIsIntersection) - { - bRayEndIsIntersection = (byte)1; - } - else - { - bRayEndIsIntersection = (byte)0; - } - + byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); Vector3 pos = GetNewRezLocation( -- cgit v1.1