aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorDr Scofield2009-06-25 08:00:18 +0000
committerDr Scofield2009-06-25 08:00:18 +0000
commit9f83f124c771296a7b7d69d0a270ee6a80056e88 (patch)
treee8c549457b2e00baa11e41e2581b407076274eb1 /OpenSim/Region/ClientStack
parentcommenting out expensive bits (who in the world even uses SetClientInfo()?) (diff)
downloadopensim-SC-9f83f124c771296a7b7d69d0a270ee6a80056e88.zip
opensim-SC-9f83f124c771296a7b7d69d0a270ee6a80056e88.tar.gz
opensim-SC-9f83f124c771296a7b7d69d0a270ee6a80056e88.tar.bz2
opensim-SC-9f83f124c771296a7b7d69d0a270ee6a80056e88.tar.xz
streamling m_PendingAcks logic to get rid of gratuitous List<...>
instantiations and object copies.
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs40
1 files changed, 20 insertions, 20 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
index 9e5eecc..a889110 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs
@@ -61,7 +61,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
61 61
62 // A list of the packets we haven't acked yet 62 // A list of the packets we haven't acked yet
63 // 63 //
64 private Dictionary<uint, uint> m_PendingAcks = new Dictionary<uint, uint>(); 64 private List<uint> m_PendingAcks = new List<uint>();
65 private Dictionary<uint, uint> m_PendingAcksMap = new Dictionary<uint, uint>();
65 66
66 private Dictionary<uint, LLQueItem> m_NeedAck = 67 private Dictionary<uint, LLQueItem> m_NeedAck =
67 new Dictionary<uint, LLQueItem>(); 68 new Dictionary<uint, LLQueItem>();
@@ -236,16 +237,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
236 packet.Header.AckList = new uint[count]; 237 packet.Header.AckList = new uint[count];
237 packet.Header.AppendedAcks = true; 238 packet.Header.AppendedAcks = true;
238 239
239 int i = 0; 240 for(int i = 0; i < count; i++)
240
241 foreach (uint ack in new List<uint>(m_PendingAcks.Keys))
242 { 241 {
243 packet.Header.AckList[i] = ack; 242 packet.Header.AckList[i] = m_PendingAcks[i];
244 i++; 243 m_PendingAcksMap.Remove(m_PendingAcks[i]);
245 m_PendingAcks.Remove(ack);
246 if (i >= count) // That is how much space there is
247 break;
248 } 244 }
245 m_PendingAcks.RemoveRange(0, count);
249 } 246 }
250 } 247 }
251 248
@@ -376,15 +373,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
376 if (acks.Packets == null || 373 if (acks.Packets == null ||
377 acks.Packets.Length != m_PendingAcks.Count) 374 acks.Packets.Length != m_PendingAcks.Count)
378 acks.Packets = new PacketAckPacket.PacketsBlock[m_PendingAcks.Count]; 375 acks.Packets = new PacketAckPacket.PacketsBlock[m_PendingAcks.Count];
379 int i = 0; 376
380 foreach (uint ack in new List<uint>(m_PendingAcks.Keys)) 377 for (int i = 0; i < m_PendingAcks.Count; i++)
381 { 378 {
382 acks.Packets[i] = new PacketAckPacket.PacketsBlock(); 379 acks.Packets[i] = new PacketAckPacket.PacketsBlock();
383 acks.Packets[i].ID = ack; 380 acks.Packets[i].ID = m_PendingAcks[i];
384 381
385 m_PendingAcks.Remove(ack); 382 m_PendingAcksMap.Remove(m_PendingAcks[i]);
386 i++;
387 } 383 }
384 m_PendingAcksMap.Clear();
388 385
389 acks.Header.Reliable = false; 386 acks.Header.Reliable = false;
390 OutPacket(acks, ThrottleOutPacketType.Unknown); 387 OutPacket(acks, ThrottleOutPacketType.Unknown);
@@ -400,9 +397,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
400 { 397 {
401 if (m_PendingAcks.Count < 250) 398 if (m_PendingAcks.Count < 250)
402 { 399 {
403 if (!m_PendingAcks.ContainsKey(packet.Header.Sequence)) 400 if (!m_PendingAcksMap.ContainsKey(packet.Header.Sequence))
404 m_PendingAcks.Add(packet.Header.Sequence, 401 m_PendingAcks.Add(packet.Header.Sequence);
405 packet.Header.Sequence); 402 m_PendingAcksMap.Add(packet.Header.Sequence,
403 packet.Header.Sequence);
406 return; 404 return;
407 } 405 }
408 } 406 }
@@ -416,9 +414,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
416 // 414 //
417 if (m_PendingAcks.Count < 250) 415 if (m_PendingAcks.Count < 250)
418 { 416 {
419 if (!m_PendingAcks.ContainsKey(packet.Header.Sequence)) 417 if (!m_PendingAcksMap.ContainsKey(packet.Header.Sequence))
420 m_PendingAcks.Add(packet.Header.Sequence, 418 m_PendingAcks.Add(packet.Header.Sequence);
421 packet.Header.Sequence); 419 m_PendingAcksMap.Add(packet.Header.Sequence,
420 packet.Header.Sequence);
422 return; 421 return;
423 } 422 }
424 } 423 }
@@ -593,6 +592,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
593 SendPacketStats(); 592 SendPacketStats();
594 m_NeedAck.Clear(); 593 m_NeedAck.Clear();
595 m_PendingAcks.Clear(); 594 m_PendingAcks.Clear();
595 m_PendingAcksMap.Clear();
596 m_Sequence += 1000000; 596 m_Sequence += 1000000;
597 } 597 }
598 598