Mantis#1970. Thank you kindly, HomerHorwitz for a patch that:

This patch improves fetching of inventory from several minutes 
to a few seconds.
0.6.0-stable
Charles Krinke 2008-08-16 19:37:30 +00:00
parent b6c6572ee1
commit 7a90385f1c
1 changed files with 9 additions and 20 deletions

View File

@ -1437,22 +1437,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (items.Count < MAX_ITEMS_PER_PACKET) if (items.Count < MAX_ITEMS_PER_PACKET)
{ {
descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count]; descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count];
descend.AgentData.Descendents = items.Count;
} }
else else
{ {
descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[MAX_ITEMS_PER_PACKET]; descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[MAX_ITEMS_PER_PACKET];
descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
} }
// Even if we aren't fetching the folders, we still need to include the folder count // Descendents must contain the *total* number of descendents (plus folders, whether we
// in the total number of descendents. Failure to do so will cause subtle bugs such // fetch them or not), not the number of entries we send in this packet. For consistency,
// as the failure of textures which haven't been expanded in inventory to show up // I'll use it for folder-requests, too, although I wasn't able to get one with
// in the texture prim edit selection panel. // FetchFolders = true.
if (!fetchFolders) // TODO this should be checked with FetchFolders = true
{ descend.AgentData.Descendents = items.Count + folders.Count;
descend.AgentData.Descendents += folders.Count;
}
int count = 0; int count = 0;
int i = 0; int i = 0;
@ -1506,13 +1502,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if ((items.Count - count) < MAX_ITEMS_PER_PACKET) if ((items.Count - count) < MAX_ITEMS_PER_PACKET)
{ {
descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count]; descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count];
descend.AgentData.Descendents = items.Count - count;
} }
else else
{ {
descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[MAX_ITEMS_PER_PACKET]; descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[MAX_ITEMS_PER_PACKET];
descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
} }
descend.AgentData.Descendents = items.Count + folders.Count;
i = 0; i = 0;
} }
} }
@ -1532,20 +1527,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (folders.Count < MAX_ITEMS_PER_PACKET) if (folders.Count < MAX_ITEMS_PER_PACKET)
{ {
descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count]; descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count];
descend.AgentData.Descendents = folders.Count;
} }
else else
{ {
descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET]; descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
} }
// Not sure if this scenario ever actually occurs, but nonetheless we include the items // Not sure if this scenario ever actually occurs, but nonetheless we include the items
// count even if we're not sending item data for the same reasons as above. // count even if we're not sending item data for the same reasons as above.
if (!fetchItems) descend.AgentData.Descendents = items.Count + folders.Count;
{
descend.AgentData.Descendents += items.Count;
}
int i = 0; int i = 0;
int count = 0; int count = 0;
@ -1570,14 +1560,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
descend.FolderData = descend.FolderData =
new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count]; new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count];
descend.AgentData.Descendents = folders.Count - count;
} }
else else
{ {
descend.FolderData = descend.FolderData =
new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET]; new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
} }
descend.AgentData.Descendents = items.Count + folders.Count;
i = 0; i = 0;
} }
} }