aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs44
1 files changed, 28 insertions, 16 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 9e695ea..823214a 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -918,6 +918,18 @@ namespace OpenSim.Region.ClientStack
918 List<InventoryFolderBase> folders, 918 List<InventoryFolderBase> folders,
919 bool fetchFolders, bool fetchItems) 919 bool fetchFolders, bool fetchItems)
920 { 920 {
921 // An inventory descendents packet consists of a single agent section and an inventory details
922 // section for each inventory item. The size of each inventory item is approximately 550 bytes.
923 // In theory, UDP has a maximum packet size of 64k, so it should be possible to send descendent
924 // packets containing metadata for in excess of 100 items. But in practice, there may be other
925 // factors (e.g. firewalls) restraining the maximum UDP packet size. See,
926 //
927 // http://opensimulator.org/mantis/view.php?id=226
928 //
929 // for one example of this kind of thing. So we'll go for a cautious max
930 // items of 20 which gives a packet size of about 11k
931 int MAX_ITEMS_PER_PACKET = 20;
932
921 Encoding enc = Encoding.ASCII; 933 Encoding enc = Encoding.ASCII;
922 uint FULL_MASK_PERMISSIONS = 2147483647; 934 uint FULL_MASK_PERMISSIONS = 2147483647;
923 935
@@ -925,15 +937,15 @@ namespace OpenSim.Region.ClientStack
925 { 937 {
926 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID); 938 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
927 939
928 if (items.Count < 40) 940 if (items.Count < MAX_ITEMS_PER_PACKET)
929 { 941 {
930 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count]; 942 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count];
931 descend.AgentData.Descendents = items.Count; 943 descend.AgentData.Descendents = items.Count;
932 } 944 }
933 else 945 else
934 { 946 {
935 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[40]; 947 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[MAX_ITEMS_PER_PACKET];
936 descend.AgentData.Descendents = 40; 948 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
937 } 949 }
938 950
939 // Even if we aren't fetching the folders, we still need to include the folder count 951 // Even if we aren't fetching the folders, we still need to include the folder count
@@ -979,29 +991,29 @@ namespace OpenSim.Region.ClientStack
979 991
980 i++; 992 i++;
981 count++; 993 count++;
982 if (i == 40) 994 if (i == MAX_ITEMS_PER_PACKET)
983 { 995 {
984 OutPacket(descend, ThrottleOutPacketType.Asset); 996 OutPacket(descend, ThrottleOutPacketType.Asset);
985 997
986 if ((items.Count - count) > 0) 998 if ((items.Count - count) > 0)
987 { 999 {
988 descend = CreateInventoryDescendentsPacket(ownerID, folderID); 1000 descend = CreateInventoryDescendentsPacket(ownerID, folderID);
989 if ((items.Count - count) < 40) 1001 if ((items.Count - count) < MAX_ITEMS_PER_PACKET)
990 { 1002 {
991 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count]; 1003 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count];
992 descend.AgentData.Descendents = items.Count - count; 1004 descend.AgentData.Descendents = items.Count - count;
993 } 1005 }
994 else 1006 else
995 { 1007 {
996 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[40]; 1008 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[MAX_ITEMS_PER_PACKET];
997 descend.AgentData.Descendents = 40; 1009 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
998 } 1010 }
999 i = 0; 1011 i = 0;
1000 } 1012 }
1001 } 1013 }
1002 } 1014 }
1003 1015
1004 if (i < 40) 1016 if (i < MAX_ITEMS_PER_PACKET)
1005 { 1017 {
1006 OutPacket(descend, ThrottleOutPacketType.Asset); 1018 OutPacket(descend, ThrottleOutPacketType.Asset);
1007 } 1019 }
@@ -1012,15 +1024,15 @@ namespace OpenSim.Region.ClientStack
1012 { 1024 {
1013 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID); 1025 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
1014 1026
1015 if (folders.Count < 40) 1027 if (folders.Count < MAX_ITEMS_PER_PACKET)
1016 { 1028 {
1017 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count]; 1029 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count];
1018 descend.AgentData.Descendents = folders.Count; 1030 descend.AgentData.Descendents = folders.Count;
1019 } 1031 }
1020 else 1032 else
1021 { 1033 {
1022 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[40]; 1034 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
1023 descend.AgentData.Descendents = 40; 1035 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
1024 } 1036 }
1025 1037
1026 // Not sure if this scenario ever actually occurs, but nonetheless we include the items 1038 // Not sure if this scenario ever actually occurs, but nonetheless we include the items
@@ -1042,29 +1054,29 @@ namespace OpenSim.Region.ClientStack
1042 1054
1043 i++; 1055 i++;
1044 count++; 1056 count++;
1045 if (i == 40) 1057 if (i == MAX_ITEMS_PER_PACKET)
1046 { 1058 {
1047 OutPacket(descend, ThrottleOutPacketType.Asset); 1059 OutPacket(descend, ThrottleOutPacketType.Asset);
1048 1060
1049 if ((folders.Count - count) > 0) 1061 if ((folders.Count - count) > 0)
1050 { 1062 {
1051 descend = CreateInventoryDescendentsPacket(ownerID, folderID); 1063 descend = CreateInventoryDescendentsPacket(ownerID, folderID);
1052 if ((folders.Count - count) < 40) 1064 if ((folders.Count - count) < MAX_ITEMS_PER_PACKET)
1053 { 1065 {
1054 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count]; 1066 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count];
1055 descend.AgentData.Descendents = folders.Count - count; 1067 descend.AgentData.Descendents = folders.Count - count;
1056 } 1068 }
1057 else 1069 else
1058 { 1070 {
1059 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[40]; 1071 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
1060 descend.AgentData.Descendents = 40; 1072 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
1061 } 1073 }
1062 i = 0; 1074 i = 0;
1063 } 1075 }
1064 } 1076 }
1065 } 1077 }
1066 1078
1067 if (i < 40) 1079 if (i < MAX_ITEMS_PER_PACKET)
1068 { 1080 {
1069 OutPacket(descend, ThrottleOutPacketType.Asset); 1081 OutPacket(descend, ThrottleOutPacketType.Asset);
1070 } 1082 }