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.

This commit is contained in:
Tom Grimshaw
2010-05-18 01:09:47 -07:00
parent ae7c30a0f3
commit 91b1d17e5b
10 changed files with 114 additions and 54 deletions

View File

@@ -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<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>();
protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers
@@ -399,6 +400,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private Timer m_propertiesPacketTimer;
private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>();
private List<Packet> 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; }
@@ -11195,19 +11198,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
/// <summary>
/// This processes packets which have accumulated while the presence was still in the process of initialising.
/// </summary>
public void ProcessPendingPackets()
{
m_IsPresenceReady = true;
foreach (Packet p in m_pendingPackets)
{
ProcessInPacket(p);
}
m_pendingPackets.Clear();
}
/// <summary>
/// Entryway from the client to the simulator. All UDP packets from the client will end up here
/// </summary>
/// <param name="Pack">OpenMetaverse.packet</param>
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<Packet>();
}
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)