aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs35
1 files changed, 28 insertions, 7 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
index 1556d01..fcdf857 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
@@ -82,7 +82,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
82 J2KImage imgrequest; 82 J2KImage imgrequest;
83 83
84 // Do a linear search for this texture download 84 // Do a linear search for this texture download
85 m_priorityQueue.Find(delegate(J2KImage img) { return img.m_requestedUUID == newRequest.RequestedAssetID; }, out imgrequest); 85 lock (m_priorityQueue)
86 m_priorityQueue.Find(delegate(J2KImage img) { return img.m_requestedUUID == newRequest.RequestedAssetID; }, out imgrequest);
86 87
87 if (imgrequest != null) 88 if (imgrequest != null)
88 { 89 {
@@ -90,7 +91,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
90 { 91 {
91 //m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID); 92 //m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID);
92 93
93 try { m_priorityQueue.Delete(imgrequest.m_priorityQueueHandle); } 94 try
95 {
96 lock (m_priorityQueue)
97 m_priorityQueue.Delete(imgrequest.m_priorityQueueHandle);
98 }
94 catch (Exception) { } 99 catch (Exception) { }
95 } 100 }
96 else 101 else
@@ -113,8 +118,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
113 118
114 //Update the requested priority 119 //Update the requested priority
115 imgrequest.m_requestedPriority = newRequest.Priority; 120 imgrequest.m_requestedPriority = newRequest.Priority;
116 try { m_priorityQueue.Replace(imgrequest.m_priorityQueueHandle, imgrequest); } 121 try
117 catch (Exception) { imgrequest.m_priorityQueueHandle = null; m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest); } 122 {
123 lock (m_priorityQueue)
124 m_priorityQueue.Replace(imgrequest.m_priorityQueueHandle, imgrequest);
125 }
126 catch (Exception)
127 {
128 imgrequest.m_priorityQueueHandle = null;
129 lock (m_priorityQueue)
130 m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest);
131 }
118 132
119 //Run an update 133 //Run an update
120 imgrequest.RunUpdate(); 134 imgrequest.RunUpdate();
@@ -157,7 +171,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
157 imgrequest.m_requestedPriority = newRequest.Priority; 171 imgrequest.m_requestedPriority = newRequest.Priority;
158 172
159 //Add this download to the priority queue 173 //Add this download to the priority queue
160 m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest); 174 lock (m_priorityQueue)
175 m_priorityQueue.Add(ref imgrequest.m_priorityQueueHandle, imgrequest);
161 176
162 //Run an update 177 //Run an update
163 imgrequest.RunUpdate(); 178 imgrequest.RunUpdate();
@@ -217,7 +232,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
217 { 232 {
218 while (m_priorityQueue.Count > 0) 233 while (m_priorityQueue.Count > 0)
219 { 234 {
220 J2KImage imagereq = m_priorityQueue.FindMax(); 235 J2KImage imagereq = null;
236 lock (m_priorityQueue)
237 imagereq = m_priorityQueue.FindMax();
221 238
222 if (imagereq.m_decoded == true) 239 if (imagereq.m_decoded == true)
223 { 240 {
@@ -235,7 +252,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
235 if (imagereq.SendPackets(m_client, maxpack)) 252 if (imagereq.SendPackets(m_client, maxpack))
236 { 253 {
237 // Send complete. Destroy any knowledge of this transfer 254 // Send complete. Destroy any knowledge of this transfer
238 try { m_priorityQueue.Delete(imagereq.m_priorityQueueHandle); } 255 try
256 {
257 lock (m_priorityQueue)
258 m_priorityQueue.Delete(imagereq.m_priorityQueueHandle);
259 }
239 catch (Exception) { } 260 catch (Exception) { }
240 } 261 }
241 } 262 }