From 3a64522267352d1c68ef99ac76c65bd3c4f9eaf1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jan 2012 21:40:15 +0000 Subject: Minor formatting changes and commented out log lines for future debugging of image manager (udp texture fetch). No significant functional changes. --- OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 24 +++++--- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- .../ClientStack/Linden/UDP/LLImageManager.cs | 72 ++++++++++++++++++---- 3 files changed, 76 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index cb9692a..185a909 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs @@ -102,7 +102,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_currentPacket = 2; } - + while (sendMore && packetsSent < packetsToSend && m_currentPacket <= m_stopPacket) { sendMore = SendPacket(client); @@ -114,17 +114,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP return (m_currentPacket > m_stopPacket); } + /// + /// This is where we decide what we need to update + /// and assign the real discardLevel and packetNumber + /// assuming of course that the connected client might be bonkers + /// public void RunUpdate() { - //This is where we decide what we need to update - //and assign the real discardLevel and packetNumber - //assuming of course that the connected client might be bonkers - if (!HasAsset) { if (!m_assetRequested) { m_assetRequested = true; +// m_log.DebugFormat("[J2KIMAGE]: Requesting asset {0}", TextureID); AssetService.Get(TextureID.ToString(), this, AssetReceived); } } @@ -137,6 +139,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP { //Request decode m_decodeRequested = true; + +// m_log.DebugFormat("[J2KIMAGE]: Requesting decode of asset {0}", TextureID); + // Do we have a jpeg decoder? if (J2KDecoder != null) { @@ -149,7 +154,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send it off to the jpeg decoder J2KDecoder.BeginDecode(TextureID, m_asset, J2KDecodedCallback); } - } else { @@ -328,14 +332,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (m_currentPacket == 0) return 0; + if (m_currentPacket == 1) return FIRST_PACKET_SIZE; int result = FIRST_PACKET_SIZE + ((int)m_currentPacket - 2) * IMAGE_PACKET_SIZE; + if (result < 0) - { result = FIRST_PACKET_SIZE; - } + return result; } @@ -374,7 +379,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP { UUID assetID = UUID.Zero; if (asset != null) + { assetID = asset.FullID; + } else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule)) { // Unfortunately we need this here, there's no other way. @@ -395,7 +402,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } AssetDataCallback(assetID, asset); - } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index fe28ba3..eb1a50e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -577,7 +577,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Add a handler for the given packet type. /// /// - /// The packet is handled on its own thread. If packets must be handled in the order in which thye + /// The packet is handled on its own thread. If packets must be handled in the order in which they /// are received then please use the synchronous version of this method. /// /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index e3a881f..3e31b7d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs @@ -84,7 +84,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void EnqueueReq(TextureRequestArgs newRequest) { - //Make sure we're not shutting down.. if (!m_shuttingdown) { J2KImage imgrequest; @@ -99,19 +98,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP { //m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID); - try + try { lock (m_syncRoot) - m_priorityQueue.Delete(imgrequest.PriorityQueueHandle); + m_priorityQueue.Delete(imgrequest.PriorityQueueHandle); } catch (Exception) { } } else { +// m_log.DebugFormat( +// "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}", +// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); + //m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); - //Check the packet sequence to make sure this isn't older than + //Check the packet sequence to make sure this isn't older than //one we've already received if (newRequest.requestSequence > imgrequest.LastSequence) { @@ -126,11 +129,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP //Update the requested priority imgrequest.Priority = newRequest.Priority; + UpdateImageInQueue(imgrequest); - //Run an update imgrequest.RunUpdate(); + +// J2KImage imgrequest2 = new J2KImage(this); +// imgrequest2.J2KDecoder = m_j2kDecodeModule; +// imgrequest2.AssetService = m_assetCache; +// imgrequest2.AgentID = m_client.AgentId; +// imgrequest2.InventoryAccessModule = m_client.Scene.RequestModuleInterface(); +// imgrequest2.DiscardLevel = newRequest.DiscardLevel; +// imgrequest2.StartPacket = Math.Max(1, newRequest.PacketNumber); +// imgrequest2.Priority = newRequest.Priority; +// imgrequest2.TextureID = newRequest.RequestedAssetID; +// imgrequest2.Priority = newRequest.Priority; +// +// //Add this download to the priority queue +// AddImageToQueue(imgrequest2); +// +// imgrequest2.RunUpdate(); + } +// else +// { +// m_log.DebugFormat( +// "[LL IMAGE MANAGER]: Ignoring duplicate of existing request for {0} (sequence {1}) from {2} as its request sequence {3} is not greater", +// newRequest.RequestedAssetID, imgrequest.LastSequence, m_client.Name, newRequest.requestSequence); +// } } } else @@ -142,6 +168,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { +// m_log.DebugFormat( +// "[LL IMAGE MANAGER]: Received request for {0}, start packet {1} from {2}", +// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); + //m_log.DebugFormat("[TEX]: (NEW) ID={0}: D={1}, S={2}, P={3}", // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); @@ -159,7 +189,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP //Add this download to the priority queue AddImageToQueue(imgrequest); - //Run an update imgrequest.RunUpdate(); } } @@ -176,7 +205,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If null was returned, the texture priority queue is currently empty if (image == null) - return false; + break; if (image.IsDecoded) { @@ -194,10 +223,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP // written. Undecoded textures should not be going into the priority // queue, because a high priority undecoded texture will clog up the // pipeline for a client - return true; +// m_log.DebugFormat( +// "[LL IMAGE MANAGER]: Exiting image queue processing early on encountering undecoded image {0}", +// image.TextureID); + + break; } } +// if (packetsSent != 0) +// m_log.DebugFormat("[LL IMAGE MANAGER]: Processed {0} packets from image queue", packetsSent); + return m_priorityQueue.Count > 0; } @@ -219,7 +255,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (m_priorityQueue.Count > 0) { - try { image = m_priorityQueue.FindMax(); } + try + { + image = m_priorityQueue.FindMax(); + } catch (Exception) { } } } @@ -232,7 +271,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP lock (m_syncRoot) { - try { m_priorityQueue.Add(ref image.PriorityQueueHandle, image); } + try + { + m_priorityQueue.Add(ref image.PriorityQueueHandle, image); + } catch (Exception) { } } } @@ -241,7 +283,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP { lock (m_syncRoot) { - try { m_priorityQueue.Delete(image.PriorityQueueHandle); } + try + { + m_priorityQueue.Delete(image.PriorityQueueHandle); + } catch (Exception) { } } } @@ -250,7 +295,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP { lock (m_syncRoot) { - try { m_priorityQueue.Replace(image.PriorityQueueHandle, image); } + try + { + m_priorityQueue.Replace(image.PriorityQueueHandle, image); + } catch (Exception) { image.PriorityQueueHandle = null; -- cgit v1.1 From c201b54b8524033310c59fe353616e84616a542e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jan 2012 19:40:54 +0000 Subject: Improve "app rebake" command to return a better message if no uploaded texture ids were available for the rebake request --- OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index 3e31b7d..b53f0af 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs @@ -107,9 +107,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { -// m_log.DebugFormat( -// "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}", -// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); + m_log.DebugFormat( + "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}", + newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); //m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); @@ -168,9 +168,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { -// m_log.DebugFormat( -// "[LL IMAGE MANAGER]: Received request for {0}, start packet {1} from {2}", -// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); + m_log.DebugFormat( + "[LL IMAGE MANAGER]: Received request for {0}, start packet {1} from {2}", + newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); //m_log.DebugFormat("[TEX]: (NEW) ID={0}: D={1}, S={2}, P={3}", // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); -- cgit v1.1 From 50e459d265ab2a25d41afee82e475a530f0cfd5a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jan 2012 19:44:06 +0000 Subject: recomment log messages I accidentally left uncommented --- OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index b53f0af..3e31b7d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs @@ -107,9 +107,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - m_log.DebugFormat( - "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}", - newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); +// m_log.DebugFormat( +// "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}", +// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); //m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); @@ -168,9 +168,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - m_log.DebugFormat( - "[LL IMAGE MANAGER]: Received request for {0}, start packet {1} from {2}", - newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); +// m_log.DebugFormat( +// "[LL IMAGE MANAGER]: Received request for {0}, start packet {1} from {2}", +// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); //m_log.DebugFormat("[TEX]: (NEW) ID={0}: D={1}, S={2}, P={3}", // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); -- cgit v1.1 From 7661a0b2a913a7637cb8ba8310be370594901485 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 6 Jan 2012 20:20:11 +0000 Subject: Implement the FetchInventory2 capability. This accompanies the existing FetchInventoryDescendents2 capability. Not yet enabled by default. You can enable this by setting Cap_FetchInventory2 = "localhost" in the [ClientStack.LindenCaps] section of OpenSim.ini Enabling both FetchInventory2 and FetchInventoryDescendents2 improves the situation with properly fetching attachments and hud objects Probably because viewers are never expecting the odd situation where FetchInventoryDescendents2 is present but not FetchInventory2 However, for some reason attachments and hud objects occasionally fail to appear, though their status is correct in inventory For attachments, focussing on the avatar makes them appear. Hud objects have to be reattached. --- .../Linden/Caps/FetchInventory2Module.cs | 151 +++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs new file mode 100644 index 0000000..14501c7 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs @@ -0,0 +1,151 @@ +/* + * 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 System.Collections; +using System.Reflection; +using log4net; +using Nini.Config; +using Mono.Addins; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; +using Caps = OpenSim.Framework.Capabilities.Caps; +using OpenSim.Capabilities.Handlers; + +namespace OpenSim.Region.ClientStack.Linden +{ + /// + /// This module implements both WebFetchInventoryDescendents and FetchInventoryDescendents2 capabilities. + /// + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class FetchInventory2Module : INonSharedRegionModule + { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public bool Enabled { get; private set; } + + private Scene m_scene; + + private IInventoryService m_inventoryService; + + private string m_fetchInventory2Url; + + private FetchInventory2Handler m_fetchHandler; + + #region ISharedRegionModule Members + + public void Initialise(IConfigSource source) + { + IConfig config = source.Configs["ClientStack.LindenCaps"]; + if (config == null) + return; + + m_fetchInventory2Url = config.GetString("Cap_FetchInventory2", string.Empty); + + if (m_fetchInventory2Url != string.Empty) + Enabled = true; + } + + public void AddRegion(Scene s) + { + if (!Enabled) + return; + + m_scene = s; + } + + public void RemoveRegion(Scene s) + { + if (!Enabled) + return; + + m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + m_scene = null; + } + + public void RegionLoaded(Scene s) + { + if (!Enabled) + return; + + m_inventoryService = m_scene.InventoryService; + + // We'll reuse the same handler for all requests. + if (m_fetchInventory2Url == "localhost") + m_fetchHandler = new FetchInventory2Handler(m_inventoryService); + + m_scene.EventManager.OnRegisterCaps += RegisterCaps; + } + + public void PostInitialise() {} + + public void Close() {} + + public string Name { get { return "FetchInventory2Module"; } } + + public Type ReplaceableInterface + { + get { return null; } + } + + #endregion + + private void RegisterCaps(UUID agentID, Caps caps) + { + RegisterFetchCap(agentID, caps, "FetchInventory2", m_fetchInventory2Url); + } + + private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url) + { + string capUrl; + + if (url == "localhost") + { + capUrl = "/CAPS/" + UUID.Random(); + + IRequestHandler reqHandler + = new RestStreamHandler("POST", capUrl, m_fetchHandler.FetchInventoryRequest); + + caps.RegisterHandler(capName, reqHandler); + } + else + { + capUrl = url; + + caps.RegisterHandler(capName, capUrl); + } + +// m_log.DebugFormat( +// "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}", +// capName, capUrl, m_scene.RegionInfo.RegionName, agentID); + } + } +} -- cgit v1.1 From ef074deb52de617743ad50ea29e286dd9c66722d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 10 Jan 2012 21:30:12 +0000 Subject: Add "show image queue " region console command This is so that we can inspect the image download queue (texture download via udp) for debugging purposes. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 +++++++++----- OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs | 10 ++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index eb1a50e..1e72aa2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -304,6 +304,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected static Dictionary PacketHandlers = new Dictionary(); //Global/static handlers for all clients + /// + /// Handles UDP texture download. + /// + public LLImageManager ImageManager { get; private set; } + private readonly LLUDPServer m_udpServer; private readonly LLUDPClient m_udpClient; private readonly UUID m_sessionId; @@ -348,7 +353,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected Dictionary m_packetHandlers = new Dictionary(); protected Dictionary m_genericPacketHandlers = new Dictionary(); //PauPaw:Local Generic Message handlers protected Scene m_scene; - private LLImageManager m_imageManager; protected string m_firstName; protected string m_lastName; protected Thread m_clientThread; @@ -459,7 +463,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_assetService = m_scene.RequestModuleInterface(); m_GroupsModule = scene.RequestModuleInterface(); - m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface()); + ImageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface()); m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion()); m_agentId = agentId; m_sessionId = sessionId; @@ -499,7 +503,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IsActive = false; // Shutdown the image manager - m_imageManager.Close(); + ImageManager.Close(); // Fire the callback for this connection closing if (OnConnectionClosed != null) @@ -3939,7 +3943,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0) - m_imageManager.ProcessImageQueue(m_udpServer.TextureSendLimit); + ImageManager.ProcessImageQueue(m_udpServer.TextureSendLimit); } public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) @@ -7470,7 +7474,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if ((ImageType)block.Type == ImageType.Baked) args.Priority *= 2.0f; - m_imageManager.EnqueueReq(args); + ImageManager.EnqueueReq(args); } return true; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index 3e31b7d..db428f1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs @@ -245,6 +245,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_shuttingdown = true; } + /// + /// Returns an array containing all the images in the queue. + /// + /// + public J2KImage[] GetImages() + { + lock (m_priorityQueue) + return m_priorityQueue.ToArray(); + } + #region Priority Queue Helpers private J2KImage GetHighestPriorityImage() -- cgit v1.1 From 82ad9d4e04867b23b4c824c4eca7402bf476f0b7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 16 Jan 2012 22:58:58 +0000 Subject: Remove monocov and other obsolete nant build targets. monocov was a code coverage attempt 3 years ago which no longer works. other removed targets have been commented out or unused for a very long time --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1e72aa2..2553b3a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -762,9 +762,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(handshake, ThrottleOutPacketType.Task); } - /// - /// - /// public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) { AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); @@ -3480,6 +3477,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) { + m_log.DebugFormat( + "[LLCLIENTVIEW]: Sending avatar appearance for {0} with {1} bytes to {2} {3}", + agentID, textureEntry.Length, Name, AgentId); + AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); // TODO: don't create new blocks if recycling an old packet avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; @@ -3501,7 +3502,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) { - //m_log.DebugFormat("[CLIENT]: Sending animations to {0}", Name); +// m_log.DebugFormat("[LLCLIENTVIEW]: Sending animations for {0} to {1}", sourceAgentId, Name); AvatarAnimationPacket ani = (AvatarAnimationPacket)PacketPool.Instance.GetPacket(PacketType.AvatarAnimation); // TODO: don't create new blocks if recycling an old packet @@ -3536,6 +3537,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void SendAvatarDataImmediate(ISceneEntity avatar) { + m_log.DebugFormat( + "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}", + avatar.Name, avatar.UUID, Name, AgentId); + ScenePresence presence = avatar as ScenePresence; if (presence == null) return; @@ -3545,7 +3550,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP objupdate.RegionData.RegionHandle = presence.RegionHandle; objupdate.RegionData.TimeDilation = ushort.MaxValue; - + objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence); -- cgit v1.1 From 59a0c50d48100527d00ea87935fdc24055249ba5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 16 Jan 2012 23:04:08 +0000 Subject: Comment out noisy log lines I accidentally included in the nant build target adjustment commit. Left in the method doc. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2553b3a..4ba441e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3477,9 +3477,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) { - m_log.DebugFormat( - "[LLCLIENTVIEW]: Sending avatar appearance for {0} with {1} bytes to {2} {3}", - agentID, textureEntry.Length, Name, AgentId); +// m_log.DebugFormat( +// "[LLCLIENTVIEW]: Sending avatar appearance for {0} with {1} bytes to {2} {3}", +// agentID, textureEntry.Length, Name, AgentId); AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); // TODO: don't create new blocks if recycling an old packet @@ -3537,9 +3537,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void SendAvatarDataImmediate(ISceneEntity avatar) { - m_log.DebugFormat( - "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}", - avatar.Name, avatar.UUID, Name, AgentId); +// m_log.DebugFormat( +// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}", +// avatar.Name, avatar.UUID, Name, AgentId); ScenePresence presence = avatar as ScenePresence; if (presence == null) -- cgit v1.1 From 9356963bd36e5c3b8c2b27bfcc2efa60ffbd02d6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 19 Jan 2012 19:00:11 +0000 Subject: Add basic request and send image regression tests for LLImageManager --- OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 6 +- .../ClientStack/Linden/UDP/LLImageManager.cs | 6 +- .../Linden/UDP/Tests/LLImageManagerTests.cs | 92 +++++++++++++++++++++ .../Linden/UDP/Tests/Resources/4-tile2.jp2 | Bin 0 -> 24410 bytes 4 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs create mode 100644 OpenSim/Region/ClientStack/Linden/UDP/Tests/Resources/4-tile2.jp2 (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index 185a909..bbd2c43 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs @@ -82,7 +82,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Maximum number of packets to send during this call /// Number of packets sent during this call /// True if the transfer completes at the current discard level, otherwise false - public bool SendPackets(LLClientView client, int packetsToSend, out int packetsSent) + public bool SendPackets(IClientAPI client, int packetsToSend, out int packetsSent) { packetsSent = 0; @@ -212,7 +212,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - private bool SendFirstPacket(LLClientView client) + private bool SendFirstPacket(IClientAPI client) { if (client == null) return false; @@ -247,7 +247,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return false; } - private bool SendPacket(LLClientView client) + private bool SendPacket(IClientAPI client) { if (client == null) return false; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index db428f1..30d3712 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs @@ -55,16 +55,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private bool m_shuttingdown; private AssetBase m_missingImage; - private LLClientView m_client; //Client we're assigned to + private IClientAPI m_client; //Client we're assigned to private IAssetService m_assetCache; //Asset Cache private IJ2KDecoder m_j2kDecodeModule; //Our J2K module private C5.IntervalHeap m_priorityQueue = new C5.IntervalHeap(10, new J2KImageComparer()); private object m_syncRoot = new object(); - public LLClientView Client { get { return m_client; } } + public IClientAPI Client { get { return m_client; } } public AssetBase MissingImage { get { return m_missingImage; } } - public LLImageManager(LLClientView client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule) + public LLImageManager(IClientAPI client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule) { m_client = client; m_assetCache = pAssetCache; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs new file mode 100644 index 0000000..bdc9c7d --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs @@ -0,0 +1,92 @@ +/* + * 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 System.IO; +using System.Net; +using System.Reflection; +using log4net.Config; +using Nini.Config; +using NUnit.Framework; +using OpenMetaverse; +using OpenMetaverse.Packets; +using OpenSim.Framework; +using OpenSim.Region.CoreModules.Agent.TextureSender; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Region.ClientStack.LindenUDP.Tests +{ + [TestFixture] + public class LLImageManagerTests + { + [Test] + public void TestRequestAndSendImage() + { + TestHelpers.InMethod(); +// XmlConfigurator.Configure(); + + UUID imageId = TestHelpers.ParseTail(0x1); + string creatorId = TestHelpers.ParseTail(0x2).ToString(); + UUID userId = TestHelpers.ParseTail(0x3); + + J2KDecoderModule j2kdm = new J2KDecoderModule(); + + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, j2kdm); + + TestClient tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene); + LLImageManager llim = new LLImageManager(tc, scene.AssetService, j2kdm); + + using ( + Stream resource + = GetType().Assembly.GetManifestResourceStream( + "OpenSim.Region.ClientStack.LindenUDP.Tests.Resources.4-tile2.jp2")) + { + using (BinaryReader br = new BinaryReader(resource)) + { + AssetBase asset = new AssetBase(imageId, "Test Image", (sbyte)AssetType.Texture, creatorId); + asset.Data = br.ReadBytes(99999999); + scene.AssetService.Store(asset); + } + } + + TextureRequestArgs args = new TextureRequestArgs(); + args.RequestedAssetID = TestHelpers.ParseTail(0x1); + args.DiscardLevel = 0; + args.PacketNumber = 1; + args.Priority = 5; + args.requestSequence = 1; + + llim.EnqueueReq(args); + llim.ProcessImageQueue(20); + + Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1)); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/Resources/4-tile2.jp2 b/OpenSim/Region/ClientStack/Linden/UDP/Tests/Resources/4-tile2.jp2 new file mode 100644 index 0000000..8c63104 Binary files /dev/null and b/OpenSim/Region/ClientStack/Linden/UDP/Tests/Resources/4-tile2.jp2 differ -- cgit v1.1 From c92a9a664035ad4c36a0ac905751d105770dca51 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 19 Jan 2012 19:49:06 +0000 Subject: Add "image queues clear " console command This allows a way to manually clear pending image queue requests for debug purposes --- .../Region/ClientStack/Linden/UDP/LLImageManager.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index 30d3712..7bfb844 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs @@ -246,6 +246,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// + /// Clear the image queue. + /// + /// The number of requests cleared. + public int ClearImageQueue() + { + int requestsDeleted; + + lock (m_priorityQueue) + { + requestsDeleted = m_priorityQueue.Count; + + // Surprisingly, there doesn't seem to be a clear method at this time. + while (!m_priorityQueue.IsEmpty) + m_priorityQueue.DeleteMax(); + } + + return requestsDeleted; + } + + /// /// Returns an array containing all the images in the queue. /// /// -- cgit v1.1 From 381f74276b94f9f635b08c4bccf3040fce5d59fb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 19 Jan 2012 21:14:09 +0000 Subject: Add LLImageManager regression test for discard case --- .../Linden/UDP/Tests/LLImageManagerTests.cs | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs index bdc9c7d..118333c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs @@ -88,5 +88,58 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1)); } + + [Test] + public void TestRequestAndDiscardImage() + { + TestHelpers.InMethod(); +// XmlConfigurator.Configure(); + + UUID imageId = TestHelpers.ParseTail(0x1); + string creatorId = TestHelpers.ParseTail(0x2).ToString(); + UUID userId = TestHelpers.ParseTail(0x3); + + J2KDecoderModule j2kdm = new J2KDecoderModule(); + + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, j2kdm); + + TestClient tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene); + LLImageManager llim = new LLImageManager(tc, scene.AssetService, j2kdm); + + using ( + Stream resource + = GetType().Assembly.GetManifestResourceStream( + "OpenSim.Region.ClientStack.LindenUDP.Tests.Resources.4-tile2.jp2")) + { + using (BinaryReader br = new BinaryReader(resource)) + { + AssetBase asset = new AssetBase(imageId, "Test Image", (sbyte)AssetType.Texture, creatorId); + asset.Data = br.ReadBytes(99999999); + scene.AssetService.Store(asset); + } + } + + TextureRequestArgs args = new TextureRequestArgs(); + args.RequestedAssetID = imageId; + args.DiscardLevel = 0; + args.PacketNumber = 1; + args.Priority = 5; + args.requestSequence = 1; + llim.EnqueueReq(args); + + // Now create a discard request + TextureRequestArgs discardArgs = new TextureRequestArgs(); + discardArgs.RequestedAssetID = imageId; + discardArgs.DiscardLevel = -1; + discardArgs.PacketNumber = 1; + discardArgs.Priority = 0; + discardArgs.requestSequence = 2; + llim.EnqueueReq(discardArgs); + + llim.ProcessImageQueue(20); + + Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0)); + } } } \ No newline at end of file -- cgit v1.1 From 503faaea62502e1e86fc11bee1a322e060836f62 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 19 Jan 2012 21:23:40 +0000 Subject: refactor: separate out common parts of LLImageManagerTests --- .../Linden/UDP/Tests/LLImageManagerTests.cs | 88 ++++++++++------------ 1 file changed, 40 insertions(+), 48 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs index 118333c..f176964 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs @@ -45,24 +45,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests [TestFixture] public class LLImageManagerTests { - [Test] - public void TestRequestAndSendImage() - { - TestHelpers.InMethod(); -// XmlConfigurator.Configure(); - - UUID imageId = TestHelpers.ParseTail(0x1); - string creatorId = TestHelpers.ParseTail(0x2).ToString(); - UUID userId = TestHelpers.ParseTail(0x3); - - J2KDecoderModule j2kdm = new J2KDecoderModule(); - - Scene scene = SceneHelpers.SetupScene(); - SceneHelpers.SetupSceneModules(scene, j2kdm); - - TestClient tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene); - LLImageManager llim = new LLImageManager(tc, scene.AssetService, j2kdm); + private AssetBase m_testImageAsset; + private LLImageManager llim; + private TestClient tc; + [TestFixtureSetUp] + public void FixtureInit() + { using ( Stream resource = GetType().Assembly.GetManifestResourceStream( @@ -70,14 +59,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests { using (BinaryReader br = new BinaryReader(resource)) { - AssetBase asset = new AssetBase(imageId, "Test Image", (sbyte)AssetType.Texture, creatorId); - asset.Data = br.ReadBytes(99999999); - scene.AssetService.Store(asset); + m_testImageAsset + = new AssetBase( + TestHelpers.ParseTail(0x1), + "Test Image", + (sbyte)AssetType.Texture, + TestHelpers.ParseTail(0x2).ToString()); + + m_testImageAsset.Data = br.ReadBytes(99999999); } } + } + + [SetUp] + public void SetUp() + { + UUID userId = TestHelpers.ParseTail(0x3); + + J2KDecoderModule j2kdm = new J2KDecoderModule(); + + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, j2kdm); + + scene.AssetService.Store(m_testImageAsset); + + tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene); + llim = new LLImageManager(tc, scene.AssetService, j2kdm); + } + + [Test] + public void TestRequestAndSendImage() + { + TestHelpers.InMethod(); +// XmlConfigurator.Configure(); TextureRequestArgs args = new TextureRequestArgs(); - args.RequestedAssetID = TestHelpers.ParseTail(0x1); + args.RequestedAssetID = m_testImageAsset.FullID; args.DiscardLevel = 0; args.PacketNumber = 1; args.Priority = 5; @@ -95,33 +112,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests TestHelpers.InMethod(); // XmlConfigurator.Configure(); - UUID imageId = TestHelpers.ParseTail(0x1); - string creatorId = TestHelpers.ParseTail(0x2).ToString(); - UUID userId = TestHelpers.ParseTail(0x3); - - J2KDecoderModule j2kdm = new J2KDecoderModule(); - - Scene scene = SceneHelpers.SetupScene(); - SceneHelpers.SetupSceneModules(scene, j2kdm); - - TestClient tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene); - LLImageManager llim = new LLImageManager(tc, scene.AssetService, j2kdm); - - using ( - Stream resource - = GetType().Assembly.GetManifestResourceStream( - "OpenSim.Region.ClientStack.LindenUDP.Tests.Resources.4-tile2.jp2")) - { - using (BinaryReader br = new BinaryReader(resource)) - { - AssetBase asset = new AssetBase(imageId, "Test Image", (sbyte)AssetType.Texture, creatorId); - asset.Data = br.ReadBytes(99999999); - scene.AssetService.Store(asset); - } - } - TextureRequestArgs args = new TextureRequestArgs(); - args.RequestedAssetID = imageId; + args.RequestedAssetID = m_testImageAsset.FullID; args.DiscardLevel = 0; args.PacketNumber = 1; args.Priority = 5; @@ -130,7 +122,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests // Now create a discard request TextureRequestArgs discardArgs = new TextureRequestArgs(); - discardArgs.RequestedAssetID = imageId; + discardArgs.RequestedAssetID = m_testImageAsset.FullID; discardArgs.DiscardLevel = -1; discardArgs.PacketNumber = 1; discardArgs.Priority = 0; -- cgit v1.1 From d38e2c0c91b684d54974865d3ac2fb88c3354c21 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 19 Jan 2012 21:57:12 +0000 Subject: Add image not in database test for LLImageManager --- OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 3 ++ .../ClientStack/Linden/UDP/LLImageManager.cs | 29 +++++++++++++------ .../Linden/UDP/Tests/LLImageManagerTests.cs | 33 ++++++++++++++++++---- 3 files changed, 52 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index bbd2c43..8dd76d8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs @@ -377,6 +377,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void AssetReceived(string id, Object sender, AssetBase asset) { +// m_log.DebugFormat( +// "[J2KIMAGE]: Received asset {0} ({1} bytes)", id, asset != null ? asset.Data.Length.ToString() : "n/a"); + UUID assetID = UUID.Zero; if (asset != null) { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index 7bfb844..a48251f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs @@ -55,18 +55,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private bool m_shuttingdown; private AssetBase m_missingImage; - private IClientAPI m_client; //Client we're assigned to - private IAssetService m_assetCache; //Asset Cache - private IJ2KDecoder m_j2kDecodeModule; //Our J2K module + private IAssetService m_assetCache; + private IJ2KDecoder m_j2kDecodeModule; + + /// + /// Priority queue for determining which image to send first. + /// private C5.IntervalHeap m_priorityQueue = new C5.IntervalHeap(10, new J2KImageComparer()); + + /// + /// Used to control thread access to the priority queue. + /// private object m_syncRoot = new object(); - public IClientAPI Client { get { return m_client; } } + /// + /// Client served by this image manager + /// + public IClientAPI Client { get; private set; } + public AssetBase MissingImage { get { return m_missingImage; } } public LLImageManager(IClientAPI client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule) { - m_client = client; + Client = client; m_assetCache = pAssetCache; if (pAssetCache != null) @@ -90,7 +101,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Do a linear search for this texture download lock (m_syncRoot) + { m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest); + } if (imgrequest != null) { @@ -178,8 +191,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP imgrequest = new J2KImage(this); imgrequest.J2KDecoder = m_j2kDecodeModule; imgrequest.AssetService = m_assetCache; - imgrequest.AgentID = m_client.AgentId; - imgrequest.InventoryAccessModule = m_client.Scene.RequestModuleInterface(); + imgrequest.AgentID = Client.AgentId; + imgrequest.InventoryAccessModule = Client.Scene.RequestModuleInterface(); imgrequest.DiscardLevel = newRequest.DiscardLevel; imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber); imgrequest.Priority = newRequest.Priority; @@ -210,7 +223,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (image.IsDecoded) { int sent; - bool imageDone = image.SendPackets(m_client, packetsToSend - packetsSent, out sent); + bool imageDone = image.SendPackets(Client, packetsToSend - packetsSent, out sent); packetsSent += sent; // If the send is complete, destroy any knowledge of this transfer diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs index f176964..1b68d68 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs @@ -46,6 +46,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests public class LLImageManagerTests { private AssetBase m_testImageAsset; + private Scene scene; private LLImageManager llim; private TestClient tc; @@ -78,21 +79,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests J2KDecoderModule j2kdm = new J2KDecoderModule(); - Scene scene = SceneHelpers.SetupScene(); + scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, j2kdm); - scene.AssetService.Store(m_testImageAsset); - tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene); llim = new LLImageManager(tc, scene.AssetService, j2kdm); } [Test] - public void TestRequestAndSendImage() + public void TestSendImage() { TestHelpers.InMethod(); // XmlConfigurator.Configure(); + scene.AssetService.Store(m_testImageAsset); + TextureRequestArgs args = new TextureRequestArgs(); args.RequestedAssetID = m_testImageAsset.FullID; args.DiscardLevel = 0; @@ -107,11 +108,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests } [Test] - public void TestRequestAndDiscardImage() + public void TestDiscardImage() { TestHelpers.InMethod(); // XmlConfigurator.Configure(); + scene.AssetService.Store(m_testImageAsset); + TextureRequestArgs args = new TextureRequestArgs(); args.RequestedAssetID = m_testImageAsset.FullID; args.DiscardLevel = 0; @@ -133,5 +136,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0)); } + + [Test] + public void TestMissingImage() + { + TestHelpers.InMethod(); +// XmlConfigurator.Configure(); + + TextureRequestArgs args = new TextureRequestArgs(); + args.RequestedAssetID = m_testImageAsset.FullID; + args.DiscardLevel = 0; + args.PacketNumber = 1; + args.Priority = 5; + args.requestSequence = 1; + + llim.EnqueueReq(args); + llim.ProcessImageQueue(20); + + Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0)); + Assert.That(tc.SentImageNotInDatabasePackets.Count, Is.EqualTo(1)); + } } } \ No newline at end of file -- cgit v1.1 From ea72428c9d3fa27ab43bb3e0b2e297bf3b22861e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 19 Jan 2012 23:09:16 +0000 Subject: Allow a viewer UDP image request retry to trigger another asset fetch if an existing fetch hasn't responded before a timeout. This is to stop a high priority image/texture request from blocking the entire download queue if its asset fetch got dropped for some reason. --- OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 32 ++++++++++++++++++++-- .../ClientStack/Linden/UDP/LLImageManager.cs | 6 ++-- 2 files changed, 32 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index 8dd76d8..afbe56b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs @@ -45,6 +45,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP private const int IMAGE_PACKET_SIZE = 1000; private const int FIRST_PACKET_SIZE = 600; + /// + /// If we've requested an asset but not received it in this ticks timeframe, then allow a duplicate + /// request from the client to trigger a fresh asset request. + /// + /// + /// There are 10,000 ticks in a millisecond + /// + private const int ASSET_REQUEST_TIMEOUT = 100000000; + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public uint LastSequence; @@ -57,8 +66,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP public UUID AgentID; public IInventoryAccessModule InventoryAccessModule; private OpenJPEG.J2KLayerInfo[] m_layers; + + /// + /// Has this request decoded the asset data? + /// public bool IsDecoded { get; private set; } + + /// + /// Has this request received the required asset data? + /// public bool HasAsset { get; private set; } + + /// + /// Time in milliseconds at which the asset was requested. + /// + public long AssetRequestTime { get; private set; } + public C5.IPriorityQueueHandle PriorityQueueHandle; private uint m_currentPacket; @@ -123,10 +146,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (!HasAsset) { - if (!m_assetRequested) + if (!m_assetRequested || DateTime.UtcNow.Ticks > AssetRequestTime + ASSET_REQUEST_TIMEOUT) { +// m_log.DebugFormat( +// "[J2KIMAGE]: Requesting asset {0} from request in packet {1}, already requested? {2}, due to timeout? {3}", +// TextureID, LastSequence, m_assetRequested, DateTime.UtcNow.Ticks > AssetRequestTime + ASSET_REQUEST_TIMEOUT); + m_assetRequested = true; -// m_log.DebugFormat("[J2KIMAGE]: Requesting asset {0}", TextureID); + AssetRequestTime = DateTime.UtcNow.Ticks; + AssetService.Get(TextureID.ToString(), this, AssetReceived); } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index a48251f..073c357 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs @@ -101,9 +101,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Do a linear search for this texture download lock (m_syncRoot) - { m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest); - } if (imgrequest != null) { @@ -124,8 +122,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP // "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}", // newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); - //m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", - // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); +// m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", +// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); //Check the packet sequence to make sure this isn't older than //one we've already received -- cgit v1.1 From b6f3de5028ab9a288f60b020a0dffda079dc550d Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 20 Jan 2012 23:50:37 -0500 Subject: Telehub Support: Support for viewer side of telehub management. Can manupulate Telehubs and SpawnPoints from the viewer estate managemnt tools. This is a work in progress and does not yet persist or affect teleport routing. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 39 ++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4ba441e..a94fb20 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -219,6 +219,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event BakeTerrain OnBakeTerrain; public event RequestTerrain OnUploadTerrain; public event EstateChangeInfo OnEstateChangeInfo; + public event EstateManageTelehub OnEstateManageTelehub; public event EstateRestartSimRequest OnEstateRestartSimRequest; public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest; public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest; @@ -4482,6 +4483,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task); } + public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List SpawnPoint) + { + TelehubInfoPacket packet = (TelehubInfoPacket)PacketPool.Instance.GetPacket(PacketType.TelehubInfo); + packet.TelehubBlock.ObjectID = ObjectID; + packet.TelehubBlock.ObjectName = Utils.StringToBytes(ObjectName); + packet.TelehubBlock.TelehubPos = ObjectPos; + packet.TelehubBlock.TelehubRot = ObjectRot; + + packet.SpawnPointBlock = new TelehubInfoPacket.SpawnPointBlockBlock[SpawnPoint.Count]; + for (int n = 0; n < SpawnPoint.Count; n++) + { + packet.SpawnPointBlock[n] = new TelehubInfoPacket.SpawnPointBlockBlock{SpawnPointPos = SpawnPoint[n]}; + } + + OutPacket(packet, ThrottleOutPacketType.Task); + } + #endregion #region Land Data Sending Methods @@ -8920,7 +8938,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleEstateOwnerMessage(IClientAPI sender, Packet Pack) { EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; - //m_log.Debug(messagePacket.ToString()); + // m_log.InfoFormat("[LLCLIENTVIEW]: Packet: {0}", Utils.BytesToString(messagePacket.MethodData.Method)); GodLandStatRequest handlerLandStatRequest; #region Packet Session and User Check @@ -9219,6 +9237,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return true; + case "telehub": + if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) + { + UUID invoice = messagePacket.MethodData.Invoice; + UUID SenderID = messagePacket.AgentData.AgentID; + UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); + + string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter); + + EstateManageTelehub handlerEstateManageTelehub = OnEstateManageTelehub; + if (handlerEstateManageTelehub != null) + { + handlerEstateManageTelehub(this, invoice, SenderID, command, param1); + } + } + return true; + default: m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket); return true; @@ -9230,8 +9265,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP //lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts //lsrp.RequestData.RequestFlags; //lsrp.RequestData.Filter; - -// return true; } private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) -- cgit v1.1 From 32d58d6e3e9a0ea1bfa808567d0f64c0652f8a85 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 21 Jan 2012 23:26:27 -0500 Subject: Telehub Support: Telehub settings now persist to the database and are saved across sim restarts. So-far this only works on MySQL. this is a work in progress, teleport routing is not yet implemented. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a94fb20..29ad966 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -9242,10 +9242,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP { UUID invoice = messagePacket.MethodData.Invoice; UUID SenderID = messagePacket.AgentData.AgentID; - UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); + UInt32 param1 = 0u; string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter); + if (command != "info ui") + { + try + { + param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); + } + catch (Exception ex) + { + + } + } + EstateManageTelehub handlerEstateManageTelehub = OnEstateManageTelehub; if (handlerEstateManageTelehub != null) { -- cgit v1.1 From 5e445aaf7b134f51bfdb78a965e55395eca8bad9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 24 Jan 2012 22:09:13 +0000 Subject: Fix "Abnormal client thread terminations" stat in period CONNECTION STATISTICS to count the number of times clients are disconnected due to ack timeouts. This has been broken for a long period and would only ever show 0. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 5610c09..7b1aa2c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -492,6 +492,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if ((Environment.TickCount & Int32.MaxValue) - udpClient.TickLastPacketReceived > 1000 * 60) { m_log.Warn("[LLUDPSERVER]: Ack timeout, disconnecting " + udpClient.AgentID); + StatsManager.SimExtraStats.AddAbnormalClientThreadTermination(); RemoveClient(udpClient); return; -- cgit v1.1 From 7352aea9ac82c0c1a580ffd00d4436a8ea98f2b6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 28 Jan 2012 00:18:12 +0000 Subject: Remove IClientAPI from the money module. It was only used to pass in the agent id anyway --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 4 ++-- .../Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 2347cf2..7bc59fc 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -366,7 +366,7 @@ namespace OpenSim.Region.ClientStack.Linden if (mm != null) { - if (!mm.UploadCovered(client, mm.UploadCharge)) + if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) { if (client != null) client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); @@ -1018,4 +1018,4 @@ namespace OpenSim.Region.ClientStack.Linden fs.Close(); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs index b2f04f9..aed03b3 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs @@ -147,7 +147,7 @@ namespace OpenSim.Region.ClientStack.Linden { if (m_scene.TryGetClient(agentID, out client)) { - if (!mm.UploadCovered(client, mm.UploadCharge)) + if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) { if (client != null) client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); @@ -268,4 +268,4 @@ namespace OpenSim.Region.ClientStack.Linden } } -} \ No newline at end of file +} -- cgit v1.1 From e8b688b61f53e770ad2fbe3764f75e615e9b2bf8 Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Sun, 29 Jan 2012 20:15:43 +0100 Subject: Fix:Get embedded objects in notecard http://opensimulator.org/mantis/view.php?id=2607 Signed-off-by: nebadon --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 7bc59fc..cf0c28b 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -94,6 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden private static readonly string m_notecardUpdatePath = "0004/"; private static readonly string m_notecardTaskUpdatePath = "0005/"; // private static readonly string m_fetchInventoryPath = "0006/"; + private static readonly string m_copyFromNotecardPath = "0007/"; // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. @@ -180,6 +181,7 @@ namespace OpenSim.Region.ClientStack.Linden m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); + m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", new RestStreamHandler("POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard)); // As of RC 1.22.9 of the Linden client this is // supported @@ -723,6 +725,75 @@ namespace OpenSim.Region.ClientStack.Linden return LLSDHelpers.SerialiseLLSDReply(uploadResponse); } + + /// + /// Called by the CopyInventoryFromNotecard caps handler. + /// + /// + /// + /// + public string CopyInventoryFromNotecard(string request, string path, string param, + IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) + { + Hashtable response = new Hashtable(); + response["int_response_code"] = 404; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["str_response_string"] = ""; + + try + { + OSDMap content = (OSDMap)OSDParser.DeserializeLLSDXml(request); + UUID objectID = content["object-id"].AsUUID(); + UUID notecardID = content["notecard-id"].AsUUID(); + UUID folderID = content["folder-id"].AsUUID(); + UUID itemID = content["item-id"].AsUUID(); + + // m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, FolderID:{0}, ItemID:{1}, NotecardID:{2}, ObjectID:{3}", folderID, itemID, notecardID, objectID); + + if (objectID != UUID.Zero) + { + SceneObjectPart part = m_Scene.GetSceneObjectPart(objectID); + if (part != null) + { + TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(notecardID); + if (!m_Scene.Permissions.CanCopyObjectInventory(notecardID, objectID, m_HostCapsObj.AgentID)) + { + return LLSDHelpers.SerialiseLLSDReply(response); + } + } + } + + InventoryItemBase item = null; + InventoryItemBase copyItem = null; + IClientAPI client = null; + + m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); + item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID)); + if (item != null) + { + copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID); + if (copyItem != null && client != null) + { + m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder); + client.SendBulkUpdateInventory(copyItem); + } + } + else + { + m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID); + if (client != null) + client.SendAlertMessage("Failed to retrieve item"); + } + } + catch (Exception e) + { + m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard : {0}", e.ToString()); + } + + response["int_response_code"] = 200; + return LLSDHelpers.SerialiseLLSDReply(response); + } } public class AssetUploader -- cgit v1.1 From 2f84d5397bcce4c8de0c0cf70cb65307e9e37908 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Jan 2012 21:14:09 +0000 Subject: minor: remove mono compiler warning --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 29ad966..a7bf06d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -9252,9 +9252,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); } - catch (Exception ex) + catch { - } } -- cgit v1.1