From c75d4156487b35aac47aa6818144862a99bb841c Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 27 Oct 2009 00:26:56 -0700 Subject: * Converts ClientManager.ForEach() (and as a result, Scene.ForEachClient()) to use a non-blocking parallel method when operating in async mode * Minor code readability cleanup --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 8 +++++--- OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 5 ++--- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 31028b3..f6a7a0c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2105,12 +2105,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks) { ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect); - packet.Effect = effectBlocks; + packet.Header.Reliable = false; + packet.Header.Zerocoded = true; packet.AgentData.AgentID = AgentId; packet.AgentData.SessionID = SessionId; - packet.Header.Reliable = false; - packet.Header.Zerocoded = true; + + packet.Effect = effectBlocks; + OutPacket(packet, ThrottleOutPacketType.State); } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index a823f3b..84a4959 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -372,7 +372,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OpenSim.Framework.LocklessQueue queue = m_packetOutboxes[category]; TokenBucket bucket = m_throttleCategories[category]; - if (m_throttleCategories[category].RemoveTokens(packet.Buffer.DataLength)) + if (bucket.RemoveTokens(packet.Buffer.DataLength)) { // Enough tokens were removed from the bucket, the packet will not be queued return false; diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index cfe32d0..1a91f0c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -394,7 +394,7 @@ namespace OpenSim.Region.Framework.Scenes void ProcessViewerEffect(IClientAPI remoteClient, List args) { // TODO: don't create new blocks if recycling an old packet - List effectBlock = new List(); + ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count]; for (int i = 0; i < args.Count; i++) { ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock(); @@ -404,9 +404,8 @@ namespace OpenSim.Region.Framework.Scenes effect.ID = args[i].ID; effect.Type = args[i].Type; effect.TypeData = args[i].TypeData; - effectBlock.Add(effect); + effectBlockArray[i] = effect; } - ViewerEffectPacket.EffectBlock[] effectBlockArray = effectBlock.ToArray(); ForEachClient( delegate(IClientAPI client) -- cgit v1.1