aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs35
1 files changed, 33 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index bbd2c43..afbe56b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
@@ -45,6 +45,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
45 private const int IMAGE_PACKET_SIZE = 1000; 45 private const int IMAGE_PACKET_SIZE = 1000;
46 private const int FIRST_PACKET_SIZE = 600; 46 private const int FIRST_PACKET_SIZE = 600;
47 47
48 /// <summary>
49 /// If we've requested an asset but not received it in this ticks timeframe, then allow a duplicate
50 /// request from the client to trigger a fresh asset request.
51 /// </summary>
52 /// <remarks>
53 /// There are 10,000 ticks in a millisecond
54 /// </remarks>
55 private const int ASSET_REQUEST_TIMEOUT = 100000000;
56
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 58
50 public uint LastSequence; 59 public uint LastSequence;
@@ -57,8 +66,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
57 public UUID AgentID; 66 public UUID AgentID;
58 public IInventoryAccessModule InventoryAccessModule; 67 public IInventoryAccessModule InventoryAccessModule;
59 private OpenJPEG.J2KLayerInfo[] m_layers; 68 private OpenJPEG.J2KLayerInfo[] m_layers;
69
70 /// <summary>
71 /// Has this request decoded the asset data?
72 /// </summary>
60 public bool IsDecoded { get; private set; } 73 public bool IsDecoded { get; private set; }
74
75 /// <summary>
76 /// Has this request received the required asset data?
77 /// </summary>
61 public bool HasAsset { get; private set; } 78 public bool HasAsset { get; private set; }
79
80 /// <summary>
81 /// Time in milliseconds at which the asset was requested.
82 /// </summary>
83 public long AssetRequestTime { get; private set; }
84
62 public C5.IPriorityQueueHandle<J2KImage> PriorityQueueHandle; 85 public C5.IPriorityQueueHandle<J2KImage> PriorityQueueHandle;
63 86
64 private uint m_currentPacket; 87 private uint m_currentPacket;
@@ -123,10 +146,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
123 { 146 {
124 if (!HasAsset) 147 if (!HasAsset)
125 { 148 {
126 if (!m_assetRequested) 149 if (!m_assetRequested || DateTime.UtcNow.Ticks > AssetRequestTime + ASSET_REQUEST_TIMEOUT)
127 { 150 {
151// m_log.DebugFormat(
152// "[J2KIMAGE]: Requesting asset {0} from request in packet {1}, already requested? {2}, due to timeout? {3}",
153// TextureID, LastSequence, m_assetRequested, DateTime.UtcNow.Ticks > AssetRequestTime + ASSET_REQUEST_TIMEOUT);
154
128 m_assetRequested = true; 155 m_assetRequested = true;
129// m_log.DebugFormat("[J2KIMAGE]: Requesting asset {0}", TextureID); 156 AssetRequestTime = DateTime.UtcNow.Ticks;
157
130 AssetService.Get(TextureID.ToString(), this, AssetReceived); 158 AssetService.Get(TextureID.ToString(), this, AssetReceived);
131 } 159 }
132 } 160 }
@@ -377,6 +405,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
377 405
378 private void AssetReceived(string id, Object sender, AssetBase asset) 406 private void AssetReceived(string id, Object sender, AssetBase asset)
379 { 407 {
408// m_log.DebugFormat(
409// "[J2KIMAGE]: Received asset {0} ({1} bytes)", id, asset != null ? asset.Data.Length.ToString() : "n/a");
410
380 UUID assetID = UUID.Zero; 411 UUID assetID = UUID.Zero;
381 if (asset != null) 412 if (asset != null)
382 { 413 {