diff options
Merge branch 'master' into vehicles
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index 5877779..b53a2fb 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | |||
@@ -31,6 +31,7 @@ using OpenMetaverse; | |||
31 | using OpenMetaverse.Imaging; | 31 | using OpenMetaverse.Imaging; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes.Hypergrid; | ||
34 | using OpenSim.Services.Interfaces; | 35 | using OpenSim.Services.Interfaces; |
35 | using log4net; | 36 | using log4net; |
36 | using System.Reflection; | 37 | using System.Reflection; |
@@ -54,6 +55,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
54 | public UUID TextureID; | 55 | public UUID TextureID; |
55 | public IJ2KDecoder J2KDecoder; | 56 | public IJ2KDecoder J2KDecoder; |
56 | public IAssetService AssetService; | 57 | public IAssetService AssetService; |
58 | public UUID AgentID; | ||
59 | public IHyperAssetService HyperAssets; | ||
57 | public OpenJPEG.J2KLayerInfo[] Layers; | 60 | public OpenJPEG.J2KLayerInfo[] Layers; |
58 | public bool IsDecoded; | 61 | public bool IsDecoded; |
59 | public bool HasAsset; | 62 | public bool HasAsset; |
@@ -72,14 +75,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
72 | m_imageManager = imageManager; | 75 | m_imageManager = imageManager; |
73 | } | 76 | } |
74 | 77 | ||
75 | public bool SendPackets(LLClientView client, int maxpack) | 78 | /// <summary> |
79 | /// Sends packets for this texture to a client until packetsToSend is | ||
80 | /// hit or the transfer completes | ||
81 | /// </summary> | ||
82 | /// <param name="client">Reference to the client that the packets are destined for</param> | ||
83 | /// <param name="packetsToSend">Maximum number of packets to send during this call</param> | ||
84 | /// <param name="packetsSent">Number of packets sent during this call</param> | ||
85 | /// <returns>True if the transfer completes at the current discard level, otherwise false</returns> | ||
86 | public bool SendPackets(LLClientView client, int packetsToSend, out int packetsSent) | ||
76 | { | 87 | { |
77 | if (client == null) | 88 | packetsSent = 0; |
78 | return false; | ||
79 | 89 | ||
80 | if (m_currentPacket <= m_stopPacket) | 90 | if (m_currentPacket <= m_stopPacket) |
81 | { | 91 | { |
82 | int count = 0; | ||
83 | bool sendMore = true; | 92 | bool sendMore = true; |
84 | 93 | ||
85 | if (!m_sentInfo || (m_currentPacket == 0)) | 94 | if (!m_sentInfo || (m_currentPacket == 0)) |
@@ -88,25 +97,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
88 | 97 | ||
89 | m_sentInfo = true; | 98 | m_sentInfo = true; |
90 | ++m_currentPacket; | 99 | ++m_currentPacket; |
91 | ++count; | 100 | ++packetsSent; |
92 | } | 101 | } |
93 | if (m_currentPacket < 2) | 102 | if (m_currentPacket < 2) |
94 | { | 103 | { |
95 | m_currentPacket = 2; | 104 | m_currentPacket = 2; |
96 | } | 105 | } |
97 | 106 | ||
98 | while (sendMore && count < maxpack && m_currentPacket <= m_stopPacket) | 107 | while (sendMore && packetsSent < packetsToSend && m_currentPacket <= m_stopPacket) |
99 | { | 108 | { |
100 | sendMore = SendPacket(client); | 109 | sendMore = SendPacket(client); |
101 | ++m_currentPacket; | 110 | ++m_currentPacket; |
102 | ++count; | 111 | ++packetsSent; |
103 | } | 112 | } |
104 | |||
105 | if (m_currentPacket > m_stopPacket) | ||
106 | return true; | ||
107 | } | 113 | } |
108 | 114 | ||
109 | return false; | 115 | return (m_currentPacket > m_stopPacket); |
110 | } | 116 | } |
111 | 117 | ||
112 | public void RunUpdate() | 118 | public void RunUpdate() |
@@ -370,6 +376,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
370 | UUID assetID = UUID.Zero; | 376 | UUID assetID = UUID.Zero; |
371 | if (asset != null) | 377 | if (asset != null) |
372 | assetID = asset.FullID; | 378 | assetID = asset.FullID; |
379 | else if ((HyperAssets != null) && (sender != HyperAssets)) | ||
380 | { | ||
381 | // Try the user's inventory, but only if it's different from the regions' | ||
382 | string userAssets = HyperAssets.GetUserAssetServer(AgentID); | ||
383 | if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer())) | ||
384 | { | ||
385 | m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id); | ||
386 | AssetService.Get(userAssets + "/" + id, HyperAssets, AssetReceived); | ||
387 | return; | ||
388 | } | ||
389 | } | ||
373 | 390 | ||
374 | AssetDataCallback(assetID, asset); | 391 | AssetDataCallback(assetID, asset); |
375 | 392 | ||