From cbb9693ef4f5fe10251ebe04ca7de7f6e65d2893 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 1 Oct 2008 20:54:28 +0000 Subject: [PATCH] * Try bumping packet resend timeout up to 2 seconds instead of 1 * This actually probably doesn't make a huge difference. We still end up resending a massive number of packets in quite a few situations, but it's not easy to consistently reproduce this. * Might really need some throttling of packet send to the client on the OpenSim end. --- .../ClientStack/LindenUDP/LLPacketHandler.cs | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs index 0608b7f60a..ca0882d68b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs @@ -78,8 +78,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public class LLPacketHandler : IPacketHandler { - //private static readonly ILog m_log = - // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log + = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private int m_resentCount; // Packet queues // @@ -117,7 +119,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP private Dictionary m_NeedAck = new Dictionary(); - private uint m_ResendTimeout = 1000; + /// + /// The number of milliseconds that can pass before a packet that needs an ack is resent. + /// + private uint m_ResendTimeout = 2000; public uint ResendTimeout { @@ -125,7 +130,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP set { m_ResendTimeout = value; } } - private uint m_DiscardTimeout = 8000; + /// + /// The number of milliseconds that can pass before a packet that needs an ack is discarded instead. + /// + private uint m_DiscardTimeout = 16000; public uint DiscardTimeout { @@ -357,8 +365,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Resend the packet. Set the packet's tick count to // now, and keep it marked as resent. //m_log.DebugFormat( - // "[CLIENT]: Resending unacked packet number {0} after {1}ms", - // packet.Header.Sequence, now - data.TickCount); + // "[CLIENT]: In {0} resending unacked packet {1} after {2}ms", + // m_Client.Scene.RegionInfo.ExternalEndPoint.Port, packet.Header.Sequence, now - data.TickCount); + //m_log.DebugFormat("[CLIENT]: Resent {0} packets in total", ++m_resentCount); packet.Header.Resent = true; QueuePacket(packet, ThrottleOutPacketType.Resend, @@ -380,8 +389,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_NeedAck.Remove(packet.Header.Sequence); //m_log.DebugFormat( - // "[CLIENT]: Discarding ack requirement for packet number {0}", - // packet.Header.Sequence); + // "[CLIENT]: In {0} discarding ack requirement for packet {1}", + // m_Client.Scene.RegionInfo.ExternalEndPoint.Port, packet.Header.Sequence); } TriggerOnPacketDrop(packet, data.Identifier); @@ -621,7 +630,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP lock (m_NeedAck) { - //m_log.DebugFormat("[CLIENT]: Received ack for packet sequence number {0}", id); + //m_log.DebugFormat("[CLIENT]: In {0} received ack for packet {1}", m_Client.Scene.RegionInfo.ExternalEndPoint.Port, id); if (!m_NeedAck.TryGetValue(id, out data)) return; @@ -780,6 +789,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Actually make the byte array and send it byte[] sendbuffer = packet.ToBytes(); + //m_log.DebugFormat( + // "[CLIENT]: In {0} sending packet {1}", + // m_Client.Scene.RegionInfo.ExternalEndPoint.Port, packet.Header.Sequence); + if (packet.Header.Zerocoded) { int packetsize = Helpers.ZeroEncode(sendbuffer,