aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-27 00:26:56 -0700
committerJohn Hurliman2009-10-27 00:26:56 -0700
commitc75d4156487b35aac47aa6818144862a99bb841c (patch)
treef00f7b485cb3a39477fa77dbd162c40ede533190
parentAdding missing CSJ2K reference to OpenSim.Region.Physics.Meshing (diff)
downloadopensim-SC-c75d4156487b35aac47aa6818144862a99bb841c.zip
opensim-SC-c75d4156487b35aac47aa6818144862a99bb841c.tar.gz
opensim-SC-c75d4156487b35aac47aa6818144862a99bb841c.tar.bz2
opensim-SC-c75d4156487b35aac47aa6818144862a99bb841c.tar.xz
* 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
-rw-r--r--OpenSim/Framework/ClientManager.cs5
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs8
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs5
4 files changed, 12 insertions, 8 deletions
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index 61b59e7..baff2f4 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -204,7 +204,10 @@ namespace OpenSim.Framework
204 public void ForEach(Action<IClientAPI> action) 204 public void ForEach(Action<IClientAPI> action)
205 { 205 {
206 IClientAPI[] localArray = m_array; 206 IClientAPI[] localArray = m_array;
207 Parallel.ForEach<IClientAPI>(localArray, action); 207 Parallel.For(0, localArray.Length,
208 delegate(int i)
209 { action(localArray[i]); }
210 );
208 } 211 }
209 212
210 /// <summary> 213 /// <summary>
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
2105 public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks) 2105 public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks)
2106 { 2106 {
2107 ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect); 2107 ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect);
2108 packet.Effect = effectBlocks; 2108 packet.Header.Reliable = false;
2109 packet.Header.Zerocoded = true;
2109 2110
2110 packet.AgentData.AgentID = AgentId; 2111 packet.AgentData.AgentID = AgentId;
2111 packet.AgentData.SessionID = SessionId; 2112 packet.AgentData.SessionID = SessionId;
2112 packet.Header.Reliable = false; 2113
2113 packet.Header.Zerocoded = true; 2114 packet.Effect = effectBlocks;
2115
2114 OutPacket(packet, ThrottleOutPacketType.State); 2116 OutPacket(packet, ThrottleOutPacketType.State);
2115 } 2117 }
2116 2118
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
372 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category]; 372 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
373 TokenBucket bucket = m_throttleCategories[category]; 373 TokenBucket bucket = m_throttleCategories[category];
374 374
375 if (m_throttleCategories[category].RemoveTokens(packet.Buffer.DataLength)) 375 if (bucket.RemoveTokens(packet.Buffer.DataLength))
376 { 376 {
377 // Enough tokens were removed from the bucket, the packet will not be queued 377 // Enough tokens were removed from the bucket, the packet will not be queued
378 return false; 378 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
394 void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args) 394 void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args)
395 { 395 {
396 // TODO: don't create new blocks if recycling an old packet 396 // TODO: don't create new blocks if recycling an old packet
397 List<ViewerEffectPacket.EffectBlock> effectBlock = new List<ViewerEffectPacket.EffectBlock>(); 397 ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count];
398 for (int i = 0; i < args.Count; i++) 398 for (int i = 0; i < args.Count; i++)
399 { 399 {
400 ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock(); 400 ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock();
@@ -404,9 +404,8 @@ namespace OpenSim.Region.Framework.Scenes
404 effect.ID = args[i].ID; 404 effect.ID = args[i].ID;
405 effect.Type = args[i].Type; 405 effect.Type = args[i].Type;
406 effect.TypeData = args[i].TypeData; 406 effect.TypeData = args[i].TypeData;
407 effectBlock.Add(effect); 407 effectBlockArray[i] = effect;
408 } 408 }
409 ViewerEffectPacket.EffectBlock[] effectBlockArray = effectBlock.ToArray();
410 409
411 ForEachClient( 410 ForEachClient(
412 delegate(IClientAPI client) 411 delegate(IClientAPI client)