Complete the support for dupe tracking. Eliminate one of the "Eternal
caches".
0.6.0-stable
Melanie Thielker 2008-08-07 15:32:39 +00:00
parent 6b7fb1712c
commit 39e68833b2
1 changed files with 27 additions and 16 deletions

View File

@ -144,7 +144,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// //
private Dictionary<uint, int> m_DupeTracker = private Dictionary<uint, int> m_DupeTracker =
new Dictionary<uint, int>(); new Dictionary<uint, int>();
//private uint m_DupeTrackerWindow = 30; private uint m_DupeTrackerWindow = 30;
private int m_DupeTrackerLastCheck = System.Environment.TickCount;
// Values for the SimStatsReporter // Values for the SimStatsReporter
// //
@ -459,21 +460,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// We can't keep an unlimited record of dupes. This will prune the // We can't keep an unlimited record of dupes. This will prune the
// dictionary by age. // dictionary by age.
// //
// private void PruneDupeTracker() private void PruneDupeTracker()
// { {
// lock (m_DupeTracker) lock (m_DupeTracker)
// { {
// Dictionary<uint, int> packs = if(m_DupeTracker.Count < 1024)
// new Dictionary<uint, int>(m_DupeTracker); return;
//
// foreach (uint pack in packs.Keys) if(System.Environment.TickCount - m_DupeTrackerLastCheck < 2000)
// { return;
// if (Util.UnixTimeSinceEpoch() - m_DupeTracker[pack] >
// m_DupeTrackerWindow) m_DupeTrackerLastCheck = System.Environment.TickCount;
// m_DupeTracker.Remove(pack);
// } Dictionary<uint, int> packs =
// } new Dictionary<uint, int>(m_DupeTracker);
// }
foreach (uint pack in packs.Keys)
{
if (Util.UnixTimeSinceEpoch() - m_DupeTracker[pack] >
m_DupeTrackerWindow)
m_DupeTracker.Remove(pack);
}
}
}
public void InPacket(Packet packet) public void InPacket(Packet packet)
{ {
@ -545,6 +554,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (packet.Type != PacketType.AgentUpdate) if (packet.Type != PacketType.AgentUpdate)
m_PacketsReceived++; m_PacketsReceived++;
PruneDupeTracker();
// Check for duplicate packets.. packets that the client is // Check for duplicate packets.. packets that the client is
// resending because it didn't receive our ack // resending because it didn't receive our ack
// //