aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-01-19 21:57:12 +0000
committerJustin Clark-Casey (justincc)2012-01-19 21:57:12 +0000
commitd38e2c0c91b684d54974865d3ac2fb88c3354c21 (patch)
tree43a517d5df2b8b6d9444446c9d23ad7b394a883d /OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
parentrefactor: separate out common parts of LLImageManagerTests (diff)
downloadopensim-SC_OLD-d38e2c0c91b684d54974865d3ac2fb88c3354c21.zip
opensim-SC_OLD-d38e2c0c91b684d54974865d3ac2fb88c3354c21.tar.gz
opensim-SC_OLD-d38e2c0c91b684d54974865d3ac2fb88c3354c21.tar.bz2
opensim-SC_OLD-d38e2c0c91b684d54974865d3ac2fb88c3354c21.tar.xz
Add image not in database test for LLImageManager
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs29
1 files changed, 21 insertions, 8 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
index 7bfb844..a48251f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
@@ -55,18 +55,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
56 private bool m_shuttingdown; 56 private bool m_shuttingdown;
57 private AssetBase m_missingImage; 57 private AssetBase m_missingImage;
58 private IClientAPI m_client; //Client we're assigned to 58 private IAssetService m_assetCache;
59 private IAssetService m_assetCache; //Asset Cache 59 private IJ2KDecoder m_j2kDecodeModule;
60 private IJ2KDecoder m_j2kDecodeModule; //Our J2K module 60
61 /// <summary>
62 /// Priority queue for determining which image to send first.
63 /// </summary>
61 private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer()); 64 private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer());
65
66 /// <summary>
67 /// Used to control thread access to the priority queue.
68 /// </summary>
62 private object m_syncRoot = new object(); 69 private object m_syncRoot = new object();
63 70
64 public IClientAPI Client { get { return m_client; } } 71 /// <summary>
72 /// Client served by this image manager
73 /// </summary>
74 public IClientAPI Client { get; private set; }
75
65 public AssetBase MissingImage { get { return m_missingImage; } } 76 public AssetBase MissingImage { get { return m_missingImage; } }
66 77
67 public LLImageManager(IClientAPI client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule) 78 public LLImageManager(IClientAPI client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule)
68 { 79 {
69 m_client = client; 80 Client = client;
70 m_assetCache = pAssetCache; 81 m_assetCache = pAssetCache;
71 82
72 if (pAssetCache != null) 83 if (pAssetCache != null)
@@ -90,7 +101,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
90 101
91 // Do a linear search for this texture download 102 // Do a linear search for this texture download
92 lock (m_syncRoot) 103 lock (m_syncRoot)
104 {
93 m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest); 105 m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest);
106 }
94 107
95 if (imgrequest != null) 108 if (imgrequest != null)
96 { 109 {
@@ -178,8 +191,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
178 imgrequest = new J2KImage(this); 191 imgrequest = new J2KImage(this);
179 imgrequest.J2KDecoder = m_j2kDecodeModule; 192 imgrequest.J2KDecoder = m_j2kDecodeModule;
180 imgrequest.AssetService = m_assetCache; 193 imgrequest.AssetService = m_assetCache;
181 imgrequest.AgentID = m_client.AgentId; 194 imgrequest.AgentID = Client.AgentId;
182 imgrequest.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>(); 195 imgrequest.InventoryAccessModule = Client.Scene.RequestModuleInterface<IInventoryAccessModule>();
183 imgrequest.DiscardLevel = newRequest.DiscardLevel; 196 imgrequest.DiscardLevel = newRequest.DiscardLevel;
184 imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber); 197 imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber);
185 imgrequest.Priority = newRequest.Priority; 198 imgrequest.Priority = newRequest.Priority;
@@ -210,7 +223,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
210 if (image.IsDecoded) 223 if (image.IsDecoded)
211 { 224 {
212 int sent; 225 int sent;
213 bool imageDone = image.SendPackets(m_client, packetsToSend - packetsSent, out sent); 226 bool imageDone = image.SendPackets(Client, packetsToSend - packetsSent, out sent);
214 packetsSent += sent; 227 packetsSent += sent;
215 228
216 // If the send is complete, destroy any knowledge of this transfer 229 // If the send is complete, destroy any knowledge of this transfer