Separate folder and item limit for UDP inventory packets. Folder limit is

now 6, as before, item limit is 5. This should avoid most, if not
all, oversized packets.
0.6.8-post-fixes
Melanie 2009-11-04 23:54:19 +00:00
parent a431f346e7
commit 30a2411e58
1 changed files with 5 additions and 4 deletions

View File

@ -1264,7 +1264,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// //
// for one example of this kind of thing. In fact, the Linden servers appear to only send about // for one example of this kind of thing. In fact, the Linden servers appear to only send about
// 6 to 7 items at a time, so let's stick with 6 // 6 to 7 items at a time, so let's stick with 6
int MAX_ITEMS_PER_PACKET = 6; int MAX_ITEMS_PER_PACKET = 5;
int MAX_FOLDERS_PER_PACKET = 6;
int totalItems = fetchItems ? items.Count : 0; int totalItems = fetchItems ? items.Count : 0;
int totalFolders = fetchFolders ? folders.Count : 0; int totalFolders = fetchFolders ? folders.Count : 0;
@ -1287,8 +1288,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (currentPacket == null) // Start a new packet if (currentPacket == null) // Start a new packet
{ {
foldersToSend = totalFolders - foldersSent; foldersToSend = totalFolders - foldersSent;
if (foldersToSend > MAX_ITEMS_PER_PACKET) if (foldersToSend > MAX_FOLDERS_PER_PACKET)
foldersToSend = MAX_ITEMS_PER_PACKET; foldersToSend = MAX_FOLDERS_PER_PACKET;
if (foldersToSend == 0) if (foldersToSend == 0)
{ {
@ -1301,7 +1302,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
if (foldersToSend-- > 0) if (foldersToSend-- > 0)
currentPacket.FolderData[foldersSent % MAX_ITEMS_PER_PACKET] = CreateFolderDataBlock(folders[foldersSent++]); currentPacket.FolderData[foldersSent % MAX_FOLDERS_PER_PACKET] = CreateFolderDataBlock(folders[foldersSent++]);
else if(itemsToSend-- > 0) else if(itemsToSend-- > 0)
currentPacket.ItemData[itemsSent % MAX_ITEMS_PER_PACKET] = CreateItemDataBlock(items[itemsSent++]); currentPacket.ItemData[itemsSent % MAX_ITEMS_PER_PACKET] = CreateItemDataBlock(items[itemsSent++]);
else else