From 02a15bc787b2cc6784c9626e041a4365ec362194 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 4 Jul 2010 13:56:03 -0700 Subject: Started to clean up the mess with HyperAssets in LLClientView. Fixed HG access to Notecards in user's inventory. --- OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | 1 + .../Region/ClientStack/LindenUDP/LLClientView.cs | 89 ++-------------------- 2 files changed, 9 insertions(+), 81 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index 9869a99..f6ad6e1 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs @@ -379,6 +379,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // 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); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d2824bd..3a2c019 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -7196,59 +7196,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else // Agent { - IInventoryService invService = m_scene.RequestModuleInterface(); - InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId); - assetRequestItem = invService.GetItem(assetRequestItem); - if (assetRequestItem == null) + IInventoryAccessModule invAccess = m_scene.RequestModuleInterface(); + if (invAccess != null) { - ILibraryService lib = m_scene.RequestModuleInterface(); - if (lib != null) - assetRequestItem = lib.LibraryRootFolder.FindItem(itemID); - if (assetRequestItem == null) - return true; - } + if (!invAccess.GetAgentInventoryItem(this, itemID, requestID)) + return false; - // At this point, we need to apply perms - // only to notecards and scripts. All - // other asset types are always available - // - if (assetRequestItem.AssetType == (int)AssetType.LSLText) - { - if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId)) - { - SendAgentAlertMessage("Insufficient permissions to view script", false); - return true; - } - } - else if (assetRequestItem.AssetType == (int)AssetType.Notecard) - { - if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId)) - { - SendAgentAlertMessage("Insufficient permissions to view notecard", false); - return true; - } } + else + return false; - if (assetRequestItem.AssetID != requestID) - { - m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}", - Name, requestID, itemID, assetRequestItem.AssetID); - return true; - } } } } - //m_assetCache.AddAssetRequest(this, transfer); - MakeAssetRequest(transfer, taskID); - /* RequestAsset = OnRequestAsset; - if (RequestAsset != null) - { - RequestAsset(this, transfer); - }*/ return true; } @@ -11459,15 +11422,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) { requestID = new UUID(transferRequest.TransferInfo.Params, 80); - //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); - // } } // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); @@ -11488,44 +11442,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP UUID requestID = UUID.Zero; byte source = (byte)SourceType.Asset; - if ((transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) - || (transferRequest.TransferInfo.SourceType == 2222)) + if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) { requestID = new UUID(transferRequest.TransferInfo.Params, 0); } - else if ((transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) - || (transferRequest.TransferInfo.SourceType == 3333)) + else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) { requestID = new UUID(transferRequest.TransferInfo.Params, 80); source = (byte)SourceType.SimInventoryItem; //m_log.Debug("asset request " + requestID); } - if (null == asset) - { - if ((m_hyperAssets != null) && (transferRequest.TransferInfo.SourceType < 2000)) - { - // 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 == (int)SourceType.Asset) - transferRequest.TransferInfo.SourceType = 2222; // marker - else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) - 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); - - // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right. - return; - } - // Scripts cannot be retrieved by direct request if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset && asset.Type == 10) return; -- cgit v1.1 From b84f72df0b7b3917e917a36546c911cb1953b30b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 4 Jul 2010 14:59:15 -0700 Subject: Got rid of all hyperassets references. Also fixed accessing textures in user's inventory in foreign grids. --- OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs | 17 ++++++++++------- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 -- OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs | 5 +---- 3 files changed, 11 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index f6ad6e1..e9e2dca 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public IJ2KDecoder J2KDecoder; public IAssetService AssetService; public UUID AgentID; - public IHyperAssetService HyperAssets; + public IInventoryAccessModule InventoryAccessModule; public OpenJPEG.J2KLayerInfo[] Layers; public bool IsDecoded; public bool HasAsset; @@ -375,15 +375,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP UUID assetID = UUID.Zero; if (asset != null) assetID = asset.FullID; - else if ((HyperAssets != null) && (sender != HyperAssets)) + else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule)) { - // 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())) + // Unfortunately we need this here, there's no other way. + // This is due to the fact that textures opened directly from the agent's inventory + // don't have any distinguishing feature. As such, in order to serve those when the + // foreign user is visiting, we need to try again after the first fail to the local + // asset service. + string assetServerURL = string.Empty; + if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL)) { m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id); - AssetService.Get(userAssets + "/" + id, HyperAssets, AssetReceived); + AssetService.Get(assetServerURL + "/" + id, InventoryAccessModule, AssetReceived); return; } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3a2c019..247c2b2 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -357,7 +357,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected uint m_agentFOVCounter; protected IAssetService m_assetService; - private IHyperAssetService m_hyperAssets; private const bool m_checkPackets = true; private Timer m_propertiesPacketTimer; @@ -432,7 +431,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // m_attachmentsSent = new HashSet(); 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 = Util.StringToBytes256(scene.GetSimulatorVersion()); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index 938cf50..9e0db12 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs @@ -58,8 +58,6 @@ 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; } } @@ -75,7 +73,6 @@ 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(); } /// @@ -149,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP imgrequest.J2KDecoder = m_j2kDecodeModule; imgrequest.AssetService = m_assetCache; imgrequest.AgentID = m_client.AgentId; - imgrequest.HyperAssets = m_hyperAssets; + imgrequest.InventoryAccessModule = m_client.Scene.RequestModuleInterface(); imgrequest.DiscardLevel = newRequest.DiscardLevel; imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber); imgrequest.Priority = newRequest.Priority; -- cgit v1.1 From 657056a73fe123e7c56d1703ac2b20f231dd1d66 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Jul 2010 08:48:02 -0700 Subject: Fixes mantis #4845 --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 247c2b2..540fccc 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -11435,6 +11435,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// protected void AssetReceived(string id, Object sender, AssetBase asset) { + if (asset == null) + return; + TransferRequestPacket transferRequest = (TransferRequestPacket)sender; UUID requestID = UUID.Zero; -- cgit v1.1