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 ++-------------------- .../Framework/InventoryAccess/HGAssetMapper.cs | 2 + .../InventoryAccess/HGInventoryAccessModule.cs | 13 ++++ .../InventoryAccess/InventoryAccessModule.cs | 52 +++++++++++++ .../Framework/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 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; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index c1e92f5..b13b9d8 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 b0555da..6fdd2a8 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 12b6aa0..39616f7 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 97f4188..2d4f509 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); } } -- 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 ++++++---- .../Region/ClientStack/LindenUDP/LLClientView.cs | 2 -- .../Region/ClientStack/LindenUDP/LLImageManager.cs | 5 +-- .../InventoryAccess/HGInventoryAccessModule.cs | 8 ++--- .../InventoryAccess/InventoryAccessModule.cs | 7 ++++ .../ServiceConnectorsOut/Asset/HGAssetBroker.cs | 3 +- .../Region/Framework/Interfaces/IHyperService.cs | 37 ---------------------- .../Framework/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 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; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 6fdd2a8..cd66af5 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 39616f7..90b7b51 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 ebd6bbd..034e692 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 51ea28a..0000000 --- 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 2d4f509..05fc2ad 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); } } -- cgit v1.1 From c7e4880a5e45eccea527b8e1481e911dcd0602bf Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Jul 2010 03:36:26 -0700 Subject: 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 bcb5f7c..9ba13ae 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; -- cgit v1.1 From 7525f3a556116e47f629e09b42dd4753185166e2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Jul 2010 04:19:53 -0700 Subject: 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 225530f..46d72dc 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); -- cgit v1.1 From debc780654dba27acdef0de384d0db4b586b02be Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Jul 2010 07:14:32 -0700 Subject: Fixes additional bug reported in mantis #4841. --- .../Framework/InventoryAccess/HGInventoryAccessModule.cs | 5 +++-- .../ServiceConnectorsOut/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 cd66af5..8ccc941 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 e09db15..4ec5253 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); + + if (m_InventoryURLs.ContainsKey(userID)) + return m_InventoryURLs[userID]; - return m_InventoryURLs[userID]; + return null; //it means that the methods should forward to local grid's inventory + } #endregion -- cgit v1.1 From cd19e6fe325198b1fbcdc41bb7169e0525729525 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Jul 2010 07:38:15 -0700 Subject: 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 1adc2d8..ab29018 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 52e30e2..e87270d 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" -- 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(+) 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 From 07559707c59a78a2627fdf301dded39010287737 Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Tue, 6 Jul 2010 17:36:47 -0400 Subject: 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 976c2c1..f356b43 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) -- cgit v1.1 From 32cfdb0f6a3d48ce36c322dd0ccc942586f710be Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 7 Jul 2010 02:40:51 -0700 Subject: 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 f356b43..70cb205 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"; } -- cgit v1.1 From baebefeb05f3bfb3ab44a93490649e55c659e66d Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 8 Jul 2010 16:30:36 +0100 Subject: 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 1cc19c5..b91496b 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 +} -- cgit v1.1 From 815dd73cf3642040b751300c397291b59eedf43d Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 8 Jul 2010 10:01:23 -0700 Subject: 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 941c761..bb5267c 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 -- cgit v1.1 From df9d4cd9b2cf97df6b8dc317868ae0eba1027b6b Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 8 Jul 2010 10:06:08 -0700 Subject: llVecNorm() now returns a zero-length vector when one is supplied as input. Addresses Mantis #4752 --- OpenSim/Region/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 0a8d7cb..5941abd 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) -- cgit v1.1