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.cs41
1 files changed, 36 insertions, 5 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index 8aa2ff3..3995620 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;
@@ -82,7 +105,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
82 /// <param name="packetsToSend">Maximum number of packets to send during this call</param> 105 /// <param name="packetsToSend">Maximum number of packets to send during this call</param>
83 /// <param name="packetsSent">Number of packets sent during this call</param> 106 /// <param name="packetsSent">Number of packets sent during this call</param>
84 /// <returns>True if the transfer completes at the current discard level, otherwise false</returns> 107 /// <returns>True if the transfer completes at the current discard level, otherwise false</returns>
85 public bool SendPackets(LLClientView client, int packetsToSend, out int packetsSent) 108 public bool SendPackets(IClientAPI client, int packetsToSend, out int packetsSent)
86 { 109 {
87 packetsSent = 0; 110 packetsSent = 0;
88 111
@@ -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 }
@@ -215,7 +243,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
215 } 243 }
216 } 244 }
217 245
218 private bool SendFirstPacket(LLClientView client) 246 private bool SendFirstPacket(IClientAPI client)
219 { 247 {
220 if (client == null) 248 if (client == null)
221 return false; 249 return false;
@@ -250,7 +278,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
250 return false; 278 return false;
251 } 279 }
252 280
253 private bool SendPacket(LLClientView client) 281 private bool SendPacket(IClientAPI client)
254 { 282 {
255 if (client == null) 283 if (client == null)
256 return false; 284 return false;
@@ -380,6 +408,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
380 408
381 private void AssetReceived(string id, Object sender, AssetBase asset) 409 private void AssetReceived(string id, Object sender, AssetBase asset)
382 { 410 {
411// m_log.DebugFormat(
412// "[J2KIMAGE]: Received asset {0} ({1} bytes)", id, asset != null ? asset.Data.Length.ToString() : "n/a");
413
383 UUID assetID = UUID.Zero; 414 UUID assetID = UUID.Zero;
384 if (asset != null) 415 if (asset != null)
385 { 416 {