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.

avinationmerge
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

@ -819,6 +819,10 @@ namespace OpenSim.Client.MXP.ClientStack
//throw new System.NotImplementedException(); //throw new System.NotImplementedException();
} }
public void ProcessPendingPackets()
{
}
public void ProcessInPacket(Packet NewPack) public void ProcessInPacket(Packet NewPack)
{ {
//throw new System.NotImplementedException(); //throw new System.NotImplementedException();

View File

@ -439,6 +439,10 @@ namespace OpenSim.Client.Sirikata.ClientStack
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }
public void ProcessPendingPackets()
{
}
public void ProcessInPacket(Packet NewPack) public void ProcessInPacket(Packet NewPack)
{ {
throw new System.NotImplementedException(); throw new System.NotImplementedException();

View File

@ -445,6 +445,10 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }
public void ProcessPendingPackets()
{
}
public void ProcessInPacket(Packet NewPack) public void ProcessInPacket(Packet NewPack)
{ {
throw new System.NotImplementedException(); throw new System.NotImplementedException();

View File

@ -1112,6 +1112,7 @@ namespace OpenSim.Framework
void SetDebugPacketLevel(int newDebug); void SetDebugPacketLevel(int newDebug);
void InPacket(object NewPack); void InPacket(object NewPack);
void ProcessPendingPackets();
void ProcessInPacket(Packet NewPack); void ProcessInPacket(Packet NewPack);
void Close(); void Close();
void Close(bool sendStop); void Close(bool sendStop);

View File

@ -376,6 +376,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private AgentUpdateArgs lastarg; private AgentUpdateArgs lastarg;
private bool m_IsActive = true; private bool m_IsActive = true;
private bool m_IsLoggingOut = false; private bool m_IsLoggingOut = false;
private bool m_IsPresenceReady = false;
protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); 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 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 Timer m_propertiesPacketTimer;
private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>(); private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>();
private List<Packet> m_pendingPackets;
#endregion Class Members #endregion Class Members
@ -439,6 +441,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
get { return m_IsActive; } get { return m_IsActive; }
set { m_IsActive = value; } set { m_IsActive = value; }
} }
public bool IsLoggingOut public bool IsLoggingOut
{ {
get { return m_IsLoggingOut; } get { return m_IsLoggingOut; }
@ -11195,11 +11198,34 @@ 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> /// <summary>
/// Entryway from the client to the simulator. All UDP packets from the client will end up here /// Entryway from the client to the simulator. All UDP packets from the client will end up here
/// </summary> /// </summary>
/// <param name="Pack">OpenMetaverse.packet</param> /// <param name="Pack">OpenMetaverse.packet</param>
public void ProcessInPacket(Packet Pack) public void ProcessInPacket(Packet Pack)
{
if (!m_IsPresenceReady)
{
if (m_pendingPackets == null)
{
m_pendingPackets = new List<Packet>();
}
m_pendingPackets.Add(Pack);
}
else
{ {
if (m_debugPacketLevel >= 255) if (m_debugPacketLevel >= 255)
m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type);
@ -11209,6 +11235,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
PacketPool.Instance.ReturnPacket(Pack); PacketPool.Instance.ReturnPacket(Pack);
} }
}
private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket)
{ {

View File

@ -825,6 +825,10 @@ namespace OpenSim.Region.Examples.SimpleModule
{ {
} }
public void ProcessPendingPackets()
{
}
public void ProcessInPacket(Packet NewPack) public void ProcessInPacket(Packet NewPack)
{ {
} }

View File

@ -715,8 +715,11 @@ namespace OpenSim.Region.Framework.Scenes
// Request info about all the (root) agents in this region // Request info about all the (root) agents in this region
// Note: This won't send data *to* other clients in that region (children don't send) // Note: This won't send data *to* other clients in that region (children don't send)
SendInitialFullUpdateToAllClients(); SendInitialFullUpdateToAllClients();
RegisterToEvents(); RegisterToEvents();
if (m_controllingClient != null)
{
m_controllingClient.ProcessPendingPackets();
}
SetDirectionVectors(); SetDirectionVectors();
} }
@ -858,7 +861,6 @@ namespace OpenSim.Region.Framework.Scenes
m_grouptitle = gm.GetGroupTitle(m_uuid); m_grouptitle = gm.GetGroupTitle(m_uuid);
m_rootRegionHandle = m_scene.RegionInfo.RegionHandle; m_rootRegionHandle = m_scene.RegionInfo.RegionHandle;
m_scene.SetRootAgentScene(m_uuid); m_scene.SetRootAgentScene(m_uuid);
// Moved this from SendInitialData to ensure that m_appearance is initialized // Moved this from SendInitialData to ensure that m_appearance is initialized
@ -1173,7 +1175,6 @@ namespace OpenSim.Region.Framework.Scenes
pos.Z = ground + 1.5f; pos.Z = ground + 1.5f;
AbsolutePosition = pos; AbsolutePosition = pos;
} }
m_isChildAgent = false; m_isChildAgent = false;
bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
MakeRootAgent(AbsolutePosition, m_flying); MakeRootAgent(AbsolutePosition, m_flying);
@ -3744,7 +3745,10 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
m_scene = scene; m_scene = scene;
RegisterToEvents(); RegisterToEvents();
if (m_controllingClient != null)
{
m_controllingClient.ProcessPendingPackets();
}
/* /*
AbsolutePosition = client.StartPos; AbsolutePosition = client.StartPos;

View File

@ -878,6 +878,10 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
} }
public void ProcessPendingPackets()
{
}
public void ProcessInPacket(Packet NewPack) public void ProcessInPacket(Packet NewPack)
{ {

View File

@ -839,6 +839,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
} }
public void ProcessPendingPackets()
{
}
public void ProcessInPacket(Packet NewPack) public void ProcessInPacket(Packet NewPack)
{ {
} }

View File

@ -882,6 +882,10 @@ namespace OpenSim.Tests.Common.Mock
{ {
} }
public void ProcessPendingPackets()
{
}
public void ProcessInPacket(Packet NewPack) public void ProcessInPacket(Packet NewPack)
{ {
} }