From a6a136bd90735b5a15ebc91c8a2a310f7250ac94 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 20 Dec 2010 14:15:44 -0800 Subject: [PATCH 1/3] Shooting in the dark for solutions to the appearance problem --- OpenSim/Framework/Capabilities/Caps.cs | 12 ++++++------ .../Servers/HttpServer/BinaryStreamHandler.cs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 63e1e34b99..dbb07817f6 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -1344,6 +1344,12 @@ namespace OpenSim.Framework.Capabilities /// public string uploaderCaps(byte[] data, string path, string param) { + handlerUpLoad = OnUpLoad; + if (handlerUpLoad != null) + { + Util.FireAndForget(delegate(object o) { handlerUpLoad(newAssetID, data); }); + } + string res = String.Empty; LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); uploadComplete.new_asset = newAssetID.ToString(); @@ -1354,12 +1360,6 @@ namespace OpenSim.Framework.Capabilities httpListener.RemoveStreamHandler("POST", uploaderPath); - handlerUpLoad = OnUpLoad; - if (handlerUpLoad != null) - { - handlerUpLoad(newAssetID, data); - } - m_log.InfoFormat("[CAPS] baked texture upload completed for {0}",newAssetID); return res; diff --git a/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs index 86fa44dfea..bae4e1b997 100644 --- a/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BinaryStreamHandler.cs @@ -53,8 +53,8 @@ namespace OpenSim.Framework.Servers.HttpServer private static byte[] ReadFully(Stream stream) { - byte[] buffer = new byte[32768]; - using (MemoryStream ms = new MemoryStream()) + byte[] buffer = new byte[1024]; + using (MemoryStream ms = new MemoryStream(1024*256)) { while (true) { From 043dace1184b14c1b07863c2ffabaf5e24fb53c4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Dec 2010 20:47:00 +0000 Subject: [PATCH 2/3] Make prim inventories a bit more sane --- .../Framework/Interfaces/IEntityInventory.cs | 7 -- .../Framework/Scenes/Scene.Inventory.cs | 23 ++---- .../Scenes/SceneObjectGroup.Inventory.cs | 43 ----------- .../Scenes/SceneObjectPartInventory.cs | 74 +++++++++---------- 4 files changed, 39 insertions(+), 108 deletions(-) diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 64664ab033..15060fdd17 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -193,13 +193,6 @@ namespace OpenSim.Region.Framework.Interfaces /// in this prim's inventory. int RemoveInventoryItem(UUID itemID); - /// - /// Return the name with which a client can request a xfer of this prim's inventory metadata - /// - string GetInventoryFileName(); - - bool GetInventoryFileName(IClientAPI client, uint localID); - /// /// Serialize all the metadata for the items in this prim's inventory ready for sending to the client /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 2cf0ced61a..321d0aa1c5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -949,23 +949,12 @@ namespace OpenSim.Region.Framework.Scenes /// public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) { - SceneObjectGroup group = GetGroupByPrim(primLocalID); - if (group != null) - { - bool fileChange = group.GetPartInventoryFileName(remoteClient, primLocalID); - if (fileChange) - { - if (XferManager != null) - { - group.RequestInventoryFile(remoteClient, primLocalID, XferManager); - } - } - } - else - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: Inventory requested of prim {0} which doesn't exist", primLocalID); - } + SceneObjectPart part = GetSceneObjectPart(primLocalID); + if (part == null) + return; + + if (XferManager != null) + part.Inventory.RequestInventoryFile(remoteClient, XferManager); } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index a86223c9ba..982e280244 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -80,49 +80,6 @@ namespace OpenSim.Region.Framework.Scenes parts[i].Inventory.RemoveScriptInstances(sceneObjectBeingDeleted); } - /// - /// - /// - /// - /// - public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID) - { - SceneObjectPart part = GetChildPart(localID); - if (part != null) - { - return part.Inventory.GetInventoryFileName(remoteClient, localID); - } - else - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: " + - "Couldn't find part {0} in object group {1}, {2} to retreive prim inventory", - localID, Name, UUID); - } - return false; - } - - /// - /// Return serialized inventory metadata for the given constituent prim - /// - /// - /// - public void RequestInventoryFile(IClientAPI client, uint localID, IXfer xferManager) - { - SceneObjectPart part = GetChildPart(localID); - if (part != null) - { - part.Inventory.RequestInventoryFile(client, xferManager); - } - else - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: " + - "Couldn't find part {0} in object group {1}, {2} to request inventory data", - localID, Name, UUID); - } - } - /// /// Add an inventory item to a prim in this group. /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 6a204c3413..ac69f168c4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -46,6 +46,7 @@ namespace OpenSim.Region.Framework.Scenes private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private string m_inventoryFileName = String.Empty; + private byte[] m_inventoryFileData = new byte[0]; private int m_inventoryFileNameSerial = 0; /// @@ -765,39 +766,16 @@ namespace OpenSim.Region.Framework.Scenes return -1; } - public string GetInventoryFileName() + private bool CreateInventoryFileName() { - if (m_inventoryFileName == String.Empty) - m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; - if (m_inventoryFileNameSerial < m_inventorySerial) + if (m_inventoryFileName == String.Empty || + m_inventoryFileNameSerial < m_inventorySerial) { m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; - } - return m_inventoryFileName; - } - - /// - /// Return the name with which a client can request a xfer of this prim's inventory metadata - /// - /// - /// - public bool GetInventoryFileName(IClientAPI client, uint localID) - { -// m_log.DebugFormat( -// "[PRIM INVENTORY]: Received request from client {0} for inventory file name of {1}, {2}", -// client.AgentId, Name, UUID); - - if (m_inventorySerial > 0) - { - client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, - Utils.StringToBytes(GetInventoryFileName())); return true; } - else - { - client.SendTaskInventory(m_part.UUID, 0, new byte[0]); - return false; - } + + return false; } /// @@ -806,19 +784,34 @@ namespace OpenSim.Region.Framework.Scenes /// public void RequestInventoryFile(IClientAPI client, IXfer xferManager) { - byte[] fileData = new byte[0]; + bool changed = CreateInventoryFileName(); - // Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches - // what appears to happen in the Second Life protocol. If this isn't the case. then various functionality - // isn't available (such as drag from prim inventory to agent inventory) InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); - bool includeAssets = false; - if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) - includeAssets = true; - lock (m_items) { + if (m_inventorySerial == 0) // No inventory + { + client.SendTaskInventory(m_part.UUID, 0, new byte[0]); + return; + } + + client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, + Util.StringToBytes256(m_inventoryFileName)); + + if (!changed) + { + if (m_inventoryFileData.Length > 2) + { + xferManager.AddNewFile(m_inventoryFileName, + m_inventoryFileData); + } + } + + bool includeAssets = false; + if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) + includeAssets = true; + foreach (TaskInventoryItem item in m_items.Values) { UUID ownerID = item.OwnerID; @@ -868,14 +861,13 @@ namespace OpenSim.Region.Framework.Scenes } } - fileData = Utils.StringToBytes(invString.BuildString); + int count = m_items.Count; - //m_log.Debug(Utils.BytesToString(fileData)); - //m_log.Debug("[PRIM INVENTORY]: RequestInventoryFile fileData: " + Utils.BytesToString(fileData)); + m_inventoryFileData = Utils.StringToBytes(invString.BuildString); - if (fileData.Length > 2) + if (m_inventoryFileData.Length > 2) { - xferManager.AddNewFile(m_inventoryFileName, fileData); + xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); } } From a31b96e1ba755122220d4dd8e5e04d721910a2fc Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Dec 2010 20:54:28 +0000 Subject: [PATCH 3/3] Fix up merge artifacts --- .../Framework/Scenes/SceneObjectPartInventory.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index ac69f168c4..36c5fc12da 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -808,10 +808,6 @@ namespace OpenSim.Region.Framework.Scenes } } - bool includeAssets = false; - if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) - includeAssets = true; - foreach (TaskInventoryItem item in m_items.Values) { UUID ownerID = item.OwnerID; @@ -840,10 +836,7 @@ namespace OpenSim.Region.Framework.Scenes invString.AddNameValueLine("group_id", item.GroupID.ToString()); invString.AddSectionEnd(); - if (includeAssets) - invString.AddNameValueLine("asset_id", item.AssetID.ToString()); - else - invString.AddNameValueLine("asset_id", UUID.Zero.ToString()); + invString.AddNameValueLine("asset_id", item.AssetID.ToString()); invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); @@ -861,8 +854,6 @@ namespace OpenSim.Region.Framework.Scenes } } - int count = m_items.Count; - m_inventoryFileData = Utils.StringToBytes(invString.BuildString); if (m_inventoryFileData.Length > 2)