diff options
author | Diva Canto | 2009-10-01 20:32:22 -0700 |
---|---|---|
committer | Diva Canto | 2009-10-01 20:32:22 -0700 |
commit | 746dad7b74fb6e353cca3b5a09e0c3be88155784 (patch) | |
tree | 75ca1ec6e8761bcf5778685e39b5b38ca88d1143 /OpenSim/Region | |
parent | Removing console debug spew (diff) | |
download | opensim-SC-746dad7b74fb6e353cca3b5a09e0c3be88155784.zip opensim-SC-746dad7b74fb6e353cca3b5a09e0c3be88155784.tar.gz opensim-SC-746dad7b74fb6e353cca3b5a09e0c3be88155784.tar.bz2 opensim-SC-746dad7b74fb6e353cca3b5a09e0c3be88155784.tar.xz |
Locking the priority queue to see if it gets pass that exception.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index 70af8e8..97107ce 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs | |||
@@ -77,7 +77,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
77 | J2KImage imgrequest; | 77 | J2KImage imgrequest; |
78 | 78 | ||
79 | // Do a linear search for this texture download | 79 | // Do a linear search for this texture download |
80 | m_priorityQueue.Find(delegate(J2KImage img) { return img.m_requestedUUID == newRequest.RequestedAssetID; }, out imgrequest); | 80 | lock (m_priorityQueue) |
81 | m_priorityQueue.Find(delegate(J2KImage img) { return img.m_requestedUUID == newRequest.RequestedAssetID; }, out imgrequest); | ||
81 | 82 | ||
82 | if (imgrequest != null) | 83 | if (imgrequest != null) |
83 | { | 84 | { |
@@ -85,7 +86,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
85 | { | 86 | { |
86 | //m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID); | 87 | //m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID); |
87 | 88 | ||
88 | try { m_priorityQueue.Delete(imgrequest.m_priorityQueueHandle); } | 89 | try |
90 | { | ||
91 | lock (m_priorityQueue) | ||
92 | m_priorityQueue.Delete(imgrequest.m_priorityQueueHandle); | ||
93 | } | ||
89 | catch (Exception) { } | 94 | catch (Exception) { } |
90 | } | 95 | } |
91 | else | 96 | else |
@@ -108,8 +113,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
108 | 113 | ||
109 | //Update the requested priority | 114 | //Update the requested priority |
110 | imgrequest.m_requestedPriority = newRequest.Priority; | 115 | imgrequest.m_requestedPriority = newRequest.Priority; |
111 | try { m_priorityQueue.Replace(imgrequest.m_priorityQueueHandle, imgrequest); } | 116 | try |
112 | catch (Exception) { imgrequest.m_priorityQueueHandle = null; m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest); } | 117 | { |
118 | lock (m_priorityQueue) | ||
119 | m_priorityQueue.Replace(imgrequest.m_priorityQueueHandle, imgrequest); | ||
120 | } | ||
121 | catch (Exception) | ||
122 | { | ||
123 | imgrequest.m_priorityQueueHandle = null; | ||
124 | lock (m_priorityQueue) | ||
125 | m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest); | ||
126 | } | ||
113 | 127 | ||
114 | //Run an update | 128 | //Run an update |
115 | imgrequest.RunUpdate(); | 129 | imgrequest.RunUpdate(); |
@@ -152,7 +166,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
152 | imgrequest.m_requestedPriority = newRequest.Priority; | 166 | imgrequest.m_requestedPriority = newRequest.Priority; |
153 | 167 | ||
154 | //Add this download to the priority queue | 168 | //Add this download to the priority queue |
155 | m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest); | 169 | lock (m_priorityQueue) |
170 | m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest); | ||
156 | 171 | ||
157 | //Run an update | 172 | //Run an update |
158 | imgrequest.RunUpdate(); | 173 | imgrequest.RunUpdate(); |
@@ -212,7 +227,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
212 | { | 227 | { |
213 | while (m_priorityQueue.Count > 0) | 228 | while (m_priorityQueue.Count > 0) |
214 | { | 229 | { |
215 | J2KImage imagereq = m_priorityQueue.FindMax(); | 230 | J2KImage imagereq = null; |
231 | lock (m_priorityQueue) | ||
232 | imagereq = m_priorityQueue.FindMax(); | ||
216 | 233 | ||
217 | if (imagereq.m_decoded == true) | 234 | if (imagereq.m_decoded == true) |
218 | { | 235 | { |
@@ -230,7 +247,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
230 | if (imagereq.SendPackets(m_client, maxpack)) | 247 | if (imagereq.SendPackets(m_client, maxpack)) |
231 | { | 248 | { |
232 | // Send complete. Destroy any knowledge of this transfer | 249 | // Send complete. Destroy any knowledge of this transfer |
233 | try { m_priorityQueue.Delete(imagereq.m_priorityQueueHandle); } | 250 | try |
251 | { | ||
252 | lock (m_priorityQueue) | ||
253 | m_priorityQueue.Delete(imagereq.m_priorityQueueHandle); | ||
254 | } | ||
234 | catch (Exception) { } | 255 | catch (Exception) { } |
235 | } | 256 | } |
236 | } | 257 | } |