Also fix group role membership packet sizes to stay safely below MTU

0.6.6-post-fixes
Melanie Thielker 2009-06-23 22:11:34 +00:00
parent 8cf16f6ea4
commit 41b8e2de9e
1 changed files with 41 additions and 29 deletions

View File

@ -8658,6 +8658,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
List<GroupMembersData> members = List<GroupMembersData> members =
m_GroupsModule.GroupMembersRequest(this, groupMembersRequestPacket.GroupData.GroupID); m_GroupsModule.GroupMembersRequest(this, groupMembersRequestPacket.GroupData.GroupID);
int memberCount = members.Count;
while (true) while (true)
{ {
int blockCount = members.Count; int blockCount = members.Count;
@ -8679,7 +8681,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
groupMembersRequestPacket.GroupData.GroupID; groupMembersRequestPacket.GroupData.GroupID;
groupMembersReply.GroupData.RequestID = groupMembersReply.GroupData.RequestID =
groupMembersRequestPacket.GroupData.RequestID; groupMembersRequestPacket.GroupData.RequestID;
groupMembersReply.GroupData.MemberCount = members.Count; groupMembersReply.GroupData.MemberCount = memberCount;
for (int i = 0 ; i < blockCount ; i++) for (int i = 0 ; i < blockCount ; i++)
{ {
@ -8790,6 +8792,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_GroupsModule != null) if (m_GroupsModule != null)
{ {
List<GroupRoleMembersData> mappings =
m_GroupsModule.GroupRoleMembersRequest(this,
groupRoleMembersRequest.GroupData.GroupID);
int mappingsCount = mappings.Count;
while (mappings.Count > 0)
{
int pairs = mappings.Count;
if (pairs > 32)
pairs = 32;
GroupRoleMembersReplyPacket groupRoleMembersReply = (GroupRoleMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleMembersReply); GroupRoleMembersReplyPacket groupRoleMembersReply = (GroupRoleMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleMembersReply);
groupRoleMembersReply.AgentData = groupRoleMembersReply.AgentData =
new GroupRoleMembersReplyPacket.AgentDataBlock(); new GroupRoleMembersReplyPacket.AgentDataBlock();
@ -8800,19 +8814,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
groupRoleMembersReply.AgentData.RequestID = groupRoleMembersReply.AgentData.RequestID =
groupRoleMembersRequest.GroupData.RequestID; groupRoleMembersRequest.GroupData.RequestID;
List<GroupRoleMembersData> mappings =
m_GroupsModule.GroupRoleMembersRequest(this,
groupRoleMembersRequest.GroupData.GroupID);
groupRoleMembersReply.AgentData.TotalPairs = groupRoleMembersReply.AgentData.TotalPairs =
(uint)mappings.Count; (uint)mappingsCount;
groupRoleMembersReply.MemberData = groupRoleMembersReply.MemberData =
new GroupRoleMembersReplyPacket.MemberDataBlock[mappings.Count]; new GroupRoleMembersReplyPacket.MemberDataBlock[pairs];
int i = 0; for (int i = 0 ; i < pairs ; i++)
foreach (GroupRoleMembersData d in mappings)
{ {
GroupRoleMembersData d = mappings[0];
mappings.RemoveAt(0);
groupRoleMembersReply.MemberData[i] = groupRoleMembersReply.MemberData[i] =
new GroupRoleMembersReplyPacket.MemberDataBlock(); new GroupRoleMembersReplyPacket.MemberDataBlock();
@ -8820,11 +8832,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
d.RoleID; d.RoleID;
groupRoleMembersReply.MemberData[i].MemberID = groupRoleMembersReply.MemberData[i].MemberID =
d.MemberID; d.MemberID;
i++;
} }
OutPacket(groupRoleMembersReply, ThrottleOutPacketType.Task); OutPacket(groupRoleMembersReply, ThrottleOutPacketType.Task);
} }
}
break; break;
case PacketType.CreateGroupRequest: case PacketType.CreateGroupRequest: