From 6784cebf570b3a47ff2c1868ae30ec644f886ae6 Mon Sep 17 00:00:00 2001 From: MW Date: Mon, 21 Jul 2008 16:21:59 +0000 Subject: added support so that the packet tracker can resend packets itself as well as triggering a event. Next step to change the terrain packet resending to use these feature. --- .../ClientStack/LindenUDP/LLPacketTracker.cs | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketTracker.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketTracker.cs index e775a67..ce9c527 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketTracker.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketTracker.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Text; using System.Threading; using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Framework; namespace OpenSim.Region.ClientStack.LindenUDP { @@ -36,11 +38,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void TrackTerrainPacket(uint sequenceNumber, int patchX, int patchY) { + TrackTerrainPacket(sequenceNumber, patchX, patchY, false, null); + } + + public void TrackTerrainPacket(uint sequenceNumber, int patchX, int patchY, bool keepResending, LayerDataPacket packet) + { TerrainPacketTracker tracker = new TerrainPacketTracker(); tracker.X = patchX; tracker.Y = patchY; tracker.SeqNumber = sequenceNumber; tracker.TimeSent = DateTime.Now; + tracker.KeepResending = keepResending; + tracker.Packet = packet; lock (m_sentTerrainPackets) { m_sentTerrainPackets[patchX, patchY] = tracker; @@ -85,7 +94,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP foreach (TerrainPacketTracker tracker in resendList) { - m_parentClient.TriggerTerrainUnackedEvent(tracker.X, tracker.Y); + if (!tracker.KeepResending) + { + m_parentClient.TriggerTerrainUnackedEvent(tracker.X, tracker.Y); + } + else + { + if (tracker.Packet != null) + { + tracker.Packet.Header.Resent = true; + m_parentClient.OutPacket(tracker.Packet, ThrottleOutPacketType.Resend); + tracker.TimeSent = DateTime.Now; + lock (m_sentTerrainPackets) + { + if (m_sentTerrainPackets[tracker.X, tracker.Y] == null) + { + m_sentTerrainPackets[tracker.X, tracker.Y] = tracker; + } + } + } + } } } @@ -220,7 +248,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public int X; public int Y; public DateTime TimeSent; - + public LayerDataPacket Packet; + public bool KeepResending; } public class PrimPacketTracker -- cgit v1.1