aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-02-28 21:19:23 +0000
committerJustin Clark-Casey (justincc)2013-02-28 21:19:23 +0000
commit239a8da74e87bb22bb9107a0341829ff99bbd3fe (patch)
tree059993bcfa80826e440be46d5310798019bb1f91 /OpenSim
parentFix bug where simultaneous calls by different scripts to llGetNotecardLine() ... (diff)
downloadopensim-SC_OLD-239a8da74e87bb22bb9107a0341829ff99bbd3fe.zip
opensim-SC_OLD-239a8da74e87bb22bb9107a0341829ff99bbd3fe.tar.gz
opensim-SC_OLD-239a8da74e87bb22bb9107a0341829ff99bbd3fe.tar.bz2
opensim-SC_OLD-239a8da74e87bb22bb9107a0341829ff99bbd3fe.tar.xz
Fix potential concurrency issue since the LSL notecard cache was not being checked for expiry under lock
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs17
1 files changed, 10 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ec24dc2..ab087af 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -11689,7 +11689,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11689 11689
11690 public static void Cache(UUID assetID, string text) 11690 public static void Cache(UUID assetID, string text)
11691 { 11691 {
11692 CacheCheck(); 11692 CheckCache();
11693 11693
11694 lock (m_Notecards) 11694 lock (m_Notecards)
11695 { 11695 {
@@ -11774,14 +11774,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11774 return line; 11774 return line;
11775 } 11775 }
11776 11776
11777 public static void CacheCheck() 11777 public static void CheckCache()
11778 { 11778 {
11779 foreach (UUID key in new List<UUID>(m_Notecards.Keys)) 11779 lock (m_Notecards)
11780 { 11780 {
11781 Notecard nc = m_Notecards[key]; 11781 foreach (UUID key in new List<UUID>(m_Notecards.Keys))
11782 if (nc.lastRef.AddSeconds(30) < DateTime.Now) 11782 {
11783 m_Notecards.Remove(key); 11783 Notecard nc = m_Notecards[key];
11784 if (nc.lastRef.AddSeconds(30) < DateTime.Now)
11785 m_Notecards.Remove(key);
11786 }
11784 } 11787 }
11785 } 11788 }
11786 } 11789 }
11787} 11790} \ No newline at end of file