diff options
author | Justin Clark-Casey (justincc) | 2012-01-19 23:09:16 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-01-19 23:09:16 +0000 |
commit | ea72428c9d3fa27ab43bb3e0b2e297bf3b22861e (patch) | |
tree | 618b9007b2f4d3b425d539a67a4dfe796a5362d6 /OpenSim/Region/ClientStack/Linden | |
parent | Add image not in database test for LLImageManager (diff) | |
download | opensim-SC-ea72428c9d3fa27ab43bb3e0b2e297bf3b22861e.zip opensim-SC-ea72428c9d3fa27ab43bb3e0b2e297bf3b22861e.tar.gz opensim-SC-ea72428c9d3fa27ab43bb3e0b2e297bf3b22861e.tar.bz2 opensim-SC-ea72428c9d3fa27ab43bb3e0b2e297bf3b22861e.tar.xz |
Allow a viewer UDP image request retry to trigger another asset fetch if an existing fetch hasn't responded before a timeout.
This is to stop a high priority image/texture request from blocking the entire download queue if its asset fetch got dropped for some reason.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 32 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs | 6 |
2 files changed, 32 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index 8dd76d8..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 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index a48251f..073c357 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs | |||
@@ -101,9 +101,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
101 | 101 | ||
102 | // Do a linear search for this texture download | 102 | // Do a linear search for this texture download |
103 | lock (m_syncRoot) | 103 | lock (m_syncRoot) |
104 | { | ||
105 | m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest); | 104 | m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest); |
106 | } | ||
107 | 105 | ||
108 | if (imgrequest != null) | 106 | if (imgrequest != null) |
109 | { | 107 | { |
@@ -124,8 +122,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
124 | // "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}", | 122 | // "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}", |
125 | // newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); | 123 | // newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); |
126 | 124 | ||
127 | //m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", | 125 | // m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", |
128 | // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); | 126 | // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); |
129 | 127 | ||
130 | //Check the packet sequence to make sure this isn't older than | 128 | //Check the packet sequence to make sure this isn't older than |
131 | //one we've already received | 129 | //one we've already received |