aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs37
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs23
2 files changed, 48 insertions, 12 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
index 6cffd70..b186720 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
@@ -60,14 +60,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
60 private sbyte m_discardLevel=-1; 60 private sbyte m_discardLevel=-1;
61 private uint m_packetNumber; 61 private uint m_packetNumber;
62 private bool m_decoderequested = false; 62 private bool m_decoderequested = false;
63 private bool m_hasasset = false; 63 public bool m_hasasset = false;
64 private bool m_asset_requested = false; 64 private bool m_asset_requested = false;
65 private bool m_sentinfo = false; 65 private bool m_sentinfo = false;
66 private uint m_stopPacket = 0; 66 private uint m_stopPacket = 0;
67 private const int cImagePacketSize = 1000; 67 private const int cImagePacketSize = 1000;
68 private const int cFirstPacketSize = 600; 68 private const int cFirstPacketSize = 600;
69
69 private AssetBase m_asset = null; 70 private AssetBase m_asset = null;
71 private int m_assetDataLength = 0;
72
70 private LLImageManager m_image; 73 private LLImageManager m_image;
74
71 public J2KImage(LLImageManager image) 75 public J2KImage(LLImageManager image)
72 { 76 {
73 m_image = image; 77 m_image = image;
@@ -99,7 +103,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
99 return 0; 103 return 0;
100 try 104 try
101 { 105 {
102 return (ushort)(((m_asset.Data.Length - cFirstPacketSize + cImagePacketSize - 1) / cImagePacketSize) + 1); 106 return (ushort)(((m_assetDataLength - cFirstPacketSize + cImagePacketSize - 1) / cImagePacketSize) + 1);
103 } 107 }
104 catch (Exception) 108 catch (Exception)
105 { 109 {
@@ -110,6 +114,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
110 } 114 }
111 } 115 }
112 116
117 public void DropAsset()
118 {
119 m_log.WarnFormat("[LLIMAGE MANAGER]: Dropping texture asset {0}", m_requestedUUID);
120 m_asset = null;
121 m_hasasset = false;
122 m_asset_requested = false;
123 }
124
113 public void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers) 125 public void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers)
114 { 126 {
115 m_image.m_outstandingtextures++; 127 m_image.m_outstandingtextures++;
@@ -127,8 +139,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
127 } 139 }
128 else 140 else
129 { 141 {
130 m_asset = asset; 142 m_asset = asset;
131 } 143 }
144
145 m_assetDataLength = m_asset.Data.Length;
146
132 RunUpdate(); 147 RunUpdate();
133 } 148 }
134 149
@@ -150,8 +165,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
150 public int LastPacketSize() 165 public int LastPacketSize()
151 { 166 {
152 if (m_packetNumber == 1) 167 if (m_packetNumber == 1)
153 return m_asset.Data.Length; 168 return m_assetDataLength;
154 int lastsize = (m_asset.Data.Length - cFirstPacketSize) % cImagePacketSize; 169 int lastsize = (m_assetDataLength - cFirstPacketSize) % cImagePacketSize;
155 //If the last packet size is zero, it's really cImagePacketSize, it sits on the boundary 170 //If the last packet size is zero, it's really cImagePacketSize, it sits on the boundary
156 if (lastsize == 0) 171 if (lastsize == 0)
157 { 172 {
@@ -185,10 +200,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
185 return true; 200 return true;
186 } 201 }
187 // Do we have less then 1 packet's worth of data? 202 // Do we have less then 1 packet's worth of data?
188 else if (m_asset.Data.Length <= cFirstPacketSize) 203 else if (m_assetDataLength <= cFirstPacketSize)
189 { 204 {
190 // Send only 1 packet 205 // Send only 1 packet
191 client.SendImageFirstPart(1, m_requestedUUID, (uint)m_asset.Data.Length, m_asset.Data, 2); 206 client.SendImageFirstPart(1, m_requestedUUID, (uint)m_assetDataLength, m_asset.Data, 2);
192 m_stopPacket = 0; 207 m_stopPacket = 0;
193 return true; 208 return true;
194 } 209 }
@@ -198,7 +213,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
198 try 213 try
199 { 214 {
200 Buffer.BlockCopy(m_asset.Data, 0, firstImageData, 0, (int)cFirstPacketSize); 215 Buffer.BlockCopy(m_asset.Data, 0, firstImageData, 0, (int)cFirstPacketSize);
201 client.SendImageFirstPart(TexturePacketCount(), m_requestedUUID, (uint)m_asset.Data.Length, firstImageData, 2); 216 client.SendImageFirstPart(TexturePacketCount(), m_requestedUUID, (uint)m_assetDataLength, firstImageData, 2);
202 } 217 }
203 catch (Exception) 218 catch (Exception)
204 { 219 {
@@ -216,13 +231,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
216 231
217 try 232 try
218 { 233 {
219 if ((CurrentBytePosition() + cImagePacketSize) > m_asset.Data.Length) 234 if ((CurrentBytePosition() + cImagePacketSize) > m_assetDataLength)
220 { 235 {
221 imagePacketSize = LastPacketSize(); 236 imagePacketSize = LastPacketSize();
222 complete=true; 237 complete=true;
223 if ((CurrentBytePosition() + imagePacketSize) > m_asset.Data.Length) 238 if ((CurrentBytePosition() + imagePacketSize) > m_assetDataLength)
224 { 239 {
225 imagePacketSize = m_asset.Data.Length - CurrentBytePosition(); 240 imagePacketSize = m_assetDataLength - CurrentBytePosition();
226 complete = true; 241 complete = true;
227 } 242 }
228 } 243 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
index 295a5e6..b039049 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
@@ -257,6 +257,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
257 J2KImage imagereq = m_imagestore[m_priorities.Values[x]]; 257 J2KImage imagereq = m_imagestore[m_priorities.Values[x]];
258 if (imagereq.m_decoded == true && !imagereq.m_completedSendAtCurrentDiscardLevel) 258 if (imagereq.m_decoded == true && !imagereq.m_completedSendAtCurrentDiscardLevel)
259 { 259 {
260 // we need to test this here now that we are dropping assets
261 if (!imagereq.m_hasasset)
262 {
263 m_log.WarnFormat("[LLIMAGE MANAGER]: Re-requesting the image asset {0}", imagereq.m_requestedUUID);
264 imagereq.RunUpdate();
265 continue;
266 }
267
260 numCollected++; 268 numCollected++;
261 //SendPackets will send up to ten packets per cycle 269 //SendPackets will send up to ten packets per cycle
262 if (imagereq.SendPackets(m_client, maxpack)) 270 if (imagereq.SendPackets(m_client, maxpack))
@@ -264,8 +272,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
264 //Send complete 272 //Send complete
265 if (!imagereq.m_completedSendAtCurrentDiscardLevel) 273 if (!imagereq.m_completedSendAtCurrentDiscardLevel)
266 { 274 {
267 imagereq.m_completedSendAtCurrentDiscardLevel = true; 275 // I think this field imagereq.m_completedSendAtCurrentDiscardLevel
276 // is completely redundant
277 //imagereq.m_completedSendAtCurrentDiscardLevel = true;
278
268 Interlocked.Decrement(ref m_outstandingtextures); 279 Interlocked.Decrement(ref m_outstandingtextures);
280
281 // First and foremost, drop the reference to the asset
282 // so that the asset doesn't stay in memory forever.
283 // We'll Get it again from the asset service (usually cache)
284 // if/when the client requests it again.
285 // In order not to mess much with the current implementation
286 // of this management code, we drop only the asset reference
287 // but keep the image request itself.
288 imagereq.DropAsset();
289
269 //Re-assign priority to bottom 290 //Re-assign priority to bottom
270 //Remove the old priority 291 //Remove the old priority
271 m_priorities.Remove(imagereq.m_designatedPriorityKey); 292 m_priorities.Remove(imagereq.m_designatedPriorityKey);