From c0beeb929e22509329781cdf85f7a5d90c4b0e36 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 12 Oct 2009 17:00:01 -0700 Subject: * Fixes http://opensimulator.org/mantis/view.php?id=4225 * Fixes http://opensimulator.org/mantis/view.php?id=3959 * Allows for viewing inventory textures outside home grid --- OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | 14 ++++++++++++++ .../Region/ClientStack/LindenUDP/LLClientView.cs | 21 ++++++++++++++------- .../Region/ClientStack/LindenUDP/LLImageManager.cs | 5 +++++ 3 files changed, 33 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack/LindenUDP') diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index 5877779..1bbe00f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs @@ -31,6 +31,7 @@ using OpenMetaverse; using OpenMetaverse.Imaging; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes.Hypergrid; using OpenSim.Services.Interfaces; using log4net; using System.Reflection; @@ -54,6 +55,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public UUID TextureID; public IJ2KDecoder J2KDecoder; public IAssetService AssetService; + public UUID AgentID; + public IHyperAssetService HyperAssets; public OpenJPEG.J2KLayerInfo[] Layers; public bool IsDecoded; public bool HasAsset; @@ -370,6 +373,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP UUID assetID = UUID.Zero; if (asset != null) assetID = asset.FullID; + else if (HyperAssets != null) + { + // Try the user's inventory, but only if it's different from the regions' + string userAssets = HyperAssets.GetUserAssetServer(AgentID); + if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer())) + { + m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id); + AssetService.Get(userAssets + "/" + id, this, AssetReceived); + return; + } + } AssetDataCallback(assetID, asset); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 84e705a..25eb5cd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -43,6 +43,7 @@ using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Statistics; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Scenes.Hypergrid; using OpenSim.Services.Interfaces; using Timer=System.Timers.Timer; using AssetLandmark = OpenSim.Framework.AssetLandmark; @@ -117,6 +118,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected int m_packetMTU = 1400; protected IAssetService m_assetService; + #region Properties public UUID SecureSessionId { get { return m_secureSessionId; } } @@ -7013,7 +7015,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion //handlerTextureRequest = null; - for (int i = 0; i < imageRequest.RequestImage.Length; i++) { if (OnRequestTexture != null) @@ -7024,7 +7025,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP args.PacketNumber = imageRequest.RequestImage[i].Packet; args.Priority = imageRequest.RequestImage[i].DownloadPriority; args.requestSequence = imageRequest.Header.Sequence; - //handlerTextureRequest = OnRequestTexture; //if (handlerTextureRequest != null) @@ -7047,10 +7047,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Validate inventory transfers // Has to be done here, because AssetCache can't do it // - + UUID taskID = UUID.Zero; if (transfer.TransferInfo.SourceType == 3) { - UUID taskID = new UUID(transfer.TransferInfo.Params, 48); + taskID = new UUID(transfer.TransferInfo.Params, 48); UUID itemID = new UUID(transfer.TransferInfo.Params, 64); UUID requestID = new UUID(transfer.TransferInfo.Params, 80); if (!(((Scene)m_scene).Permissions.BypassPermissions())) @@ -7121,7 +7121,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //m_assetCache.AddAssetRequest(this, transfer); - MakeAssetRequest(transfer); + MakeAssetRequest(transfer, taskID); /* RequestAsset = OnRequestAsset; if (RequestAsset != null) @@ -10330,7 +10330,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return String.Empty; } - public void MakeAssetRequest(TransferRequestPacket transferRequest) + public void MakeAssetRequest(TransferRequestPacket transferRequest, UUID taskID) { UUID requestID = UUID.Zero; if (transferRequest.TransferInfo.SourceType == 2) @@ -10343,11 +10343,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP //inventory asset request requestID = new UUID(transferRequest.TransferInfo.Params, 80); //m_log.Debug("asset request " + requestID); + if (taskID == UUID.Zero) // Agent + if (m_scene is HGScene) + { + // We may need to fetch the asset from the user's asset server into the local asset server + HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper; + mapper.Get(requestID, AgentId); + } } //check to see if asset is in local cache, if not we need to request it from asset server. //m_log.Debug("asset request " + requestID); - + m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index 343f537..56d34e6 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs @@ -59,6 +59,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP private C5.IntervalHeap m_priorityQueue = new C5.IntervalHeap(10, new J2KImageComparer()); private object m_syncRoot = new object(); + private IHyperAssetService m_hyperAssets; + public LLClientView Client { get { return m_client; } } public AssetBase MissingImage { get { return m_missingImage; } } @@ -74,6 +76,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client"); m_j2kDecodeModule = pJ2kDecodeModule; + m_hyperAssets = client.Scene.RequestModuleInterface(); } /// @@ -146,6 +149,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP imgrequest = new J2KImage(this); imgrequest.J2KDecoder = m_j2kDecodeModule; imgrequest.AssetService = m_assetCache; + imgrequest.AgentID = m_client.AgentId; + imgrequest.HyperAssets = m_hyperAssets; imgrequest.DiscardLevel = newRequest.DiscardLevel; imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber); imgrequest.Priority = newRequest.Priority; -- cgit v1.1 From 63ed605eba7d4655bbbf956cef0d6e6b02b4a64e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 12 Oct 2009 17:36:13 -0700 Subject: Stop the recurring texture requests for textures that truly don't exist. --- OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/LindenUDP') diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index 1bbe00f..bb98f24 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs @@ -373,14 +373,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP UUID assetID = UUID.Zero; if (asset != null) assetID = asset.FullID; - else if (HyperAssets != null) + else if ((HyperAssets != null) && (sender != HyperAssets)) { // Try the user's inventory, but only if it's different from the regions' string userAssets = HyperAssets.GetUserAssetServer(AgentID); if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer())) { m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id); - AssetService.Get(userAssets + "/" + id, this, AssetReceived); + AssetService.Get(userAssets + "/" + id, HyperAssets, AssetReceived); return; } } -- cgit v1.1 From f3d2192cd486cf32517e6c4549a3a691422a5f88 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 12 Oct 2009 18:30:06 -0700 Subject: Better handling of missing assets. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 32 ++++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ClientStack/LindenUDP') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 25eb5cd..ad92494 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -117,6 +117,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected int m_avatarTerseUpdatesPerPacket = 5; protected int m_packetMTU = 1400; protected IAssetService m_assetService; + private IHyperAssetService m_hyperAssets; #region Properties @@ -172,6 +173,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_scene = scene; m_assetService = m_scene.RequestModuleInterface(); + m_hyperAssets = m_scene.RequestModuleInterface(); m_GroupsModule = scene.RequestModuleInterface(); m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface()); m_channelVersion = Utils.StringToBytes(scene.GetSimulatorVersion()); @@ -10342,14 +10344,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP { //inventory asset request requestID = new UUID(transferRequest.TransferInfo.Params, 80); - //m_log.Debug("asset request " + requestID); - if (taskID == UUID.Zero) // Agent - if (m_scene is HGScene) - { - // We may need to fetch the asset from the user's asset server into the local asset server - HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper; - mapper.Get(requestID, AgentId); - } + //m_log.Debug("[XXX] inventory asset request " + requestID); + //if (taskID == UUID.Zero) // Agent + // if (m_scene is HGScene) + // { + // m_log.Debug("[XXX] hg asset request " + requestID); + // // We may need to fetch the asset from the user's asset server into the local asset server + // HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper; + // mapper.Get(requestID, AgentId); + // } } //check to see if asset is in local cache, if not we need to request it from asset server. @@ -10378,10 +10381,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP //m_log.Debug("asset request " + requestID); } - // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right. if (null == asset) { + // Try the user's inventory, but only if it's different from the regions' + string userAssets = m_hyperAssets.GetUserAssetServer(AgentId); + if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer())) + { + m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id); + transferRequest.TransferInfo.SourceType = 9999; // marker + m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived); + return; + } + //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID); + + // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right. return; } -- cgit v1.1 From e3d5beebfb44aee8a9bd30526be8d4e65adf632b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 13 Oct 2009 06:39:11 -0700 Subject: Better handling of missing assets. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 25 ++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ClientStack/LindenUDP') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index ad92494..d64f655 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -10368,12 +10368,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP UUID requestID = UUID.Zero; byte source = 2; - if (transferRequest.TransferInfo.SourceType == 2) + if ((transferRequest.TransferInfo.SourceType == 2) || (transferRequest.TransferInfo.SourceType == 2222)) { //direct asset request requestID = new UUID(transferRequest.TransferInfo.Params, 0); } - else if (transferRequest.TransferInfo.SourceType == 3) + else if ((transferRequest.TransferInfo.SourceType == 3) || (transferRequest.TransferInfo.SourceType == 3333)) { //inventory asset request requestID = new UUID(transferRequest.TransferInfo.Params, 80); @@ -10383,14 +10383,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (null == asset) { - // Try the user's inventory, but only if it's different from the regions' - string userAssets = m_hyperAssets.GetUserAssetServer(AgentId); - if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer())) + if ((m_hyperAssets != null) && (transferRequest.TransferInfo.SourceType < 2000)) { - m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id); - transferRequest.TransferInfo.SourceType = 9999; // marker - m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived); - return; + // Try the user's inventory, but only if it's different from the regions' + string userAssets = m_hyperAssets.GetUserAssetServer(AgentId); + if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer())) + { + m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id); + if (transferRequest.TransferInfo.SourceType == 2) + transferRequest.TransferInfo.SourceType = 2222; // marker + else if (transferRequest.TransferInfo.SourceType == 3) + transferRequest.TransferInfo.SourceType = 3333; // marker + + m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived); + return; + } } //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID); -- cgit v1.1