From 4e9f50b878ae9d09e976ea7bc81f230ce9637cf4 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 9 Dec 2011 22:32:28 +0000
Subject: Add commented log lines to FetchInventoryDescendents2 path for future
use.
Haven't been able to resolve issue where attachments are removed by the viewer on relog on a localhost
---
.../Handlers/GetTexture/GetTextureHandler.cs | 12 ++-
.../WebFetchInvDescHandler.cs | 85 +++++++++++++++++++++-
.../Avatar/Attachments/AttachmentsModule.cs | 2 +
3 files changed, 95 insertions(+), 4 deletions(-)
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index ae95821..217217e 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -221,6 +221,7 @@ namespace OpenSim.Capabilities.Handlers
int start, end;
if (TryParseRange(range, out start, out end))
{
+
// Before clamping start make sure we can satisfy it in order to avoid
// sending back the last byte instead of an error status
if (start >= texture.Data.Length)
@@ -266,9 +267,14 @@ namespace OpenSim.Capabilities.Handlers
response.Body.Write(texture.Data, 0, texture.Data.Length);
}
-// m_log.DebugFormat(
-// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
-// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
+// if (response.StatusCode < 200 || response.StatusCode > 299)
+// m_log.WarnFormat(
+// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
+// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
+// else
+// m_log.DebugFormat(
+// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
+// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
}
private bool TryParseRange(string header, out int start, out int end)
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
index a086c0e..e91a4b8 100644
--- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
+++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
@@ -181,6 +181,15 @@ namespace OpenSim.Capabilities.Handlers
contents.descendents = contents.items.Array.Count + contents.categories.Array.Count;
contents.version = version;
+// m_log.DebugFormat(
+// "[WEB FETCH INV DESC HANDLER]: Replying to request for folder {0} (fetch items {1}, fetch folders {2}) with {3} items and {4} folders for agent {5}",
+// invFetch.folder_id,
+// invFetch.fetch_items,
+// invFetch.fetch_folders,
+// contents.items.Array.Count,
+// contents.categories.Array.Count,
+// invFetch.owner_id);
+
return reply;
}
@@ -195,7 +204,7 @@ namespace OpenSim.Capabilities.Handlers
///
///
/// An empty InventoryCollection if the inventory look up failed
- public InventoryCollection Fetch(
+ private InventoryCollection Fetch(
UUID agentID, UUID folderID, UUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder, out int version)
{
@@ -228,8 +237,82 @@ namespace OpenSim.Capabilities.Handlers
containingFolder.ID = folderID;
containingFolder.Owner = agentID;
containingFolder = m_InventoryService.GetFolder(containingFolder);
+
if (containingFolder != null)
+ {
version = containingFolder.Version;
+
+ if (fetchItems)
+ {
+ /*
+ List linkedItemsToAdd = new List();
+
+ foreach (InventoryItemBase item in contents.Items)
+ {
+ if (item.AssetType == (int)AssetType.Link)
+ {
+ InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
+
+ // Take care of genuinely broken links where the target doesn't exist
+ // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
+ // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
+ // rather than having to keep track of every folder requested in the recursion.
+ if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link && linkedItem.AssetType == (int)AssetType.Object)
+ linkedItemsToAdd.Add(linkedItem);
+ }
+ }
+
+ foreach (InventoryItemBase linkedItem in linkedItemsToAdd)
+ {
+ m_log.DebugFormat(
+ "[WEB FETCH INV DESC HANDLER]: Inserted linked item {0} for link in folder {1} for agent {2}",
+ linkedItem.Name, folderID, agentID);
+
+ contents.Items.Insert(0, linkedItem);
+ }
+ */
+
+ /*
+ // If the folder requested contains links, then we need to send those folders first, otherwise the links
+ // will be broken in the viewer.
+ HashSet linkedItemFolderIdsToSend = new HashSet();
+ foreach (InventoryItemBase item in contents.Items)
+ {
+ if (item.AssetType == (int)AssetType.Link)
+ {
+ InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
+
+ // Take care of genuinely broken links where the target doesn't exist
+ // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
+ // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
+ // rather than having to keep track of every folder requested in the recursion.
+ if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
+ {
+ // We don't need to send the folder if source and destination of the link are in the same
+ // folder.
+ if (linkedItem.Folder != containingFolder.ID)
+ linkedItemFolderIdsToSend.Add(linkedItem.Folder);
+ }
+ }
+ }
+
+ foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
+ {
+ m_log.DebugFormat(
+ "[WEB FETCH INV DESC HANDLER]: Recursively fetching folder {0} linked by item in folder {1} for agent {2}",
+ linkedItemFolderId, folderID, agentID);
+
+ int dummyVersion;
+ InventoryCollection linkedCollection
+ = Fetch(
+ agentID, linkedItemFolderId, ownerID, fetchFolders, fetchItems, sortOrder, out dummyVersion);
+
+ contents.Folders.AddRange(linkedCollection.Folders);
+ contents.Items.AddRange(linkedCollection.Items);
+ }
+ */
+ }
+ }
}
else
{
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 2349e40..280fdc7 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -113,6 +113,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return;
}
+// m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0}", sp.Name);
+
List attachments = sp.Appearance.GetAttachments();
foreach (AvatarAttachment attach in attachments)
{
--
cgit v1.1