From 41b8e2de9ed57fee4b1cd318696ed444913ef2bf Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 23 Jun 2009 22:11:34 +0000 Subject: Also fix group role membership packet sizes to stay safely below MTU --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 70 +++++++++++++--------- 1 file changed, 41 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/ClientStack/LindenUDP') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7a263b1..cda4d49 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -8658,6 +8658,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP List members = m_GroupsModule.GroupMembersRequest(this, groupMembersRequestPacket.GroupData.GroupID); + int memberCount = members.Count; + while (true) { int blockCount = members.Count; @@ -8679,7 +8681,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP groupMembersRequestPacket.GroupData.GroupID; groupMembersReply.GroupData.RequestID = groupMembersRequestPacket.GroupData.RequestID; - groupMembersReply.GroupData.MemberCount = members.Count; + groupMembersReply.GroupData.MemberCount = memberCount; for (int i = 0 ; i < blockCount ; i++) { @@ -8790,40 +8792,50 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_GroupsModule != null) { - GroupRoleMembersReplyPacket groupRoleMembersReply = (GroupRoleMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleMembersReply); - groupRoleMembersReply.AgentData = - new GroupRoleMembersReplyPacket.AgentDataBlock(); - groupRoleMembersReply.AgentData.AgentID = - AgentId; - groupRoleMembersReply.AgentData.GroupID = - groupRoleMembersRequest.GroupData.GroupID; - groupRoleMembersReply.AgentData.RequestID = - groupRoleMembersRequest.GroupData.RequestID; - List mappings = - m_GroupsModule.GroupRoleMembersRequest(this, - groupRoleMembersRequest.GroupData.GroupID); - - groupRoleMembersReply.AgentData.TotalPairs = - (uint)mappings.Count; + m_GroupsModule.GroupRoleMembersRequest(this, + groupRoleMembersRequest.GroupData.GroupID); - groupRoleMembersReply.MemberData = - new GroupRoleMembersReplyPacket.MemberDataBlock[mappings.Count]; + int mappingsCount = mappings.Count; - int i = 0; - foreach (GroupRoleMembersData d in mappings) + while (mappings.Count > 0) { - groupRoleMembersReply.MemberData[i] = - new GroupRoleMembersReplyPacket.MemberDataBlock(); + int pairs = mappings.Count; + if (pairs > 32) + pairs = 32; + + GroupRoleMembersReplyPacket groupRoleMembersReply = (GroupRoleMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupRoleMembersReply); + groupRoleMembersReply.AgentData = + new GroupRoleMembersReplyPacket.AgentDataBlock(); + groupRoleMembersReply.AgentData.AgentID = + AgentId; + groupRoleMembersReply.AgentData.GroupID = + groupRoleMembersRequest.GroupData.GroupID; + groupRoleMembersReply.AgentData.RequestID = + groupRoleMembersRequest.GroupData.RequestID; + + groupRoleMembersReply.AgentData.TotalPairs = + (uint)mappingsCount; + + groupRoleMembersReply.MemberData = + new GroupRoleMembersReplyPacket.MemberDataBlock[pairs]; + + for (int i = 0 ; i < pairs ; i++) + { + GroupRoleMembersData d = mappings[0]; + mappings.RemoveAt(0); - groupRoleMembersReply.MemberData[i].RoleID = - d.RoleID; - groupRoleMembersReply.MemberData[i].MemberID = - d.MemberID; - i++; - } + groupRoleMembersReply.MemberData[i] = + new GroupRoleMembersReplyPacket.MemberDataBlock(); - OutPacket(groupRoleMembersReply, ThrottleOutPacketType.Task); + groupRoleMembersReply.MemberData[i].RoleID = + d.RoleID; + groupRoleMembersReply.MemberData[i].MemberID = + d.MemberID; + } + + OutPacket(groupRoleMembersReply, ThrottleOutPacketType.Task); + } } break; -- cgit v1.1