aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs14
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs50
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs5
3 files changed, 58 insertions, 11 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
index 5877779..bb98f24 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
@@ -31,6 +31,7 @@ using OpenMetaverse;
31using OpenMetaverse.Imaging; 31using OpenMetaverse.Imaging;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes.Hypergrid;
34using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
35using log4net; 36using log4net;
36using System.Reflection; 37using 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;
@@ -370,6 +373,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
370 UUID assetID = UUID.Zero; 373 UUID assetID = UUID.Zero;
371 if (asset != null) 374 if (asset != null)
372 assetID = asset.FullID; 375 assetID = asset.FullID;
376 else if ((HyperAssets != null) && (sender != HyperAssets))
377 {
378 // Try the user's inventory, but only if it's different from the regions'
379 string userAssets = HyperAssets.GetUserAssetServer(AgentID);
380 if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer()))
381 {
382 m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id);
383 AssetService.Get(userAssets + "/" + id, HyperAssets, AssetReceived);
384 return;
385 }
386 }
373 387
374 AssetDataCallback(assetID, asset); 388 AssetDataCallback(assetID, asset);
375 389
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 3b1a0bd..cfc1ebc 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -43,6 +43,7 @@ using OpenSim.Framework.Communications.Cache;
43using OpenSim.Framework.Statistics; 43using OpenSim.Framework.Statistics;
44using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
45using OpenSim.Region.Framework.Scenes; 45using OpenSim.Region.Framework.Scenes;
46using OpenSim.Region.Framework.Scenes.Hypergrid;
46using OpenSim.Services.Interfaces; 47using OpenSim.Services.Interfaces;
47using Timer=System.Timers.Timer; 48using Timer=System.Timers.Timer;
48using AssetLandmark = OpenSim.Framework.AssetLandmark; 49using AssetLandmark = OpenSim.Framework.AssetLandmark;
@@ -318,6 +319,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
318 protected int m_avatarTerseUpdateRate = 50; 319 protected int m_avatarTerseUpdateRate = 50;
319 protected int m_avatarTerseUpdatesPerPacket = 5; 320 protected int m_avatarTerseUpdatesPerPacket = 5;
320 protected IAssetService m_assetService; 321 protected IAssetService m_assetService;
322 private IHyperAssetService m_hyperAssets;
323
321 324
322 #endregion Class Members 325 #endregion Class Members
323 326
@@ -376,6 +379,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
376 379
377 m_scene = scene; 380 m_scene = scene;
378 m_assetService = m_scene.RequestModuleInterface<IAssetService>(); 381 m_assetService = m_scene.RequestModuleInterface<IAssetService>();
382 m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>();
379 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); 383 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
380 m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>()); 384 m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
381 m_channelVersion = Utils.StringToBytes(scene.GetSimulatorVersion()); 385 m_channelVersion = Utils.StringToBytes(scene.GetSimulatorVersion());
@@ -6894,7 +6898,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6894 #endregion 6898 #endregion
6895 6899
6896 //handlerTextureRequest = null; 6900 //handlerTextureRequest = null;
6897
6898 for (int i = 0; i < imageRequest.RequestImage.Length; i++) 6901 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
6899 { 6902 {
6900 if (OnRequestTexture != null) 6903 if (OnRequestTexture != null)
@@ -6905,7 +6908,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6905 args.PacketNumber = imageRequest.RequestImage[i].Packet; 6908 args.PacketNumber = imageRequest.RequestImage[i].Packet;
6906 args.Priority = imageRequest.RequestImage[i].DownloadPriority; 6909 args.Priority = imageRequest.RequestImage[i].DownloadPriority;
6907 args.requestSequence = imageRequest.Header.Sequence; 6910 args.requestSequence = imageRequest.Header.Sequence;
6908
6909 //handlerTextureRequest = OnRequestTexture; 6911 //handlerTextureRequest = OnRequestTexture;
6910 6912
6911 //if (handlerTextureRequest != null) 6913 //if (handlerTextureRequest != null)
@@ -6928,10 +6930,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6928 // Validate inventory transfers 6930 // Validate inventory transfers
6929 // Has to be done here, because AssetCache can't do it 6931 // Has to be done here, because AssetCache can't do it
6930 // 6932 //
6931 6933 UUID taskID = UUID.Zero;
6932 if (transfer.TransferInfo.SourceType == 3) 6934 if (transfer.TransferInfo.SourceType == 3)
6933 { 6935 {
6934 UUID taskID = new UUID(transfer.TransferInfo.Params, 48); 6936 taskID = new UUID(transfer.TransferInfo.Params, 48);
6935 UUID itemID = new UUID(transfer.TransferInfo.Params, 64); 6937 UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
6936 UUID requestID = new UUID(transfer.TransferInfo.Params, 80); 6938 UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
6937 if (!(((Scene)m_scene).Permissions.BypassPermissions())) 6939 if (!(((Scene)m_scene).Permissions.BypassPermissions()))
@@ -7002,7 +7004,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7002 7004
7003 //m_assetCache.AddAssetRequest(this, transfer); 7005 //m_assetCache.AddAssetRequest(this, transfer);
7004 7006
7005 MakeAssetRequest(transfer); 7007 MakeAssetRequest(transfer, taskID);
7006 7008
7007 /* RequestAsset = OnRequestAsset; 7009 /* RequestAsset = OnRequestAsset;
7008 if (RequestAsset != null) 7010 if (RequestAsset != null)
@@ -10209,7 +10211,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10209 return String.Empty; 10211 return String.Empty;
10210 } 10212 }
10211 10213
10212 public void MakeAssetRequest(TransferRequestPacket transferRequest) 10214 public void MakeAssetRequest(TransferRequestPacket transferRequest, UUID taskID)
10213 { 10215 {
10214 UUID requestID = UUID.Zero; 10216 UUID requestID = UUID.Zero;
10215 if (transferRequest.TransferInfo.SourceType == 2) 10217 if (transferRequest.TransferInfo.SourceType == 2)
@@ -10221,12 +10223,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10221 { 10223 {
10222 //inventory asset request 10224 //inventory asset request
10223 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 10225 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
10224 //m_log.Debug("asset request " + requestID); 10226 //m_log.Debug("[XXX] inventory asset request " + requestID);
10227 //if (taskID == UUID.Zero) // Agent
10228 // if (m_scene is HGScene)
10229 // {
10230 // m_log.Debug("[XXX] hg asset request " + requestID);
10231 // // We may need to fetch the asset from the user's asset server into the local asset server
10232 // HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper;
10233 // mapper.Get(requestID, AgentId);
10234 // }
10225 } 10235 }
10226 10236
10227 //check to see if asset is in local cache, if not we need to request it from asset server. 10237 //check to see if asset is in local cache, if not we need to request it from asset server.
10228 //m_log.Debug("asset request " + requestID); 10238 //m_log.Debug("asset request " + requestID);
10229 10239
10230 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); 10240 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
10231 10241
10232 } 10242 }
@@ -10237,12 +10247,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10237 10247
10238 UUID requestID = UUID.Zero; 10248 UUID requestID = UUID.Zero;
10239 byte source = 2; 10249 byte source = 2;
10240 if (transferRequest.TransferInfo.SourceType == 2) 10250 if ((transferRequest.TransferInfo.SourceType == 2) || (transferRequest.TransferInfo.SourceType == 2222))
10241 { 10251 {
10242 //direct asset request 10252 //direct asset request
10243 requestID = new UUID(transferRequest.TransferInfo.Params, 0); 10253 requestID = new UUID(transferRequest.TransferInfo.Params, 0);
10244 } 10254 }
10245 else if (transferRequest.TransferInfo.SourceType == 3) 10255 else if ((transferRequest.TransferInfo.SourceType == 3) || (transferRequest.TransferInfo.SourceType == 3333))
10246 { 10256 {
10247 //inventory asset request 10257 //inventory asset request
10248 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 10258 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
@@ -10250,10 +10260,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10250 //m_log.Debug("asset request " + requestID); 10260 //m_log.Debug("asset request " + requestID);
10251 } 10261 }
10252 10262
10253 // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right.
10254 if (null == asset) 10263 if (null == asset)
10255 { 10264 {
10265 if ((m_hyperAssets != null) && (transferRequest.TransferInfo.SourceType < 2000))
10266 {
10267 // Try the user's inventory, but only if it's different from the regions'
10268 string userAssets = m_hyperAssets.GetUserAssetServer(AgentId);
10269 if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer()))
10270 {
10271 m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id);
10272 if (transferRequest.TransferInfo.SourceType == 2)
10273 transferRequest.TransferInfo.SourceType = 2222; // marker
10274 else if (transferRequest.TransferInfo.SourceType == 3)
10275 transferRequest.TransferInfo.SourceType = 3333; // marker
10276
10277 m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived);
10278 return;
10279 }
10280 }
10281
10256 //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID); 10282 //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID);
10283
10284 // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right.
10257 return; 10285 return;
10258 } 10286 }
10259 10287
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
index 8410ee9..681562b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
@@ -59,6 +59,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
59 private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer()); 59 private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer());
60 private object m_syncRoot = new object(); 60 private object m_syncRoot = new object();
61 61
62 private IHyperAssetService m_hyperAssets;
63
62 public LLClientView Client { get { return m_client; } } 64 public LLClientView Client { get { return m_client; } }
63 public AssetBase MissingImage { get { return m_missingImage; } } 65 public AssetBase MissingImage { get { return m_missingImage; } }
64 66
@@ -74,6 +76,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
74 m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client"); 76 m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client");
75 77
76 m_j2kDecodeModule = pJ2kDecodeModule; 78 m_j2kDecodeModule = pJ2kDecodeModule;
79 m_hyperAssets = client.Scene.RequestModuleInterface<IHyperAssetService>();
77 } 80 }
78 81
79 /// <summary> 82 /// <summary>
@@ -146,6 +149,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
146 imgrequest = new J2KImage(this); 149 imgrequest = new J2KImage(this);
147 imgrequest.J2KDecoder = m_j2kDecodeModule; 150 imgrequest.J2KDecoder = m_j2kDecodeModule;
148 imgrequest.AssetService = m_assetCache; 151 imgrequest.AssetService = m_assetCache;
152 imgrequest.AgentID = m_client.AgentId;
153 imgrequest.HyperAssets = m_hyperAssets;
149 imgrequest.DiscardLevel = newRequest.DiscardLevel; 154 imgrequest.DiscardLevel = newRequest.DiscardLevel;
150 imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber); 155 imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber);
151 imgrequest.Priority = newRequest.Priority; 156 imgrequest.Priority = newRequest.Priority;