diff options
author | Melanie | 2009-10-02 05:49:27 +0100 |
---|---|---|
committer | Melanie | 2009-10-02 05:49:27 +0100 |
commit | 3ba36bb4d8ef44514da85702c86aa49808774c72 (patch) | |
tree | bf272f68031e49abf2ad2c1fc5845213406112f9 /OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs | |
parent | Merge branch 'diva-textures-osgrid' into texturetest (diff) | |
download | opensim-SC_OLD-3ba36bb4d8ef44514da85702c86aa49808774c72.zip opensim-SC_OLD-3ba36bb4d8ef44514da85702c86aa49808774c72.tar.gz opensim-SC_OLD-3ba36bb4d8ef44514da85702c86aa49808774c72.tar.bz2 opensim-SC_OLD-3ba36bb4d8ef44514da85702c86aa49808774c72.tar.xz |
Restore the missing image handling to the image manager. The missing
image packet crashes Hippo without a message.
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs | 144 |
1 files changed, 79 insertions, 65 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index fcdf857..a484fdf 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs | |||
@@ -52,6 +52,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | private bool m_shuttingdown = false; | 53 | private bool m_shuttingdown = false; |
54 | private long m_lastloopprocessed = 0; | 54 | private long m_lastloopprocessed = 0; |
55 | private AssetBase m_missingImage = null; | ||
55 | 56 | ||
56 | private LLClientView m_client; //Client we're assigned to | 57 | private LLClientView m_client; //Client we're assigned to |
57 | private IAssetService m_assetCache; //Asset Cache | 58 | private IAssetService m_assetCache; //Asset Cache |
@@ -62,6 +63,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
62 | { | 63 | { |
63 | m_client = client; | 64 | m_client = client; |
64 | m_assetCache = pAssetCache; | 65 | m_assetCache = pAssetCache; |
66 | if (pAssetCache != null) | ||
67 | m_missingImage = pAssetCache.Get("5748decc-f629-461c-9a36-a35a221fe21f"); | ||
68 | else | ||
69 | m_log.Error("[ClientView] - couldn't set missing image asset, falling back to missing image packet. This is known to crash the client"); | ||
70 | |||
65 | m_j2kDecodeModule = pJ2kDecodeModule; | 71 | m_j2kDecodeModule = pJ2kDecodeModule; |
66 | } | 72 | } |
67 | 73 | ||
@@ -70,6 +76,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
70 | get { return m_client; } | 76 | get { return m_client; } |
71 | } | 77 | } |
72 | 78 | ||
79 | public AssetBase MissingImage | ||
80 | { | ||
81 | get { return m_missingImage; } | ||
82 | } | ||
83 | |||
73 | public void EnqueueReq(TextureRequestArgs newRequest) | 84 | public void EnqueueReq(TextureRequestArgs newRequest) |
74 | { | 85 | { |
75 | //newRequest is the properties of our new texture fetch request. | 86 | //newRequest is the properties of our new texture fetch request. |
@@ -183,90 +194,93 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
183 | 194 | ||
184 | public bool ProcessImageQueue(int count, int maxpack) | 195 | public bool ProcessImageQueue(int count, int maxpack) |
185 | { | 196 | { |
186 | //count is the number of textures we want to process in one go. | 197 | lock (this) |
187 | //As part of this class re-write, that number will probably rise | 198 | { |
188 | //since we're processing in a more efficient manner. | 199 | //count is the number of textures we want to process in one go. |
200 | //As part of this class re-write, that number will probably rise | ||
201 | //since we're processing in a more efficient manner. | ||
189 | 202 | ||
190 | // this can happen during Close() | 203 | // this can happen during Close() |
191 | if (m_client == null) | 204 | if (m_client == null) |
192 | return false; | 205 | return false; |
193 | 206 | ||
194 | int numCollected = 0; | 207 | int numCollected = 0; |
195 | 208 | ||
196 | //Calculate our threshold | 209 | //Calculate our threshold |
197 | int threshold; | 210 | int threshold; |
198 | if (m_lastloopprocessed == 0) | 211 | if (m_lastloopprocessed == 0) |
199 | { | 212 | { |
200 | if (m_client.PacketHandler == null || m_client.PacketHandler.PacketQueue == null || m_client.PacketHandler.PacketQueue.TextureThrottle == null) | 213 | if (m_client.PacketHandler == null || m_client.PacketHandler.PacketQueue == null || m_client.PacketHandler.PacketQueue.TextureThrottle == null) |
201 | return false; | 214 | return false; |
202 | //This is decent for a semi fast machine, but we'll calculate it more accurately based on time below | 215 | //This is decent for a semi fast machine, but we'll calculate it more accurately based on time below |
203 | threshold = m_client.PacketHandler.PacketQueue.TextureThrottle.Current / 6300; | 216 | threshold = m_client.PacketHandler.PacketQueue.TextureThrottle.Current / 6300; |
204 | m_lastloopprocessed = DateTime.Now.Ticks; | 217 | m_lastloopprocessed = DateTime.Now.Ticks; |
205 | } | 218 | } |
206 | else | 219 | else |
207 | { | 220 | { |
208 | double throttleseconds = ((double)DateTime.Now.Ticks - (double)m_lastloopprocessed) / (double)TimeSpan.TicksPerSecond; | 221 | double throttleseconds = ((double)DateTime.Now.Ticks - (double)m_lastloopprocessed) / (double)TimeSpan.TicksPerSecond; |
209 | throttleseconds = throttleseconds * m_client.PacketHandler.PacketQueue.TextureThrottle.Current; | 222 | throttleseconds = throttleseconds * m_client.PacketHandler.PacketQueue.TextureThrottle.Current; |
210 | 223 | ||
211 | //Average of 1000 bytes per packet | 224 | //Average of 1000 bytes per packet |
212 | throttleseconds = throttleseconds / 1000; | 225 | throttleseconds = throttleseconds / 1000; |
213 | 226 | ||
214 | //Safe-zone multiplier of 2.0 | 227 | //Safe-zone multiplier of 2.0 |
215 | threshold = (int)(throttleseconds * 2.0); | 228 | threshold = (int)(throttleseconds * 2.0); |
216 | m_lastloopprocessed = DateTime.Now.Ticks; | 229 | m_lastloopprocessed = DateTime.Now.Ticks; |
217 | 230 | ||
218 | } | 231 | } |
219 | 232 | ||
220 | if (m_client.PacketHandler == null) | 233 | if (m_client.PacketHandler == null) |
221 | return false; | 234 | return false; |
222 | 235 | ||
223 | if (m_client.PacketHandler.PacketQueue == null) | 236 | if (m_client.PacketHandler.PacketQueue == null) |
224 | return false; | 237 | return false; |
225 | 238 | ||
226 | if (threshold < 10) | 239 | if (threshold < 10) |
227 | threshold = 10; | 240 | threshold = 10; |
228 | 241 | ||
229 | //Uncomment this to see what the texture stack is doing | 242 | //Uncomment this to see what the texture stack is doing |
230 | //m_log.Debug("Queue: " + m_client.PacketHandler.PacketQueue.getQueueCount(ThrottleOutPacketType.Texture).ToString() + " Threshold: " + threshold.ToString() + " outstanding: " + m_outstandingtextures.ToString()); | 243 | //m_log.Debug("Queue: " + m_client.PacketHandler.PacketQueue.getQueueCount(ThrottleOutPacketType.Texture).ToString() + " Threshold: " + threshold.ToString() + " outstanding: " + m_outstandingtextures.ToString()); |
231 | if (m_client.PacketHandler.PacketQueue.GetQueueCount(ThrottleOutPacketType.Texture) < threshold) | 244 | if (true) //m_client.PacketHandler.PacketQueue.GetQueueCount(ThrottleOutPacketType.Texture) < threshold) |
232 | { | ||
233 | while (m_priorityQueue.Count > 0) | ||
234 | { | 245 | { |
235 | J2KImage imagereq = null; | 246 | while (m_priorityQueue.Count > 0) |
236 | lock (m_priorityQueue) | ||
237 | imagereq = m_priorityQueue.FindMax(); | ||
238 | |||
239 | if (imagereq.m_decoded == true) | ||
240 | { | 247 | { |
241 | // we need to test this here now that we are dropping assets | 248 | J2KImage imagereq = null; |
242 | if (!imagereq.m_hasasset) | 249 | lock (m_priorityQueue) |
243 | { | 250 | imagereq = m_priorityQueue.FindMax(); |
244 | m_log.WarnFormat("[LLIMAGE MANAGER]: Re-requesting the image asset {0}", imagereq.m_requestedUUID); | ||
245 | imagereq.RunUpdate(); | ||
246 | continue; | ||
247 | } | ||
248 | |||
249 | ++numCollected; | ||
250 | 251 | ||
251 | //SendPackets will send up to ten packets per cycle | 252 | if (imagereq.m_decoded == true) |
252 | if (imagereq.SendPackets(m_client, maxpack)) | ||
253 | { | 253 | { |
254 | // Send complete. Destroy any knowledge of this transfer | 254 | // we need to test this here now that we are dropping assets |
255 | try | 255 | if (!imagereq.m_hasasset) |
256 | { | 256 | { |
257 | lock (m_priorityQueue) | 257 | m_log.WarnFormat("[LLIMAGE MANAGER]: Re-requesting the image asset {0}", imagereq.m_requestedUUID); |
258 | m_priorityQueue.Delete(imagereq.m_priorityQueueHandle); | 258 | imagereq.RunUpdate(); |
259 | continue; | ||
260 | } | ||
261 | |||
262 | ++numCollected; | ||
263 | |||
264 | //SendPackets will send up to ten packets per cycle | ||
265 | if (imagereq.SendPackets(m_client, maxpack)) | ||
266 | { | ||
267 | // Send complete. Destroy any knowledge of this transfer | ||
268 | try | ||
269 | { | ||
270 | lock (m_priorityQueue) | ||
271 | m_priorityQueue.Delete(imagereq.m_priorityQueueHandle); | ||
272 | } | ||
273 | catch (Exception) { } | ||
259 | } | 274 | } |
260 | catch (Exception) { } | ||
261 | } | 275 | } |
262 | } | ||
263 | 276 | ||
264 | if (numCollected == count) | 277 | if (numCollected == count) |
265 | break; | 278 | break; |
279 | } | ||
266 | } | 280 | } |
267 | } | ||
268 | 281 | ||
269 | return m_priorityQueue.Count > 0; | 282 | return m_priorityQueue.Count > 0; |
283 | } | ||
270 | } | 284 | } |
271 | 285 | ||
272 | //Faux destructor | 286 | //Faux destructor |