* Create a new ViewerEffectPacket for each viewer rather than reusing the packet structure

* This would have been a source of out_of_order messages for different sequences, which still appear to be happening
0.6.0-stable
Justin Clarke Casey 2008-10-15 14:41:12 +00:00
parent 227fd4eb11
commit 8ba8b0300a
1 changed files with 6 additions and 4 deletions

View File

@ -178,10 +178,9 @@ namespace OpenSim.Framework
}
public void ViewerEffectHandler(IClientAPI sender, List<ViewerEffectEventHandlerArg> args)
{
ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect);
{
// TODO: don't create new blocks if recycling an old packet
List<ViewerEffectPacket.EffectBlock> effectBlock = new List<ViewerEffectPacket.EffectBlock>();
List<ViewerEffectPacket.EffectBlock> effectBlock = new List<ViewerEffectPacket.EffectBlock>();
for (int i = 0; i < args.Count; i++)
{
ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock();
@ -193,7 +192,7 @@ namespace OpenSim.Framework
effect.TypeData = args[i].TypeData;
effectBlock.Add(effect);
}
packet.Effect = effectBlock.ToArray();
ViewerEffectPacket.EffectBlock[] effectBlockArray = effectBlock.ToArray();
IClientAPI[] LocalClients;
lock (m_clients)
@ -206,6 +205,9 @@ namespace OpenSim.Framework
{
if (LocalClients[i].AgentId != sender.AgentId)
{
ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect);
packet.Effect = effectBlockArray;
packet.AgentData.AgentID = LocalClients[i].AgentId;
packet.AgentData.SessionID = LocalClients[i].SessionId;
packet.Header.Reliable = false;