diff options
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 24 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs | 72 |
3 files changed, 76 insertions, 22 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index cb9692a..185a909 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | |||
@@ -102,7 +102,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
102 | { | 102 | { |
103 | m_currentPacket = 2; | 103 | m_currentPacket = 2; |
104 | } | 104 | } |
105 | 105 | ||
106 | while (sendMore && packetsSent < packetsToSend && m_currentPacket <= m_stopPacket) | 106 | while (sendMore && packetsSent < packetsToSend && m_currentPacket <= m_stopPacket) |
107 | { | 107 | { |
108 | sendMore = SendPacket(client); | 108 | sendMore = SendPacket(client); |
@@ -114,17 +114,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
114 | return (m_currentPacket > m_stopPacket); | 114 | return (m_currentPacket > m_stopPacket); |
115 | } | 115 | } |
116 | 116 | ||
117 | /// <summary> | ||
118 | /// This is where we decide what we need to update | ||
119 | /// and assign the real discardLevel and packetNumber | ||
120 | /// assuming of course that the connected client might be bonkers | ||
121 | /// </summary> | ||
117 | public void RunUpdate() | 122 | public void RunUpdate() |
118 | { | 123 | { |
119 | //This is where we decide what we need to update | ||
120 | //and assign the real discardLevel and packetNumber | ||
121 | //assuming of course that the connected client might be bonkers | ||
122 | |||
123 | if (!HasAsset) | 124 | if (!HasAsset) |
124 | { | 125 | { |
125 | if (!m_assetRequested) | 126 | if (!m_assetRequested) |
126 | { | 127 | { |
127 | m_assetRequested = true; | 128 | m_assetRequested = true; |
129 | // m_log.DebugFormat("[J2KIMAGE]: Requesting asset {0}", TextureID); | ||
128 | AssetService.Get(TextureID.ToString(), this, AssetReceived); | 130 | AssetService.Get(TextureID.ToString(), this, AssetReceived); |
129 | } | 131 | } |
130 | } | 132 | } |
@@ -137,6 +139,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
137 | { | 139 | { |
138 | //Request decode | 140 | //Request decode |
139 | m_decodeRequested = true; | 141 | m_decodeRequested = true; |
142 | |||
143 | // m_log.DebugFormat("[J2KIMAGE]: Requesting decode of asset {0}", TextureID); | ||
144 | |||
140 | // Do we have a jpeg decoder? | 145 | // Do we have a jpeg decoder? |
141 | if (J2KDecoder != null) | 146 | if (J2KDecoder != null) |
142 | { | 147 | { |
@@ -149,7 +154,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
149 | // Send it off to the jpeg decoder | 154 | // Send it off to the jpeg decoder |
150 | J2KDecoder.BeginDecode(TextureID, m_asset, J2KDecodedCallback); | 155 | J2KDecoder.BeginDecode(TextureID, m_asset, J2KDecodedCallback); |
151 | } | 156 | } |
152 | |||
153 | } | 157 | } |
154 | else | 158 | else |
155 | { | 159 | { |
@@ -328,14 +332,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
328 | { | 332 | { |
329 | if (m_currentPacket == 0) | 333 | if (m_currentPacket == 0) |
330 | return 0; | 334 | return 0; |
335 | |||
331 | if (m_currentPacket == 1) | 336 | if (m_currentPacket == 1) |
332 | return FIRST_PACKET_SIZE; | 337 | return FIRST_PACKET_SIZE; |
333 | 338 | ||
334 | int result = FIRST_PACKET_SIZE + ((int)m_currentPacket - 2) * IMAGE_PACKET_SIZE; | 339 | int result = FIRST_PACKET_SIZE + ((int)m_currentPacket - 2) * IMAGE_PACKET_SIZE; |
340 | |||
335 | if (result < 0) | 341 | if (result < 0) |
336 | { | ||
337 | result = FIRST_PACKET_SIZE; | 342 | result = FIRST_PACKET_SIZE; |
338 | } | 343 | |
339 | return result; | 344 | return result; |
340 | } | 345 | } |
341 | 346 | ||
@@ -374,7 +379,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
374 | { | 379 | { |
375 | UUID assetID = UUID.Zero; | 380 | UUID assetID = UUID.Zero; |
376 | if (asset != null) | 381 | if (asset != null) |
382 | { | ||
377 | assetID = asset.FullID; | 383 | assetID = asset.FullID; |
384 | } | ||
378 | else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule)) | 385 | else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule)) |
379 | { | 386 | { |
380 | // Unfortunately we need this here, there's no other way. | 387 | // Unfortunately we need this here, there's no other way. |
@@ -395,7 +402,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
395 | } | 402 | } |
396 | 403 | ||
397 | AssetDataCallback(assetID, asset); | 404 | AssetDataCallback(assetID, asset); |
398 | |||
399 | } | 405 | } |
400 | } | 406 | } |
401 | } | 407 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index fe28ba3..eb1a50e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -577,7 +577,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
577 | /// Add a handler for the given packet type. | 577 | /// Add a handler for the given packet type. |
578 | /// </summary> | 578 | /// </summary> |
579 | /// <remarks> | 579 | /// <remarks> |
580 | /// The packet is handled on its own thread. If packets must be handled in the order in which thye | 580 | /// The packet is handled on its own thread. If packets must be handled in the order in which they |
581 | /// are received then please use the synchronous version of this method. | 581 | /// are received then please use the synchronous version of this method. |
582 | /// </remarks> | 582 | /// </remarks> |
583 | /// <param name="packetType"></param> | 583 | /// <param name="packetType"></param> |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index e3a881f..3e31b7d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs | |||
@@ -84,7 +84,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
84 | /// <param name="newRequest"></param> | 84 | /// <param name="newRequest"></param> |
85 | public void EnqueueReq(TextureRequestArgs newRequest) | 85 | public void EnqueueReq(TextureRequestArgs newRequest) |
86 | { | 86 | { |
87 | //Make sure we're not shutting down.. | ||
88 | if (!m_shuttingdown) | 87 | if (!m_shuttingdown) |
89 | { | 88 | { |
90 | J2KImage imgrequest; | 89 | J2KImage imgrequest; |
@@ -99,19 +98,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
99 | { | 98 | { |
100 | //m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID); | 99 | //m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID); |
101 | 100 | ||
102 | try | 101 | try |
103 | { | 102 | { |
104 | lock (m_syncRoot) | 103 | lock (m_syncRoot) |
105 | m_priorityQueue.Delete(imgrequest.PriorityQueueHandle); | 104 | m_priorityQueue.Delete(imgrequest.PriorityQueueHandle); |
106 | } | 105 | } |
107 | catch (Exception) { } | 106 | catch (Exception) { } |
108 | } | 107 | } |
109 | else | 108 | else |
110 | { | 109 | { |
110 | // m_log.DebugFormat( | ||
111 | // "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}", | ||
112 | // newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); | ||
113 | |||
111 | //m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", | 114 | //m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", |
112 | // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); | 115 | // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); |
113 | 116 | ||
114 | //Check the packet sequence to make sure this isn't older than | 117 | //Check the packet sequence to make sure this isn't older than |
115 | //one we've already received | 118 | //one we've already received |
116 | if (newRequest.requestSequence > imgrequest.LastSequence) | 119 | if (newRequest.requestSequence > imgrequest.LastSequence) |
117 | { | 120 | { |
@@ -126,11 +129,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
126 | 129 | ||
127 | //Update the requested priority | 130 | //Update the requested priority |
128 | imgrequest.Priority = newRequest.Priority; | 131 | imgrequest.Priority = newRequest.Priority; |
132 | |||
129 | UpdateImageInQueue(imgrequest); | 133 | UpdateImageInQueue(imgrequest); |
130 | 134 | ||
131 | //Run an update | ||
132 | imgrequest.RunUpdate(); | 135 | imgrequest.RunUpdate(); |
136 | |||
137 | // J2KImage imgrequest2 = new J2KImage(this); | ||
138 | // imgrequest2.J2KDecoder = m_j2kDecodeModule; | ||
139 | // imgrequest2.AssetService = m_assetCache; | ||
140 | // imgrequest2.AgentID = m_client.AgentId; | ||
141 | // imgrequest2.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>(); | ||
142 | // imgrequest2.DiscardLevel = newRequest.DiscardLevel; | ||
143 | // imgrequest2.StartPacket = Math.Max(1, newRequest.PacketNumber); | ||
144 | // imgrequest2.Priority = newRequest.Priority; | ||
145 | // imgrequest2.TextureID = newRequest.RequestedAssetID; | ||
146 | // imgrequest2.Priority = newRequest.Priority; | ||
147 | // | ||
148 | // //Add this download to the priority queue | ||
149 | // AddImageToQueue(imgrequest2); | ||
150 | // | ||
151 | // imgrequest2.RunUpdate(); | ||
152 | |||
133 | } | 153 | } |
154 | // else | ||
155 | // { | ||
156 | // m_log.DebugFormat( | ||
157 | // "[LL IMAGE MANAGER]: Ignoring duplicate of existing request for {0} (sequence {1}) from {2} as its request sequence {3} is not greater", | ||
158 | // newRequest.RequestedAssetID, imgrequest.LastSequence, m_client.Name, newRequest.requestSequence); | ||
159 | // } | ||
134 | } | 160 | } |
135 | } | 161 | } |
136 | else | 162 | else |
@@ -142,6 +168,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
142 | } | 168 | } |
143 | else | 169 | else |
144 | { | 170 | { |
171 | // m_log.DebugFormat( | ||
172 | // "[LL IMAGE MANAGER]: Received request for {0}, start packet {1} from {2}", | ||
173 | // newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); | ||
174 | |||
145 | //m_log.DebugFormat("[TEX]: (NEW) ID={0}: D={1}, S={2}, P={3}", | 175 | //m_log.DebugFormat("[TEX]: (NEW) ID={0}: D={1}, S={2}, P={3}", |
146 | // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); | 176 | // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); |
147 | 177 | ||
@@ -159,7 +189,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
159 | //Add this download to the priority queue | 189 | //Add this download to the priority queue |
160 | AddImageToQueue(imgrequest); | 190 | AddImageToQueue(imgrequest); |
161 | 191 | ||
162 | //Run an update | ||
163 | imgrequest.RunUpdate(); | 192 | imgrequest.RunUpdate(); |
164 | } | 193 | } |
165 | } | 194 | } |
@@ -176,7 +205,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
176 | 205 | ||
177 | // If null was returned, the texture priority queue is currently empty | 206 | // If null was returned, the texture priority queue is currently empty |
178 | if (image == null) | 207 | if (image == null) |
179 | return false; | 208 | break; |
180 | 209 | ||
181 | if (image.IsDecoded) | 210 | if (image.IsDecoded) |
182 | { | 211 | { |
@@ -194,10 +223,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
194 | // written. Undecoded textures should not be going into the priority | 223 | // written. Undecoded textures should not be going into the priority |
195 | // queue, because a high priority undecoded texture will clog up the | 224 | // queue, because a high priority undecoded texture will clog up the |
196 | // pipeline for a client | 225 | // pipeline for a client |
197 | return true; | 226 | // m_log.DebugFormat( |
227 | // "[LL IMAGE MANAGER]: Exiting image queue processing early on encountering undecoded image {0}", | ||
228 | // image.TextureID); | ||
229 | |||
230 | break; | ||
198 | } | 231 | } |
199 | } | 232 | } |
200 | 233 | ||
234 | // if (packetsSent != 0) | ||
235 | // m_log.DebugFormat("[LL IMAGE MANAGER]: Processed {0} packets from image queue", packetsSent); | ||
236 | |||
201 | return m_priorityQueue.Count > 0; | 237 | return m_priorityQueue.Count > 0; |
202 | } | 238 | } |
203 | 239 | ||
@@ -219,7 +255,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
219 | { | 255 | { |
220 | if (m_priorityQueue.Count > 0) | 256 | if (m_priorityQueue.Count > 0) |
221 | { | 257 | { |
222 | try { image = m_priorityQueue.FindMax(); } | 258 | try |
259 | { | ||
260 | image = m_priorityQueue.FindMax(); | ||
261 | } | ||
223 | catch (Exception) { } | 262 | catch (Exception) { } |
224 | } | 263 | } |
225 | } | 264 | } |
@@ -232,7 +271,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
232 | 271 | ||
233 | lock (m_syncRoot) | 272 | lock (m_syncRoot) |
234 | { | 273 | { |
235 | try { m_priorityQueue.Add(ref image.PriorityQueueHandle, image); } | 274 | try |
275 | { | ||
276 | m_priorityQueue.Add(ref image.PriorityQueueHandle, image); | ||
277 | } | ||
236 | catch (Exception) { } | 278 | catch (Exception) { } |
237 | } | 279 | } |
238 | } | 280 | } |
@@ -241,7 +283,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
241 | { | 283 | { |
242 | lock (m_syncRoot) | 284 | lock (m_syncRoot) |
243 | { | 285 | { |
244 | try { m_priorityQueue.Delete(image.PriorityQueueHandle); } | 286 | try |
287 | { | ||
288 | m_priorityQueue.Delete(image.PriorityQueueHandle); | ||
289 | } | ||
245 | catch (Exception) { } | 290 | catch (Exception) { } |
246 | } | 291 | } |
247 | } | 292 | } |
@@ -250,7 +295,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
250 | { | 295 | { |
251 | lock (m_syncRoot) | 296 | lock (m_syncRoot) |
252 | { | 297 | { |
253 | try { m_priorityQueue.Replace(image.PriorityQueueHandle, image); } | 298 | try |
299 | { | ||
300 | m_priorityQueue.Replace(image.PriorityQueueHandle, image); | ||
301 | } | ||
254 | catch (Exception) | 302 | catch (Exception) |
255 | { | 303 | { |
256 | image.PriorityQueueHandle = null; | 304 | image.PriorityQueueHandle = null; |