diff options
author | Melanie | 2012-09-23 23:55:28 +0200 |
---|---|---|
committer | Melanie | 2012-09-23 23:55:28 +0200 |
commit | 68ece236a6cd8a2a9bc009287e43debdc6e9a79d (patch) | |
tree | b25a566952219e8aefff9ec26595e803ab84e30f /OpenSim/Region/ClientStack | |
parent | Merge branch 'ubitwork' into avination (diff) | |
download | opensim-SC-68ece236a6cd8a2a9bc009287e43debdc6e9a79d.zip opensim-SC-68ece236a6cd8a2a9bc009287e43debdc6e9a79d.tar.gz opensim-SC-68ece236a6cd8a2a9bc009287e43debdc6e9a79d.tar.bz2 opensim-SC-68ece236a6cd8a2a9bc009287e43debdc6e9a79d.tar.xz |
Protect the responses map with a lock. Also remove ugly "this." type of
member notation.
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | 28 |
2 files changed, 24 insertions, 18 deletions
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 | |||
146 | { | 146 | { |
147 | m_scene = scene; | 147 | m_scene = scene; |
148 | 148 | ||
149 | HasEvents = (x, y) => { return this.responses.ContainsKey(x); }; | 149 | HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; |
150 | GetEvents = (x, y, s) => | 150 | GetEvents = (x, y, s) => |
151 | { | 151 | { |
152 | lock (responses) | 152 | lock (responses) |
153 | { | 153 | { |
154 | try | 154 | try |
155 | { | 155 | { |
156 | return this.responses[x]; | 156 | return responses[x]; |
157 | } | 157 | } |
158 | finally | 158 | finally |
159 | { | 159 | { |
@@ -165,15 +165,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
165 | Request = (x, y) => | 165 | Request = (x, y) => |
166 | { | 166 | { |
167 | y["RequestID"] = x.ToString(); | 167 | y["RequestID"] = x.ToString(); |
168 | lock (this.requests) | 168 | lock (requests) |
169 | this.requests.Add(y); | 169 | requests.Add(y); |
170 | 170 | ||
171 | m_queue.Enqueue(this); | 171 | m_queue.Enqueue(this); |
172 | }; | 172 | }; |
173 | 173 | ||
174 | NoEvents = (x, y) => | 174 | NoEvents = (x, y) => |
175 | { | 175 | { |
176 | lock (this.requests) | 176 | lock (requests) |
177 | { | 177 | { |
178 | Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); | 178 | Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); |
179 | requests.Remove(request); | 179 | requests.Remove(request); |
@@ -198,7 +198,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
198 | 198 | ||
199 | try | 199 | try |
200 | { | 200 | { |
201 | lock (this.requests) | 201 | lock (requests) |
202 | { | 202 | { |
203 | request = requests[0]; | 203 | request = requests[0]; |
204 | requests.RemoveAt(0); | 204 | requests.RemoveAt(0); |
@@ -221,8 +221,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
221 | response["content_type"] = "text/plain"; | 221 | response["content_type"] = "text/plain"; |
222 | response["keepalive"] = false; | 222 | response["keepalive"] = false; |
223 | response["reusecontext"] = false; | 223 | response["reusecontext"] = false; |
224 | |||
224 | lock (responses) | 225 | lock (responses) |
225 | responses[requestID] = response; | 226 | responses[requestID] = response; |
227 | |||
226 | return; | 228 | return; |
227 | } | 229 | } |
228 | 230 | ||
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 | |||
144 | public PollServiceInventoryEventArgs(UUID pId) : | 144 | public PollServiceInventoryEventArgs(UUID pId) : |
145 | base(null, null, null, null, pId, 30000) | 145 | base(null, null, null, null, pId, 30000) |
146 | { | 146 | { |
147 | HasEvents = (x, y) => { return this.responses.ContainsKey(x); }; | 147 | HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; |
148 | GetEvents = (x, y, s) => | 148 | GetEvents = (x, y, s) => |
149 | { | 149 | { |
150 | try | 150 | lock (responses) |
151 | { | 151 | { |
152 | return this.responses[x]; | 152 | try |
153 | } | 153 | { |
154 | finally | 154 | return responses[x]; |
155 | { | 155 | } |
156 | responses.Remove(x); | 156 | finally |
157 | { | ||
158 | responses.Remove(x); | ||
159 | } | ||
157 | } | 160 | } |
158 | }; | 161 | }; |
159 | 162 | ||
160 | Request = (x, y) => | 163 | Request = (x, y) => |
161 | { | 164 | { |
162 | y["RequestID"] = x.ToString(); | 165 | y["RequestID"] = x.ToString(); |
163 | lock (this.requests) | 166 | lock (requests) |
164 | this.requests.Add(y); | 167 | requests.Add(y); |
165 | 168 | ||
166 | m_queue.Enqueue(this); | 169 | m_queue.Enqueue(this); |
167 | }; | 170 | }; |
168 | 171 | ||
169 | NoEvents = (x, y) => | 172 | NoEvents = (x, y) => |
170 | { | 173 | { |
171 | lock (this.requests) | 174 | lock (requests) |
172 | { | 175 | { |
173 | Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); | 176 | Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); |
174 | requests.Remove(request); | 177 | requests.Remove(request); |
@@ -192,7 +195,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
192 | 195 | ||
193 | try | 196 | try |
194 | { | 197 | { |
195 | lock (this.requests) | 198 | lock (requests) |
196 | { | 199 | { |
197 | request = requests[0]; | 200 | request = requests[0]; |
198 | requests.RemoveAt(0); | 201 | requests.RemoveAt(0); |
@@ -214,7 +217,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
214 | 217 | ||
215 | response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(request["body"].ToString(), String.Empty, String.Empty, null, null); | 218 | response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(request["body"].ToString(), String.Empty, String.Empty, null, null); |
216 | 219 | ||
217 | responses[requestID] = response; | 220 | lock (responses) |
221 | responses[requestID] = response; | ||
218 | } | 222 | } |
219 | } | 223 | } |
220 | 224 | ||