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