From 68ece236a6cd8a2a9bc009287e43debdc6e9a79d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 23 Sep 2012 23:55:28 +0200 Subject: Protect the responses map with a lock. Also remove ugly "this." type of member notation. --- .../ClientStack/Linden/Caps/GetTextureModule.cs | 14 ++++++----- .../Linden/Caps/WebFetchInvDescModule.cs | 28 ++++++++++++---------- 2 files changed, 24 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 0ac56ec..2000279 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -146,14 +146,14 @@ namespace OpenSim.Region.ClientStack.Linden { m_scene = scene; - HasEvents = (x, y) => { return this.responses.ContainsKey(x); }; + HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; GetEvents = (x, y, s) => { lock (responses) { try { - return this.responses[x]; + return responses[x]; } finally { @@ -165,15 +165,15 @@ namespace OpenSim.Region.ClientStack.Linden Request = (x, y) => { y["RequestID"] = x.ToString(); - lock (this.requests) - this.requests.Add(y); + lock (requests) + requests.Add(y); m_queue.Enqueue(this); }; NoEvents = (x, y) => { - lock (this.requests) + lock (requests) { Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); requests.Remove(request); @@ -198,7 +198,7 @@ namespace OpenSim.Region.ClientStack.Linden try { - lock (this.requests) + lock (requests) { request = requests[0]; requests.RemoveAt(0); @@ -221,8 +221,10 @@ namespace OpenSim.Region.ClientStack.Linden response["content_type"] = "text/plain"; response["keepalive"] = false; response["reusecontext"] = false; + lock (responses) responses[requestID] = response; + return; } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 4908c2c..f76ea74 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -144,31 +144,34 @@ namespace OpenSim.Region.ClientStack.Linden public PollServiceInventoryEventArgs(UUID pId) : base(null, null, null, null, pId, 30000) { - HasEvents = (x, y) => { return this.responses.ContainsKey(x); }; + HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; GetEvents = (x, y, s) => { - try + lock (responses) { - return this.responses[x]; - } - finally - { - responses.Remove(x); + try + { + return responses[x]; + } + finally + { + responses.Remove(x); + } } }; Request = (x, y) => { y["RequestID"] = x.ToString(); - lock (this.requests) - this.requests.Add(y); + lock (requests) + requests.Add(y); m_queue.Enqueue(this); }; NoEvents = (x, y) => { - lock (this.requests) + lock (requests) { Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); requests.Remove(request); @@ -192,7 +195,7 @@ namespace OpenSim.Region.ClientStack.Linden try { - lock (this.requests) + lock (requests) { request = requests[0]; requests.RemoveAt(0); @@ -214,7 +217,8 @@ namespace OpenSim.Region.ClientStack.Linden response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(request["body"].ToString(), String.Empty, String.Empty, null, null); - responses[requestID] = response; + lock (responses) + responses[requestID] = response; } } -- cgit v1.1