From 91b1d17e5bd3ff6ed006744bc529b53a67af1a64 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Tue, 18 May 2010 01:09:47 -0700 Subject: Fix for hanging on "Connecting to region".. caused by packets being processed before the presence has bound to receive events. Fixed this by adding packets to a queue and then processing them when the presence is ready. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 37 +++++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 5670a78..df6a767 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -376,6 +376,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private AgentUpdateArgs lastarg; private bool m_IsActive = true; private bool m_IsLoggingOut = false; + private bool m_IsPresenceReady = false; protected Dictionary m_packetHandlers = new Dictionary(); protected Dictionary m_genericPacketHandlers = new Dictionary(); //PauPaw:Local Generic Message handlers @@ -399,6 +400,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private Timer m_propertiesPacketTimer; private List m_propertiesBlocks = new List(); + private List m_pendingPackets; #endregion Class Members @@ -439,6 +441,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_IsActive; } set { m_IsActive = value; } } + public bool IsLoggingOut { get { return m_IsLoggingOut; } @@ -11196,18 +11199,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// + /// This processes packets which have accumulated while the presence was still in the process of initialising. + /// + public void ProcessPendingPackets() + { + m_IsPresenceReady = true; + foreach (Packet p in m_pendingPackets) + { + ProcessInPacket(p); + } + m_pendingPackets.Clear(); + } + + /// /// Entryway from the client to the simulator. All UDP packets from the client will end up here /// /// OpenMetaverse.packet public void ProcessInPacket(Packet Pack) { - if (m_debugPacketLevel >= 255) - m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); + if (!m_IsPresenceReady) + { + if (m_pendingPackets == null) + { + m_pendingPackets = new List(); + } + m_pendingPackets.Add(Pack); + } + else + { + if (m_debugPacketLevel >= 255) + m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); - if (!ProcessPacketMethod(Pack)) - m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); + if (!ProcessPacketMethod(Pack)) + m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); - PacketPool.Instance.ReturnPacket(Pack); + PacketPool.Instance.ReturnPacket(Pack); + } } private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) -- cgit v1.1