diff options
author | Melanie Thielker | 2008-08-07 15:32:39 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-08-07 15:32:39 +0000 |
commit | 39e68833b23d789cbeea8e4673bc3a50b476d79c (patch) | |
tree | 068777205110598df30a55bc27829ebb88b5ff21 /OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs | |
parent | Mantis#1894. Thank you kindly, HomerHorwitz for a patch that: (diff) | |
download | opensim-SC_OLD-39e68833b23d789cbeea8e4673bc3a50b476d79c.zip opensim-SC_OLD-39e68833b23d789cbeea8e4673bc3a50b476d79c.tar.gz opensim-SC_OLD-39e68833b23d789cbeea8e4673bc3a50b476d79c.tar.bz2 opensim-SC_OLD-39e68833b23d789cbeea8e4673bc3a50b476d79c.tar.xz |
Patch #9159
Complete the support for dupe tracking. Eliminate one of the "Eternal
caches".
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs index 51448f2..8c11467 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs | |||
@@ -144,7 +144,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
144 | // | 144 | // |
145 | private Dictionary<uint, int> m_DupeTracker = | 145 | private Dictionary<uint, int> m_DupeTracker = |
146 | new Dictionary<uint, int>(); | 146 | new Dictionary<uint, int>(); |
147 | //private uint m_DupeTrackerWindow = 30; | 147 | private uint m_DupeTrackerWindow = 30; |
148 | private int m_DupeTrackerLastCheck = System.Environment.TickCount; | ||
148 | 149 | ||
149 | // Values for the SimStatsReporter | 150 | // Values for the SimStatsReporter |
150 | // | 151 | // |
@@ -459,21 +460,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
459 | // We can't keep an unlimited record of dupes. This will prune the | 460 | // We can't keep an unlimited record of dupes. This will prune the |
460 | // dictionary by age. | 461 | // dictionary by age. |
461 | // | 462 | // |
462 | // private void PruneDupeTracker() | 463 | private void PruneDupeTracker() |
463 | // { | 464 | { |
464 | // lock (m_DupeTracker) | 465 | lock (m_DupeTracker) |
465 | // { | 466 | { |
466 | // Dictionary<uint, int> packs = | 467 | if(m_DupeTracker.Count < 1024) |
467 | // new Dictionary<uint, int>(m_DupeTracker); | 468 | return; |
468 | // | 469 | |
469 | // foreach (uint pack in packs.Keys) | 470 | if(System.Environment.TickCount - m_DupeTrackerLastCheck < 2000) |
470 | // { | 471 | return; |
471 | // if (Util.UnixTimeSinceEpoch() - m_DupeTracker[pack] > | 472 | |
472 | // m_DupeTrackerWindow) | 473 | m_DupeTrackerLastCheck = System.Environment.TickCount; |
473 | // m_DupeTracker.Remove(pack); | 474 | |
474 | // } | 475 | Dictionary<uint, int> packs = |
475 | // } | 476 | new Dictionary<uint, int>(m_DupeTracker); |
476 | // } | 477 | |
478 | foreach (uint pack in packs.Keys) | ||
479 | { | ||
480 | if (Util.UnixTimeSinceEpoch() - m_DupeTracker[pack] > | ||
481 | m_DupeTrackerWindow) | ||
482 | m_DupeTracker.Remove(pack); | ||
483 | } | ||
484 | } | ||
485 | } | ||
477 | 486 | ||
478 | public void InPacket(Packet packet) | 487 | public void InPacket(Packet packet) |
479 | { | 488 | { |
@@ -545,6 +554,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
545 | if (packet.Type != PacketType.AgentUpdate) | 554 | if (packet.Type != PacketType.AgentUpdate) |
546 | m_PacketsReceived++; | 555 | m_PacketsReceived++; |
547 | 556 | ||
557 | PruneDupeTracker(); | ||
558 | |||
548 | // Check for duplicate packets.. packets that the client is | 559 | // Check for duplicate packets.. packets that the client is |
549 | // resending because it didn't receive our ack | 560 | // resending because it didn't receive our ack |
550 | // | 561 | // |