From 2b5eba9c7438ef0175c91c1910ce2d660d930fed Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Fri, 8 Feb 2013 12:00:16 -0800 Subject: Fix the return values for JsonDestroyStore, JsonRemoveValue, and JsonSetValue. Fix the link message status when reading a notecard. --- .../Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs') diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs index 3b52e44..3249aa3 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs @@ -239,7 +239,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore if (! m_enabled) return false; lock (m_JsonValueStore) - m_JsonValueStore.Remove(storeID); + return m_JsonValueStore.Remove(storeID); return true; } @@ -311,8 +311,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore try { lock (map) - if (map.SetValue(path,value,useJson)) - return true; + return map.SetValue(path,value,useJson); } catch (Exception e) { @@ -344,8 +343,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore try { lock (map) - if (map.RemoveValue(path)) - return true; + return map.RemoveValue(path); } catch (Exception e) { -- cgit v1.1 From e93defd0ca326754d1bd5a1a503d6d47428272be Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Fri, 8 Feb 2013 15:07:43 -0800 Subject: Adds size limits to JsonStore. Adds a separate configuration variable to enable binding to dynamic attributes. --- .../Scripting/JsonStore/JsonStoreModule.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs') diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs index 3249aa3..f1ce856 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs @@ -54,6 +54,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore private IConfig m_config = null; private bool m_enabled = false; + private bool m_enableObjectStore = false; + private int m_maxStringSpace = Int32.MaxValue; + private Scene m_scene = null; private Dictionary m_JsonValueStore; @@ -90,6 +93,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore } m_enabled = m_config.GetBoolean("Enabled", m_enabled); + m_enableObjectStore = m_config.GetBoolean("EnableObjectStore", m_enableObjectStore); + m_maxStringSpace = m_config.GetInt("MaxStringSpace", m_maxStringSpace); + if (m_maxStringSpace == 0) + m_maxStringSpace = Int32.MaxValue; } catch (Exception e) { @@ -178,6 +185,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore public bool AttachObjectStore(UUID objectID) { if (! m_enabled) return false; + if (! m_enableObjectStore) return false; SceneObjectPart sop = m_scene.GetSceneObjectPart(objectID); if (sop == null) @@ -311,7 +319,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore try { lock (map) + { + if (map.StringSpace > m_maxStringSpace) + { + m_log.WarnFormat("[JsonStore] {0} exceeded string size; {1} bytes used of {2} limit", + storeID,map.StringSpace,m_maxStringSpace); + return false; + } + return map.SetValue(path,value,useJson); + } } catch (Exception e) { -- cgit v1.1