From 02a15bc787b2cc6784c9626e041a4365ec362194 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 4 Jul 2010 13:56:03 -0700 Subject: [PATCH 01/12] Started to clean up the mess with HyperAssets in LLClientView. Fixed HG access to Notecards in user's inventory. --- .../Region/ClientStack/LindenUDP/J2KImage.cs | 1 + .../ClientStack/LindenUDP/LLClientView.cs | 89 ++----------------- .../InventoryAccess/HGAssetMapper.cs | 2 + .../HGInventoryAccessModule.cs | 13 +++ .../InventoryAccess/InventoryAccessModule.cs | 52 +++++++++++ .../Interfaces/IInventoryAccessModule.cs | 2 + 6 files changed, 78 insertions(+), 81 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index 9869a99418..f6ad6e194c 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 d2824bd8c7..3a2c019af4 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; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index c1e92f59a2..b13b9d8fc5 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs @@ -157,6 +157,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess Dictionary ids = new Dictionary(); HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL); uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); + if (ids.ContainsKey(assetID)) + ids.Remove(assetID); foreach (UUID uuid in ids.Keys) FetchAsset(userAssetURL, uuid); diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index b0555daa3a..6fdd2a8e36 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -192,6 +192,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess m_assMapper.Post(item.AssetID, receiver, userAssetServer); } + + #endregion public bool IsForeignUser(UUID userID, out string assetServerURL) @@ -217,5 +219,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return false; } + + protected override InventoryItemBase GetItem(UUID agentID, UUID itemID) + { + InventoryItemBase item = base.GetItem(agentID, itemID); + + string userAssetServer = string.Empty; + if (IsForeignUser(agentID, out userAssetServer)) + m_assMapper.Get(item.AssetID, agentID, userAssetServer); + + return item; + } } } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 12b6aa0ba3..39616f77c6 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -639,6 +639,50 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { } + public virtual bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID) + { + InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID); + if (assetRequestItem == null) + { + ILibraryService lib = m_Scene.RequestModuleInterface(); + if (lib != null) + assetRequestItem = lib.LibraryRootFolder.FindItem(itemID); + if (assetRequestItem == null) + 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 (!m_Scene.Permissions.CanViewScript(itemID, UUID.Zero, remoteClient.AgentId)) + { + remoteClient.SendAgentAlertMessage("Insufficient permissions to view script", false); + return false; + } + } + else if (assetRequestItem.AssetType == (int)AssetType.Notecard) + { + if (!m_Scene.Permissions.CanViewNotecard(itemID, UUID.Zero, remoteClient.AgentId)) + { + remoteClient.SendAgentAlertMessage("Insufficient permissions to view notecard", false); + 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 false; + } + + return true; + } + #endregion #region Misc @@ -661,6 +705,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return asset; } + protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID) + { + IInventoryService invService = m_Scene.RequestModuleInterface(); + InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID); + assetRequestItem = invService.GetItem(assetRequestItem); + return assetRequestItem; + } + #endregion } } diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs index 97f4188751..2d4f509954 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs @@ -43,5 +43,7 @@ namespace OpenSim.Region.Framework.Interfaces UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver); + bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID); + //bool GetTextureFromAgentInventory(UUID agentID, UUID assetID); } } From b84f72df0b7b3917e917a36546c911cb1953b30b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 4 Jul 2010 14:59:15 -0700 Subject: [PATCH 02/12] Got rid of all hyperassets references. Also fixed accessing textures in user's inventory in foreign grids. --- .../Region/ClientStack/LindenUDP/J2KImage.cs | 17 +++++---- .../ClientStack/LindenUDP/LLClientView.cs | 2 - .../ClientStack/LindenUDP/LLImageManager.cs | 5 +-- .../HGInventoryAccessModule.cs | 8 ++-- .../InventoryAccess/InventoryAccessModule.cs | 7 ++++ .../Asset/HGAssetBroker.cs | 3 +- .../Framework/Interfaces/IHyperService.cs | 37 ------------------- .../Interfaces/IInventoryAccessModule.cs | 4 +- 8 files changed, 25 insertions(+), 58 deletions(-) delete mode 100644 OpenSim/Region/Framework/Interfaces/IHyperService.cs diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs index f6ad6e194c..e9e2dca34b 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 3a2c019af4..247c2b2873 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 938cf50468..9e0db12734 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; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 6fdd2a8e36..cd66af5b31 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -192,11 +192,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess m_assMapper.Post(item.AssetID, receiver, userAssetServer); } - - - #endregion - - public bool IsForeignUser(UUID userID, out string assetServerURL) + public override bool IsForeignUser(UUID userID, out string assetServerURL) { assetServerURL = string.Empty; UserAccount account = null; @@ -220,6 +216,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return false; } + #endregion + protected override InventoryItemBase GetItem(UUID agentID, UUID itemID) { InventoryItemBase item = base.GetItem(agentID, itemID); diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 39616f77c6..90b7b51f68 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -683,6 +683,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return true; } + + public virtual bool IsForeignUser(UUID userID, out string assetServerURL) + { + assetServerURL = string.Empty; + return false; + } + #endregion #region Misc diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index ebd6bbdcfa..034e69272e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs @@ -41,7 +41,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset { public class HGAssetBroker : - ISharedRegionModule, IAssetService, IHyperAssetService + ISharedRegionModule, IAssetService { private static readonly ILog m_log = LogManager.GetLogger( @@ -150,7 +150,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset m_aScene = scene; scene.RegisterModuleInterface(this); - scene.RegisterModuleInterface(this); } public void RemoveRegion(Scene scene) diff --git a/OpenSim/Region/Framework/Interfaces/IHyperService.cs b/OpenSim/Region/Framework/Interfaces/IHyperService.cs deleted file mode 100644 index 51ea28afc3..0000000000 --- a/OpenSim/Region/Framework/Interfaces/IHyperService.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using System; -using OpenMetaverse; - -namespace OpenSim.Region.Framework.Interfaces -{ - public interface IHyperAssetService - { - string GetUserAssetServer(UUID userID); - string GetSimAssetServer(); - } -} diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs index 2d4f509954..05fc2add3e 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs @@ -44,6 +44,8 @@ namespace OpenSim.Region.Framework.Interfaces bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver); bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID); - //bool GetTextureFromAgentInventory(UUID agentID, UUID assetID); + + // Must be here because of textures in user's inventory + bool IsForeignUser(UUID userID, out string assetServerURL); } } From c7e4880a5e45eccea527b8e1481e911dcd0602bf Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Jul 2010 03:36:26 -0700 Subject: [PATCH 03/12] One more buglet fixed related to mantis #4841 -- auto-returns were still chocking on a null pointer exception. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index bcb5f7c492..9ba13ae8b5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1597,7 +1597,7 @@ namespace OpenSim.Region.Framework.Scenes } // Handle god perms - if (Permissions.IsGod(remoteClient.AgentId)) + if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) { permissionToTake = true; permissionToTakeCopy = true; From 7525f3a556116e47f629e09b42dd4753185166e2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Jul 2010 04:19:53 -0700 Subject: [PATCH 04/12] Don't include hyperlinks as neighbors, even if grid operators have done the mistake of placing them as neighbors. This will not prevent further mess ups coming from that unsupported action. --- OpenSim/Services/GridService/GridService.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 225530f6ab..46d72dc458 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -278,7 +278,11 @@ namespace OpenSim.Services.GridService foreach (RegionData rdata in rdatas) if (rdata.RegionID != regionID) - rinfos.Add(RegionData2RegionInfo(rdata)); + { + int flags = Convert.ToInt32(rdata.Data["flags"]); + if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours + rinfos.Add(RegionData2RegionInfo(rdata)); + } } m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count); From debc780654dba27acdef0de384d0db4b586b02be Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Jul 2010 07:14:32 -0700 Subject: [PATCH 05/12] Fixes additional bug reported in mantis #4841. --- .../InventoryAccess/HGInventoryAccessModule.cs | 5 +++-- .../Inventory/HGInventoryBroker.cs | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index cd66af5b31..8ccc941c18 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return ret; } - // DO NOT OVERRIDE THIS METHOD + // DO NOT OVERRIDE THE BASE METHOD public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) { @@ -139,7 +139,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (!assetID.Equals(UUID.Zero)) { - UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); + if (remoteClient != null) + UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); } else m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index e09db154aa..4ec5253e58 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -202,9 +202,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } } - - // else put a null; it means that the methods should forward to local grid's inventory - m_InventoryURLs.Add(userID, null); } private void DropInventoryServiceURL(UUID userID) @@ -223,10 +220,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory if (m_InventoryURLs.ContainsKey(userID)) return m_InventoryURLs[userID]; - else - CacheInventoryServiceURL(userID); + CacheInventoryServiceURL(userID); - return m_InventoryURLs[userID]; + if (m_InventoryURLs.ContainsKey(userID)) + return m_InventoryURLs[userID]; + + return null; //it means that the methods should forward to local grid's inventory + } #endregion From cd19e6fe325198b1fbcdc41bb7169e0525729525 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Jul 2010 07:38:15 -0700 Subject: [PATCH 06/12] Fixes mantis #4842 --- bin/config-include/GridHypergrid.ini | 3 +++ bin/config-include/StandaloneHypergrid.ini | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini index 1adc2d8068..ab29018084 100644 --- a/bin/config-include/GridHypergrid.ini +++ b/bin/config-include/GridHypergrid.ini @@ -7,6 +7,9 @@ [Includes] Include-Common = "config-include/GridCommon.ini" +[Startup] + WorldMapModule = "HGWorldMap" + [Modules] AssetServices = "HGAssetBroker" InventoryServices = "HGInventoryBroker" diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini index 52e30e211c..e87270d7e8 100644 --- a/bin/config-include/StandaloneHypergrid.ini +++ b/bin/config-include/StandaloneHypergrid.ini @@ -3,7 +3,10 @@ ;; All optional settings are in StandaloneCommon.ini.example, ;; which you can copy and change. ;; - + +[Startup] + WorldMapModule = "HGWorldMap" + [Modules] AssetServices = "HGAssetBroker" InventoryServices = "HGInventoryBroker" From 657056a73fe123e7c56d1703ac2b20f231dd1d66 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Jul 2010 08:48:02 -0700 Subject: [PATCH 07/12] Fixes mantis #4845 --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 247c2b2873..540fccc489 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; From 07559707c59a78a2627fdf301dded39010287737 Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Tue, 6 Jul 2010 17:36:47 -0400 Subject: [PATCH 08/12] Fixes problem where "Adult" regions were reported as being of type "Unknown". --- OpenSim/Region/DataSnapshot/SnapshotStore.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/DataSnapshot/SnapshotStore.cs index 976c2c1d47..f356b436fc 100644 --- a/OpenSim/Region/DataSnapshot/SnapshotStore.cs +++ b/OpenSim/Region/DataSnapshot/SnapshotStore.cs @@ -258,21 +258,16 @@ namespace OpenSim.Region.DataSnapshot private String GetRegionCategory(Scene scene) { - //Boolean choice between: - // "PG" - Mormontown - // "Mature" - Sodom and Gomorrah if (scene.RegionInfo.RegionSettings.Maturity == 1) - { return "Mature"; - } - else if (scene.RegionInfo.RegionSettings.Maturity == 0) - { + + if (scene.RegionInfo.RegionSettings.Maturity == 2) + return "Adult"; + + if (scene.RegionInfo.RegionSettings.Maturity == 0) return "PG"; - } - else - { - return "Unknown"; - } + + return "Unknown"; } private XmlNode GetGridSnapshotData(XmlDocument factory) From 32cfdb0f6a3d48ce36c322dd0ccc942586f710be Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 7 Jul 2010 02:40:51 -0700 Subject: [PATCH 09/12] Switched order of conditionals. --- OpenSim/Region/DataSnapshot/SnapshotStore.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/DataSnapshot/SnapshotStore.cs index f356b436fc..70cb2053c9 100644 --- a/OpenSim/Region/DataSnapshot/SnapshotStore.cs +++ b/OpenSim/Region/DataSnapshot/SnapshotStore.cs @@ -258,15 +258,15 @@ namespace OpenSim.Region.DataSnapshot private String GetRegionCategory(Scene scene) { + if (scene.RegionInfo.RegionSettings.Maturity == 0) + return "PG"; + if (scene.RegionInfo.RegionSettings.Maturity == 1) return "Mature"; if (scene.RegionInfo.RegionSettings.Maturity == 2) return "Adult"; - if (scene.RegionInfo.RegionSettings.Maturity == 0) - return "PG"; - return "Unknown"; } From baebefeb05f3bfb3ab44a93490649e55c659e66d Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 8 Jul 2010 16:30:36 +0100 Subject: [PATCH 10/12] Handle a specific exception without spewing red ink. --- .../Servers/HttpServer/PollServiceWorkerThread.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index 1cc19c5719..b91496be2a 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs @@ -73,7 +73,18 @@ namespace OpenSim.Framework.Servers.HttpServer { if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) { - StreamReader str = new StreamReader(req.Request.Body); + StreamReader str; + try + { + str = new StreamReader(req.Request.Body); + } + catch (System.ArgumentException) + { + // Stream was not readable means a child agent + // was closed due to logout, leaving the + // Event Queue request orphaned. + continue; + } Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); m_server.DoHTTPGruntWork(responsedata, @@ -106,4 +117,4 @@ namespace OpenSim.Framework.Servers.HttpServer m_request.Enqueue(pPollServiceHttpRequest); } } -} \ No newline at end of file +} From 815dd73cf3642040b751300c397291b59eedf43d Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 8 Jul 2010 10:01:23 -0700 Subject: [PATCH 11/12] fix a potential division by zero --- OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 941c7619f6..bb5267c3dc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -259,10 +259,15 @@ namespace OpenSim.Region.ScriptEngine.Shared return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); } - public static Vector3 Norm(Vector3 vector) - { - double mag = Mag(vector); - return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag); + public static Vector3 Norm(Vector3 vector) + { + double mag = Mag(vector); + if (mag > 0.0) + { + double invMag = 1.0 / mag; + return vector * invMag; + } + return new Vector3(0, 0, 0); } #endregion From df9d4cd9b2cf97df6b8dc317868ae0eba1027b6b Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 8 Jul 2010 10:06:08 -0700 Subject: [PATCH 12/12] llVecNorm() now returns a zero-length vector when one is supplied as input. Addresses Mantis #4752 --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0a8d7cbe89..5941abd3fc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -450,13 +450,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llVecNorm(LSL_Vector v) { - m_host.AddScriptLPS(1); - double mag = LSL_Vector.Mag(v); - LSL_Vector nor = new LSL_Vector(); - nor.x = v.x / mag; - nor.y = v.y / mag; - nor.z = v.z / mag; - return nor; + m_host.AddScriptLPS(1); + return LSL_Vector.Norm(v); } public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b)