From 632908db9e4810a7f181e23b7188e81ec2f88bc3 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 20 Aug 2012 09:46:41 +0100 Subject: [PATCH 01/11] adding sqlite journal files to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 36a1757338..bf3ac37e0c 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ bin/Debug/*.dll bin/*.dll.mdb bin/*.db +bin/*.db-journal bin/addin-db-* bin/*.dll bin/OpenSim.vshost.exe.config From d188272462f2c8d3e67aead26bb5b15ab243cdab Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 13:52:30 +0100 Subject: [PATCH 02/11] refactoring using List.ConvertAll --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0d275f7424..a98fb04f2a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5170,17 +5170,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { string ret = String.Empty; - int x = 0; m_host.AddScriptLPS(1); if (src.Data.Length > 0) { - ret = src.Data[x++].ToString(); - for (; x < src.Data.Length; x++) - { - ret += ", "+src.Data[x].ToString(); - } + ret = string.Join(", ", + (new List(src.Data)).ConvertAll(o => + { + return o.ToString(); + }).ToArray()); } return ret; From 582a256646d1093b2c8889d89dbaa88f1c5fc81d Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 13:53:53 +0100 Subject: [PATCH 03/11] immediately returning the string.Join operation instead of checking if the list has members --- .../Shared/Api/Implementation/LSL_Api.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a98fb04f2a..bbbc6ccea9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5169,20 +5169,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llList2CSV(LSL_List src) { - string ret = String.Empty; m_host.AddScriptLPS(1); - if (src.Data.Length > 0) - { - ret = string.Join(", ", - (new List(src.Data)).ConvertAll(o => - { - return o.ToString(); - }).ToArray()); - } - - return ret; + return string.Join(", ", + (new List(src.Data)).ConvertAll(o => + { + return o.ToString(); + }).ToArray()); } /// From 67477290ad34f7350495c2787022eed5d1d535d8 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 13:56:42 +0100 Subject: [PATCH 04/11] stripping superfluous whitespace Signed-off-by: Melanie --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bbbc6ccea9..2bfb9b3e40 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5165,11 +5165,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// separated list. There is a space after /// each comma. /// - public LSL_String llList2CSV(LSL_List src) { - - m_host.AddScriptLPS(1); return string.Join(", ", From cd325fdf021be20876340c85201efbd8e918028a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 24 Aug 2012 21:36:20 +0100 Subject: [PATCH 05/11] Pass the "attachToBackup" bool given to SceneGraph.AddNewSceneObject() down into the 3-parameter AddNewSceneObject() method instead of always hardcoding true. This doesn't affect any core OpenSimulator code since all callers were passing true anyway But it allows region modules to create objects that are never persisted. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index b6339fb636..209a770396 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -300,7 +300,7 @@ namespace OpenSim.Region.Framework.Scenes public bool AddNewSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) { - AddNewSceneObject(sceneObject, true, false); + AddNewSceneObject(sceneObject, attachToBackup, false); if (pos != null) sceneObject.AbsolutePosition = (Vector3)pos; From 476996bee86702227eedd3c953000891027faac4 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 24 Aug 2012 22:38:07 +0100 Subject: [PATCH 06/11] If a connecting scene presence is replacing an existing scene presence then bypass close checks. --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ad7418970c..2b4dea4a4a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3562,7 +3562,7 @@ namespace OpenSim.Region.Framework.Scenes "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", sp.Name, sp.UUID, RegionInfo.RegionName); - sp.ControllingClient.Close(); + sp.ControllingClient.Close(true); sp = null; } From ba58331b29225ead620087ca4ff3bae4a905994d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 24 Aug 2012 22:56:05 +0100 Subject: [PATCH 07/11] Extend "Restarting scripts in attachments" debug log message to show actual name of user and the region they are in --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 65d526fd4e..5bf69ad64e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -891,7 +891,9 @@ namespace OpenSim.Region.Framework.Scenes { if (wasChild && HasAttachments()) { - m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); + m_log.DebugFormat( + "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); + // Resume scripts foreach (SceneObjectGroup sog in m_attachments) { From f3a5e3a02b5422fad607695aac0bffd17152434b Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 25 Aug 2012 00:42:32 +0100 Subject: [PATCH 08/11] Log initial script startup info notice when xengine actually starts to do this for debugging purposes, rather than before it actually starts to do this. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 +- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 675c64dabe..3b59dc4866 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -93,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void StartScripts() { - m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName); +// m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName); IScriptModule[] engines = RequestModuleInterfaces(); diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 5a3f002c53..0460f22b6a 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -923,6 +923,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine // This delay exists to stop mono problems where script compilation and startup would stop the sim // working properly for the session. System.Threading.Thread.Sleep(m_StartDelay); + + m_log.InfoFormat("[XEngine]: Performing initial script startup on {0}", m_Scene.Name); } object[] o; @@ -938,13 +940,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (m_InitialStartup) if (scriptsStarted % 50 == 0) m_log.InfoFormat( - "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName); + "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.Name); } } if (m_InitialStartup) m_log.InfoFormat( - "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.RegionInfo.RegionName); + "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.Name); // NOTE: Despite having a lockless queue, this lock is required // to make sure there is never no compile thread while there From e04047152f2d3ea7f52f746ab2ddac3328c8e97d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 25 Aug 2012 00:49:38 +0100 Subject: [PATCH 09/11] minor: Fix bad log message for failure to create an inventory folder --- OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 2701d6ef8a..6e53951003 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -468,7 +468,7 @@ namespace OpenSim.Region.Framework.Scenes if (!InventoryService.AddFolder(folder)) { m_log.WarnFormat( - "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", + "[AGENT INVENTORY]: Failed to create folder for user {0} {1}", remoteClient.Name, remoteClient.AgentId); } } From f8a89a79eb8ae8cc2bfdcbbf2cb498e5293162c3 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 25 Aug 2012 01:09:12 +0100 Subject: [PATCH 10/11] Allow multiple calling card type inventory folders to be created. Modern viewers want to create Friends and All folders of this type inside the root Calling Cards folder. --- OpenSim/Services/InventoryService/XInventoryService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 7518b86f0b..e10e0be82c 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -311,6 +311,7 @@ namespace OpenSim.Services.InventoryService if (folder.Type == (short)AssetType.Folder || folder.Type == (short)AssetType.Unknown || folder.Type == (short)AssetType.OutfitFolder + || folder.Type == (short)AssetType.CallingCard || GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null) { XInventoryFolder xFolder = ConvertFromOpenSim(folder); From a0d178b284050df64d0eb5b9728565fd72615c22 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 25 Aug 2012 02:00:17 +0100 Subject: [PATCH 11/11] Following on from f8a89a79, do not allow more than one 'type' folder (e.g. calling cards) to be created in the base "My Inventory" user folder. This is to accomodate situations where viewers will create more than one 'type' subfolder (e.g. calling cards) But at the same time to prevent multiple such 'system' folders (those in the base "My Inventory" user folder). This also makes GetFolderForType() only return a folder in the base "My Inventory" folder, if such a type folder exists --- .../InventoryService/XInventoryService.cs | 65 ++++++++++++++----- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index e10e0be82c..deacd5a4b4 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -229,10 +229,28 @@ namespace OpenSim.Services.InventoryService public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) { // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); + + InventoryFolderBase rootFolder = GetRootFolder(principalID); + + if (rootFolder == null) + { + m_log.WarnFormat( + "[XINVENTORY]: Found no root folder for {0} in GetFolderForType() when looking for {1}", + principalID, type); + + return null; + } + + return GetSystemFolderForType(rootFolder, type); + } + + private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, AssetType type) + { +// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); XInventoryFolder[] folders = m_Database.GetFolders( - new string[] { "agentID", "type"}, - new string[] { principalID.ToString(), ((int)type).ToString() }); + new string[] { "agentID", "parentFolderID", "type"}, + new string[] { rootFolder.Owner.ToString(), rootFolder.ID.ToString(), ((int)type).ToString() }); if (folders.Length == 0) { @@ -308,23 +326,38 @@ namespace OpenSim.Services.InventoryService if (check != null) return false; - if (folder.Type == (short)AssetType.Folder - || folder.Type == (short)AssetType.Unknown - || folder.Type == (short)AssetType.OutfitFolder - || folder.Type == (short)AssetType.CallingCard - || GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null) + if (folder.Type != (short)AssetType.Folder || folder.Type != (short)AssetType.Unknown) { - XInventoryFolder xFolder = ConvertFromOpenSim(folder); - return m_Database.StoreFolder(xFolder); - } - else - { - m_log.WarnFormat( - "[XINVENTORY]: Folder of type {0} already exists when tried to add {1} to {2} for {3}", - folder.Type, folder.Name, folder.ParentID, folder.Owner); + InventoryFolderBase rootFolder = GetRootFolder(folder.Owner); + + if (rootFolder == null) + { + m_log.WarnFormat( + "[XINVENTORY]: Found no root folder for {0} in AddFolder() when looking for {1}", + folder.Owner, folder.Type); + + return false; + } + + // Check we're not trying to add this as a system folder. + if (folder.ParentID == rootFolder.ID) + { + InventoryFolderBase existingSystemFolder + = GetSystemFolderForType(rootFolder, (AssetType)folder.Type); + + if (existingSystemFolder != null) + { + m_log.WarnFormat( + "[XINVENTORY]: System folder of type {0} already exists when tried to add {1} to {2} for {3}", + folder.Type, folder.Name, folder.ParentID, folder.Owner); + + return false; + } + } } - return false; + XInventoryFolder xFolder = ConvertFromOpenSim(folder); + return m_Database.StoreFolder(xFolder); } public virtual bool UpdateFolder(InventoryFolderBase folder)