From 954329ec85a1c793a8050b28821f4349781ff445 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 21 Aug 2010 17:48:49 +0200 Subject: [PATCH 1/7] Don't allow oversized search reply packets --- .../ClientStack/LindenUDP/LLClientView.cs | 59 +++++++++++++------ 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 1d3bdf3ff7..4add1cae49 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2715,32 +2715,57 @@ namespace OpenSim.Region.ClientStack.LindenUDP packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1]; packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock(); - packet.QueryReplies = - new DirPlacesReplyPacket.QueryRepliesBlock[data.Length]; - - packet.StatusData = new DirPlacesReplyPacket.StatusDataBlock[ - data.Length]; - packet.AgentData.AgentID = AgentId; packet.QueryData[0].QueryID = queryID; + DirPlacesReplyPacket.QueryRepliesBlock[] replies = + new DirPlacesReplyPacket.QueryRepliesBlock[0]; + DirPlacesReplyPacket.StatusDataBlock[] status = + new DirPlacesReplyPacket.StatusDataBlock[0]; + int i = 0; foreach (DirPlacesReplyData d in data) { - packet.QueryReplies[i] = - new DirPlacesReplyPacket.QueryRepliesBlock(); - packet.StatusData[i] = new DirPlacesReplyPacket.StatusDataBlock(); - packet.QueryReplies[i].ParcelID = d.parcelID; - packet.QueryReplies[i].Name = Utils.StringToBytes(d.name); - packet.QueryReplies[i].ForSale = d.forSale; - packet.QueryReplies[i].Auction = d.auction; - packet.QueryReplies[i].Dwell = d.dwell; - packet.StatusData[i].Status = d.Status; - i++; + int idx = replies.Length; + Array.Resize(ref replies, idx + 1); + Array.Resize(ref status, idx + 1); + + replies[idx] = new DirPlacesReplyPacket.QueryRepliesBlock(); + status[idx] = new DirPlacesReplyPacket.StatusDataBlock(); + replies[idx].ParcelID = d.parcelID; + replies[idx].Name = Utils.StringToBytes(d.name); + replies[idx].ForSale = d.forSale; + replies[idx].Auction = d.auction; + replies[idx].Dwell = d.dwell; + status[idx].Status = d.Status; + + packet.QueryReplies = replies; + packet.StatusData = status; + + if (packet.Length >= 1000) + { + OutPacket(packet, ThrottleOutPacketType.Task); + + packet = (DirPlacesReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPlacesReply); + + packet.AgentData = new DirPlacesReplyPacket.AgentDataBlock(); + + packet.QueryData = new DirPlacesReplyPacket.QueryDataBlock[1]; + packet.QueryData[0] = new DirPlacesReplyPacket.QueryDataBlock(); + + packet.AgentData.AgentID = AgentId; + + packet.QueryData[0].QueryID = queryID; + + replies = new DirPlacesReplyPacket.QueryRepliesBlock[0]; + status = new DirPlacesReplyPacket.StatusDataBlock[0]; + + } } - OutPacket(packet, ThrottleOutPacketType.Task); + if (replies.Length > 0) + OutPacket(packet, ThrottleOutPacketType.Task); } public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data) From f445659dd3a0f4f5998a44b93991159a8beacbf1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 21 Aug 2010 17:38:47 +0100 Subject: [PATCH 2/7] Finally putting estate_settings.xml to rest. There will be no more attempts to read or write this file. --- OpenSim/Framework/RegionSettings.cs | 198 ---------------------------- 1 file changed, 198 deletions(-) diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index 8d1212bbbc..673cf203f8 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs @@ -33,8 +33,6 @@ namespace OpenSim.Framework { public class RegionSettings { - private ConfigurationMember configMember; - public delegate void SaveDelegate(RegionSettings rs); public event SaveDelegate OnSave; @@ -47,202 +45,6 @@ namespace OpenSim.Framework public static readonly UUID DEFAULT_TERRAIN_TEXTURE_3 = new UUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); public static readonly UUID DEFAULT_TERRAIN_TEXTURE_4 = new UUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); - public RegionSettings() - { - if (configMember == null) - { - try - { - configMember = new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", LoadConfigurationOptions, HandleIncomingConfiguration, true); - configMember.performConfigurationRetrieve(); - } - catch (Exception) - { - } - } - } - - public void LoadConfigurationOptions() - { - configMember.addConfigurationOption("region_flags", - ConfigurationOption.ConfigurationTypes.TYPE_UINT32, - String.Empty, "336723974", true); - - configMember.addConfigurationOption("max_agents", - ConfigurationOption.ConfigurationTypes.TYPE_INT32, - String.Empty, "40", true); - - configMember.addConfigurationOption("object_bonus_factor", - ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, - String.Empty, "1.0", true); - - configMember.addConfigurationOption("sim_access", - ConfigurationOption.ConfigurationTypes.TYPE_INT32, - String.Empty, "21", true); - - configMember.addConfigurationOption("terrain_base_0", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, DEFAULT_TERRAIN_TEXTURE_1.ToString(), true); - - configMember.addConfigurationOption("terrain_base_1", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, DEFAULT_TERRAIN_TEXTURE_2.ToString(), true); - - configMember.addConfigurationOption("terrain_base_2", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, DEFAULT_TERRAIN_TEXTURE_3.ToString(), true); - - configMember.addConfigurationOption("terrain_base_3", - ConfigurationOption.ConfigurationTypes.TYPE_UUID, - String.Empty, DEFAULT_TERRAIN_TEXTURE_4.ToString(), true); - - configMember.addConfigurationOption("terrain_start_height_0", - ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, - String.Empty, "10.0", true); - - configMember.addConfigurationOption("terrain_start_height_1", - ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, - String.Empty, "10.0", true); - - configMember.addConfigurationOption("terrain_start_height_2", - ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, - String.Empty, "10.0", true); - - configMember.addConfigurationOption("terrain_start_height_3", - ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, - String.Empty, "10.0", true); - - configMember.addConfigurationOption("terrain_height_range_0", - ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, - String.Empty, "60.0", true); - - configMember.addConfigurationOption("terrain_height_range_1", - ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, - String.Empty, "60.0", true); - - configMember.addConfigurationOption("terrain_height_range_2", - ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, - String.Empty, "60.0", true); - - configMember.addConfigurationOption("terrain_height_range_3", - ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, - String.Empty, "60.0", true); - - configMember.addConfigurationOption("region_water_height", - ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, - String.Empty, "20.0", true); - - configMember.addConfigurationOption("terrain_raise_limit", - ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, - String.Empty, "100.0", true); - - configMember.addConfigurationOption("terrain_lower_limit", - ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, - String.Empty, "-100.0", true); - - configMember.addConfigurationOption("sun_hour", - ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, - String.Empty, "0.0", true); - } - - public bool HandleIncomingConfiguration(string key, object value) - { - switch (key) - { - case "region_flags": - RegionFlags flags = (RegionFlags)(uint)value; - - m_BlockTerraform = - (flags & RegionFlags.BlockTerraform) != 0; - m_BlockFly = - (flags & RegionFlags.NoFly) != 0; - m_AllowDamage = - (flags & RegionFlags.AllowDamage) != 0; - m_RestrictPushing = - (flags & RegionFlags.RestrictPushObject) != 0; - m_AllowLandResell = - (flags & RegionFlags.BlockLandResell) == 0; - m_AllowLandJoinDivide = - (flags & RegionFlags.AllowParcelChanges) != 0; - m_BlockShowInSearch = - ((uint)flags & (1 << 29)) != 0; - m_DisableScripts = - (flags & RegionFlags.SkipScripts) != 0; - m_DisableCollisions = - (flags & RegionFlags.SkipCollisions) != 0; - m_DisablePhysics = - (flags & RegionFlags.SkipPhysics) != 0; - m_FixedSun = - (flags & RegionFlags.SunFixed) != 0; - m_Sandbox = - (flags & RegionFlags.Sandbox) != 0; - break; - case "max_agents": - m_AgentLimit = (int)value; - break; - case "object_bonus_factor": - m_ObjectBonus = (double)value; - break; - case "sim_access": - int access = (int)value; - if (access <= 13) - m_Maturity = 0; - else - m_Maturity = 1; - break; - case "terrain_base_0": - m_TerrainTexture1 = (UUID)value; - break; - case "terrain_base_1": - m_TerrainTexture2 = (UUID)value; - break; - case "terrain_base_2": - m_TerrainTexture3 = (UUID)value; - break; - case "terrain_base_3": - m_TerrainTexture4 = (UUID)value; - break; - case "terrain_start_height_0": - m_Elevation1SW = (double)value; - break; - case "terrain_start_height_1": - m_Elevation1NW = (double)value; - break; - case "terrain_start_height_2": - m_Elevation1SE = (double)value; - break; - case "terrain_start_height_3": - m_Elevation1NE = (double)value; - break; - case "terrain_height_range_0": - m_Elevation2SW = (double)value; - break; - case "terrain_height_range_1": - m_Elevation2NW = (double)value; - break; - case "terrain_height_range_2": - m_Elevation2SE = (double)value; - break; - case "terrain_height_range_3": - m_Elevation2NE = (double)value; - break; - case "region_water_height": - m_WaterHeight = (double)value; - break; - case "terrain_raise_limit": - m_TerrainRaiseLimit = (double)value; - break; - case "terrain_lower_limit": - m_TerrainLowerLimit = (double)value; - break; - case "sun_hour": - m_SunPosition = (double)value; - break; - } - - return true; - } - public void Save() { if (OnSave != null) From 8d8436e0cadfdfc03808e8ba4a4ebcad97414f68 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 21 Aug 2010 20:59:25 +0100 Subject: [PATCH 3/7] Correct a minor typo --- bin/OpenSim.ini.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 1ae9f9af7f..dac6477623 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -224,7 +224,7 @@ ;MapImageModule = "MapImageModule" ; Set to false to not generate any maptiles ;GenerateMaptiles = "true" - ; Refreah (in seconds) the map tile periodically + ; Refresh (in seconds) the map tile periodically ;MaptileRefresh = 0 ; If not generating maptiles, use this static texture asset ID ;MaptileStaticUUID = "00000000-0000-0000-0000-000000000000" From 74e5fe5aa94aa338c0e574553ccabd42a93b0bbd Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 23 Aug 2010 22:24:23 +0100 Subject: [PATCH 4/7] Remove various warnings and improve logging messages. No functional changes. --- .../ClientStack/LindenUDP/LLClientView.cs | 2 - .../InstantMessage/InstantMessageModule.cs | 2 +- .../InstantMessage/MessageTransferModule.cs | 16 ++++---- .../Transfer/InventoryTransferModule.cs | 17 ++++----- .../Inventory/BaseInventoryConnector.cs | 3 -- .../Inventory/InventoryCache.cs | 7 ++++ .../LocalInventoryServiceConnector.cs | 5 ++- .../RemoteInventoryServiceConnector.cs | 1 - .../Framework/Scenes/Scene.Inventory.cs | 6 ++- .../Region/ScriptEngine/XEngine/XEngine.cs | 2 +- .../Friends/FriendsServiceConnector.cs | 8 +--- .../Hypergrid/GatekeeperServiceConnector.cs | 4 +- .../Hypergrid/UserAgentServiceConnector.cs | 7 +--- .../SimianAvatarServiceConnector.cs | 4 +- .../SimianInventoryServiceConnector.cs | 28 +++++++------- .../SimianPresenceServiceConnector.cs | 38 +++++++++---------- .../InventoryService/XInventoryService.cs | 7 +++- 17 files changed, 78 insertions(+), 79 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 4add1cae49..db81fb9358 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2724,7 +2724,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP DirPlacesReplyPacket.StatusDataBlock[] status = new DirPlacesReplyPacket.StatusDataBlock[0]; - int i = 0; foreach (DirPlacesReplyData d in data) { int idx = replies.Length; @@ -2760,7 +2759,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP replies = new DirPlacesReplyPacket.QueryRepliesBlock[0]; status = new DirPlacesReplyPacket.StatusDataBlock[0]; - } } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index a3c40e0725..420e3ca402 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs @@ -198,4 +198,4 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage OnInstantMessage(null, msg); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index d025f0c0e3..730cc77896 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -132,20 +132,21 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { UUID toAgentID = new UUID(im.toAgentID); - m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM from {0} to {1}", im.fromAgentName, toAgentID.ToString()); - // Try root avatar only first foreach (Scene scene in m_Scenes) { if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) - { - m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName); - // Local message + { +// m_log.DebugFormat( +// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", +// toAgentID.ToString(), scene.RegionInfo.RegionName); + ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; if (!user.IsChildAgent) { - m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); + // Local message + m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); user.ControllingClient.SendInstantMessage(im); // Message sent @@ -167,7 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage // Local message ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; - m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); + m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); user.ControllingClient.SendInstantMessage(im); // Message sent @@ -176,6 +177,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } + m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); SendGridInstantMessageViaXMLRPC(im, result); return; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 8b77a5f4ee..4117e86f18 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -32,7 +32,6 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; - using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; @@ -92,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer m_TransferModule = m_Scenelist[0].RequestModuleInterface(); if (m_TransferModule == null) { - m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only"); + m_log.Error("[INVENTORY TRANSFER]: No Message transfer module found, transfers will be local only"); m_Enabled = false; m_Scenelist.Clear(); @@ -160,8 +159,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer private void OnInstantMessage(IClientAPI client, GridInstantMessage im) { - m_log.InfoFormat("[INVENTORY TRANSFER]: OnInstantMessage {0}", im.dialog); - + m_log.InfoFormat( + "[INVENTORY TRANSFER]: {0} IM type received from {1}", + (InstantMessageDialog)im.dialog, client.Name); + Scene scene = FindClientScene(client.AgentId); if (scene == null) // Something seriously wrong here. @@ -185,7 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { UUID folderID = new UUID(im.binaryBucket, 1); - m_log.DebugFormat("[AGENT INVENTORY]: Inserting original folder {0} "+ + m_log.DebugFormat("[INVENTORY TRANSFER]: Inserting original folder {0} "+ "into agent {1}'s inventory", folderID, new UUID(im.toAgentID)); @@ -221,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer UUID itemID = new UUID(im.binaryBucket, 1); - m_log.DebugFormat("[AGENT INVENTORY]: (giving) Inserting item {0} "+ + m_log.DebugFormat("[INVENTORY TRANSFER]: (giving) Inserting item {0} "+ "into agent {1}'s inventory", itemID, new UUID(im.toAgentID)); @@ -286,10 +287,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer // inventory is loaded. Courtesy of the above bulk update, // It will have been pushed to the client, too // - - //CachedUserInfo userInfo = - // scene.CommsManager.UserProfileCacheService. - // GetUserDetails(client.AgentId); IInventoryService invService = scene.InventoryService; InventoryFolderBase trashFolder = diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs index 1e51187900..dcf08e3d80 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs @@ -27,15 +27,12 @@ using System; using System.Collections.Generic; - using OpenMetaverse; using Nini.Config; using log4net; - using OpenSim.Framework; using OpenSim.Services.Interfaces; - namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { public abstract class BaseInventoryConnector : IInventoryService diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index c97ab9e8da..4e2f6024cc 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs @@ -161,6 +161,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) { + m_log.DebugFormat("[INVENTORY CACHE]: Getting folder for asset type {0} for user {1}", type, userID); + Dictionary folders = null; lock (m_InventoryCache) @@ -177,8 +179,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory if ((folders != null) && folders.ContainsKey(type)) { + m_log.DebugFormat( + "[INVENTORY CACHE]: Returning folder {0} as type {1} for {2}", folders[type], type, userID); + return folders[type]; } + + m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID); return null; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 22bd04cd65..3de6e5cb49 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -223,6 +223,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// true if the item was successfully added public bool AddItem(InventoryItemBase item) { + m_log.DebugFormat( + "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", + item.Name, item.Owner, item.Folder); + return m_InventoryService.AddItem(item); } @@ -236,7 +240,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_InventoryService.UpdateItem(item); } - public bool MoveItems(UUID ownerID, List items) { return m_InventoryService.MoveItems(ownerID, items); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index 153aeec1a4..17d80c7953 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -75,7 +75,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory base.Init(source); } - #region ISharedRegionModule public void Initialise(IConfigSource source) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 4d84018942..4e0ddcbbed 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -945,7 +945,6 @@ namespace OpenSim.Region.Framework.Scenes private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) { - Console.WriteLine("CreateAgentInventoryItemFromTask"); TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); if (null == taskItem) @@ -1016,7 +1015,10 @@ namespace OpenSim.Region.Framework.Scenes /// public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId) { - m_log.Info("Adding task inventory"); + m_log.DebugFormat( + "[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}", + itemId, part.Name, folderId, remoteClient.Name); + InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId); if (agentItem == null) diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index b0503499f2..8102acd457 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1294,7 +1294,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine { sdoc.LoadXml(xml); } - catch (System.Xml.XmlException e) + catch (System.Xml.XmlException) { loadedState = false; } diff --git a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs index d7a5731daa..36b5083860 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs @@ -156,8 +156,6 @@ namespace OpenSim.Services.Connectors sendData["METHOD"] = "storefriend"; - string reqString = ServerUtils.BuildQueryString(sendData); - string reply = string.Empty; try { @@ -199,8 +197,6 @@ namespace OpenSim.Services.Connectors sendData["FRIEND"] = Friend; sendData["METHOD"] = "deletefriend"; - string reqString = ServerUtils.BuildQueryString(sendData); - string reply = string.Empty; try { @@ -232,10 +228,8 @@ namespace OpenSim.Services.Connectors m_log.DebugFormat("[FRIENDS CONNECTOR]: DeleteFriend received null reply"); return false; - } #endregion - } -} +} \ No newline at end of file diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 291dd730de..024b42d433 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -31,11 +31,9 @@ using System.Collections.Generic; using System.Drawing; using System.Net; using System.Reflection; - using OpenSim.Framework; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; - using OpenMetaverse; using OpenMetaverse.Imaging; using OpenMetaverse.StructuredData; @@ -50,7 +48,7 @@ namespace OpenSim.Services.Connectors.Hypergrid { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013"); +// private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013"); private IAssetService m_AssetService; diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index c1e594947e..45019373cf 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -32,12 +32,10 @@ using System.IO; using System.Net; using System.Reflection; using System.Text; - using OpenSim.Framework; using OpenSim.Services.Interfaces; using OpenSim.Services.Connectors.Simulation; using GridRegion = OpenSim.Services.Interfaces.GridRegion; - using OpenMetaverse; using OpenMetaverse.StructuredData; using log4net; @@ -243,7 +241,7 @@ namespace OpenSim.Services.Connectors.Hypergrid { response = request.Send(m_ServerURL, 10000); } - catch (Exception e) + catch (Exception) { return null; } @@ -308,13 +306,12 @@ namespace OpenSim.Services.Connectors.Hypergrid } } - catch (Exception e) + catch (Exception) { return null; } return null; - } public bool AgentIsComingHome(UUID sessionID, string thisGridExternalName) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index a47f32cf7d..734bdd2e48 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -53,7 +53,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private static string ZeroID = UUID.Zero.ToString(); +// private static string ZeroID = UUID.Zero.ToString(); private string m_serverUrl = String.Empty; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 2b6d29c44d..89c1a5a445 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -69,7 +69,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private string m_userServerUrl = String.Empty; - private object m_gestureSyncRoot = new object(); +// private object m_gestureSyncRoot = new object(); #region ISharedRegionModule @@ -687,12 +687,12 @@ namespace OpenSim.Services.Connectors.SimianGrid for (int i = 0; i < items.Count; i++) itemIDs[i] = items[i].AsUUID().ToString(); - NameValueCollection requestArgs = new NameValueCollection - { - { "RequestMethod", "GetInventoryNodes" }, - { "OwnerID", userID.ToString() }, - { "Items", String.Join(",", itemIDs) } - }; +// NameValueCollection requestArgs = new NameValueCollection +// { +// { "RequestMethod", "GetInventoryNodes" }, +// { "OwnerID", userID.ToString() }, +// { "Items", String.Join(",", itemIDs) } +// }; // FIXME: Implement this in SimianGrid return new List(0); @@ -708,12 +708,12 @@ namespace OpenSim.Services.Connectors.SimianGrid /// the user's inventory public int GetAssetPermissions(UUID userID, UUID assetID) { - NameValueCollection requestArgs = new NameValueCollection - { - { "RequestMethod", "GetInventoryNodes" }, - { "OwnerID", userID.ToString() }, - { "AssetID", assetID.ToString() } - }; +// NameValueCollection requestArgs = new NameValueCollection +// { +// { "RequestMethod", "GetInventoryNodes" }, +// { "OwnerID", userID.ToString() }, +// { "AssetID", assetID.ToString() } +// }; // FIXME: Implement this in SimianGrid return (int)PermissionMask.All; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 6f179317d2..ca23e27347 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -349,24 +349,24 @@ namespace OpenSim.Services.Connectors.SimianGrid return null; } - private OSDMap GetSessionData(UUID sessionID) - { - m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID); - - NameValueCollection requestArgs = new NameValueCollection - { - { "RequestMethod", "GetSession" }, - { "SessionID", sessionID.ToString() } - }; - - OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); - if (response["Success"].AsBoolean()) - return response; - else - m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID); - - return null; - } +// private OSDMap GetSessionData(UUID sessionID) +// { +// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID); +// +// NameValueCollection requestArgs = new NameValueCollection +// { +// { "RequestMethod", "GetSession" }, +// { "SessionID", sessionID.ToString() } +// }; +// +// OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); +// if (response["Success"].AsBoolean()) +// return response; +// else +// m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID); +// +// return null; +// } private List GetSessions(UUID userID) { diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index f63ab1613e..90a5c225a0 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -157,6 +157,8 @@ namespace OpenSim.Services.InventoryService protected virtual XInventoryFolder[] GetSystemFolders(UUID principalID) { +// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting system folders for {0}", principalID); + XInventoryFolder[] allFolders = m_Database.GetFolders( new string[] { "agentID" }, new string[] { principalID.ToString() }); @@ -170,6 +172,9 @@ namespace OpenSim.Services.InventoryService return false; }); +// m_log.DebugFormat( +// "[XINVENTORY SERVICE]: Found {0} system folders for {1}", sysFolders.Length, principalID); + return sysFolders; } @@ -186,7 +191,7 @@ namespace OpenSim.Services.InventoryService foreach (XInventoryFolder x in allFolders) { - //m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to skeleton", x.folderName); + //m_log.DebugFormat("[XINVENTORY SERVICE]: Adding folder {0} to skeleton", x.folderName); folders.Add(ConvertToOpenSim(x)); } From 704a53fb9bfeb945fa25f7367c631698dea5ae89 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 23 Aug 2010 23:16:48 +0100 Subject: [PATCH 5/7] Fix bug in llGiveInventory() where items were disappearing on relog This was a regression - the code to look up the correct type folder was no longer being called if items were added without a parent folder set This may have been broken since commit bd49985a on 2010-05-02 --- .../LocalInventoryServiceConnector.cs | 22 ++++++++++++++----- .../RemoteXInventoryServiceConnector.cs | 5 +---- .../Shared/Api/Implementation/LSL_Api.cs | 6 ++--- .../Services/Interfaces/IInventoryService.cs | 7 ++++-- .../InventoryService/XInventoryService.cs | 14 +++++++++++- 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 3de6e5cb49..350ad66457 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -216,16 +216,28 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_InventoryService.PurgeFolder(folder); } - /// - /// Add a new item to the user's inventory - /// - /// - /// true if the item was successfully added public bool AddItem(InventoryItemBase item) { m_log.DebugFormat( "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", item.Name, item.Owner, item.Folder); + + if (UUID.Zero == item.Folder) + { + InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); + if (f != null) + { + item.Folder = f.ID; + } + else + { + f = m_InventoryService.GetRootFolder(item.Owner); + if (f != null) + item.Folder = f.ID; + else + return false; + } + } return m_InventoryService.AddItem(item); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index ada26cc359..34205e3df8 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -294,9 +294,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.GetAssetPermissions(userID, assetID); } - #endregion - - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b6eddb1255..dc43e453b8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3844,18 +3844,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (World.GetScenePresence(destId) != null) { // destination is an avatar - InventoryItemBase agentItem = - World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId); + InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId); if (agentItem == null) return; byte[] bucket = new byte[17]; bucket[0] = (byte)assetType; - byte[] objBytes = objId.GetBytes(); + byte[] objBytes = agentItem.ID.GetBytes(); Array.Copy(objBytes, 0, bucket, 1, 16); - Console.WriteLine("Giving inventory"); GridInstantMessage msg = new GridInstantMessage(World, m_host.UUID, m_host.Name+", an object owned by "+ resolveName(m_host.OwnerID)+",", destId, diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs index 1b78fb3912..d19faeddf7 100644 --- a/OpenSim/Services/Interfaces/IInventoryService.cs +++ b/OpenSim/Services/Interfaces/IInventoryService.cs @@ -141,8 +141,11 @@ namespace OpenSim.Services.Interfaces /// /// Add a new item to the user's inventory /// - /// - /// true if the item was successfully added + /// + /// The item to be added. If item.FolderID == UUID.Zero then the item is added to the most suitable system + /// folder. If there is no suitable folder then the item is added to the user's root inventory folder. + /// + /// true if the item was successfully added, false if it was not bool AddItem(InventoryItemBase item); /// diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 90a5c225a0..84306e7296 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -219,12 +219,21 @@ namespace OpenSim.Services.InventoryService public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) { +// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); + XInventoryFolder[] folders = m_Database.GetFolders( new string[] { "agentID", "type"}, new string[] { principalID.ToString(), ((int)type).ToString() }); if (folders.Length == 0) + { +// m_log.WarnFormat("[XINVENTORY SERVICE]: Found no folder for type {0} for user {1}", type, principalID); return null; + } + +// m_log.DebugFormat( +// "[XINVENTORY SERVICE]: Found folder {0} {1} for type {2} for user {3}", +// folders[0].folderName, folders[0].folderID, type, principalID); return ConvertToOpenSim(folders[0]); } @@ -235,7 +244,7 @@ namespace OpenSim.Services.InventoryService // connector. So we disregard the principal and look // by ID. // - m_log.DebugFormat("[XINVENTORY]: Fetch contents for folder {0}", folderID.ToString()); + m_log.DebugFormat("[XINVENTORY SERVICE]: Fetch contents for folder {0}", folderID.ToString()); InventoryCollection inventory = new InventoryCollection(); inventory.UserID = principalID; inventory.Folders = new List(); @@ -354,6 +363,9 @@ namespace OpenSim.Services.InventoryService public virtual bool AddItem(InventoryItemBase item) { +// m_log.DebugFormat( +// "[XINVENTORY SERVICE]: Adding item {0} to folder {1} for {2}", item.ID, item.Folder, item.Owner); + return m_Database.StoreItem(ConvertFromOpenSim(item)); } From 1d01c910951c09aa348e4fb407226fb3fcf35288 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 23 Aug 2010 23:21:44 +0100 Subject: [PATCH 6/7] minor: some doc for the MoveTaskInventoryItem method in Scene.Inventory.cs --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 4e0ddcbbed..241e100d00 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1084,7 +1084,11 @@ namespace OpenSim.Region.Framework.Scenes /// MoveTaskInventoryItem /// /// - /// + /// + /// The user inventory folder to move (or copy) the item to. If null, then the most + /// suitable system folder is used (e.g. the Objects folder for objects). If there is no suitable folder, then + /// the item is placed in the user's root inventory folder + /// /// /// public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId) From c72d298202699931fd67c981fa10b9280d02686f Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 23 Aug 2010 23:25:36 +0100 Subject: [PATCH 7/7] Add system lookup folder fix to the RemoveXInventoryServiceConnector as well since this presumably suffers from the same problem. --- .../RemoteXInventoryServiceConnector.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 34205e3df8..7ac3bb9f4e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -228,6 +228,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { if (item == null) return false; + + if (UUID.Zero == item.Folder) + { + InventoryFolderBase f = m_RemoteConnector.GetFolderForType(item.Owner, (AssetType)item.AssetType); + if (f != null) + { + item.Folder = f.ID; + } + else + { + f = m_RemoteConnector.GetRootFolder(item.Owner); + if (f != null) + item.Folder = f.ID; + else + return false; + } + } return m_RemoteConnector.AddItem(item); }