diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index 8410ee9..9d36cff 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs | |||
@@ -162,32 +162,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | public bool ProcessImageQueue(int count, int maxpack) | 165 | public bool ProcessImageQueue(int packetsToSend) |
166 | { | 166 | { |
167 | J2KImage imagereq; | ||
168 | int numCollected = 0; | ||
169 | |||
170 | m_lastloopprocessed = DateTime.Now.Ticks; | 167 | m_lastloopprocessed = DateTime.Now.Ticks; |
168 | int packetsSent = 0; | ||
171 | 169 | ||
172 | // This can happen during Close() | 170 | while (packetsSent < packetsToSend) |
173 | if (m_client == null) | ||
174 | return false; | ||
175 | |||
176 | while ((imagereq = GetHighestPriorityImage()) != null) | ||
177 | { | 171 | { |
178 | if (imagereq.IsDecoded == true) | 172 | J2KImage image = GetHighestPriorityImage(); |
173 | |||
174 | // If null was returned, the texture priority queue is currently empty | ||
175 | if (image == null) | ||
176 | return false; | ||
177 | |||
178 | if (image.IsDecoded) | ||
179 | { | 179 | { |
180 | ++numCollected; | 180 | int sent; |
181 | bool imageDone = image.SendPackets(m_client, packetsToSend - packetsSent, out sent); | ||
181 | 182 | ||
182 | if (imagereq.SendPackets(m_client, maxpack)) | 183 | packetsSent += sent; |
183 | { | ||
184 | // Send complete. Destroy any knowledge of this transfer | ||
185 | RemoveImageFromQueue(imagereq); | ||
186 | } | ||
187 | } | ||
188 | 184 | ||
189 | if (numCollected == count) | 185 | // If the send is complete, destroy any knowledge of this transfer |
190 | break; | 186 | if (imageDone) |
187 | RemoveImageFromQueue(image); | ||
188 | } | ||
189 | else | ||
190 | { | ||
191 | // TODO: This is a limitation of how LLImageManager is currently | ||
192 | // written. Undecoded textures should not be going into the priority | ||
193 | // queue, because a high priority undecoded texture will clog up the | ||
194 | // pipeline for a client | ||
195 | return true; | ||
196 | } | ||
191 | } | 197 | } |
192 | 198 | ||
193 | return m_priorityQueue.Count > 0; | 199 | return m_priorityQueue.Count > 0; |
@@ -199,10 +205,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
199 | public void Close() | 205 | public void Close() |
200 | { | 206 | { |
201 | m_shuttingdown = true; | 207 | m_shuttingdown = true; |
202 | m_priorityQueue = null; | ||
203 | m_j2kDecodeModule = null; | ||
204 | m_assetCache = null; | ||
205 | m_client = null; | ||
206 | } | 208 | } |
207 | 209 | ||
208 | #region Priority Queue Helpers | 210 | #region Priority Queue Helpers |