Change logging to provide more information on LLUDPServer.HandleCompleteMovementIntoRegion()

Add more information on which endpoint sent the packet when we have to wait and if we end up dropping the packet
Only check if the client is active - other checks are redundant since they can only failed if IsActve = false
0.7.6-extended
Justin Clark-Casey (justincc) 2013-09-18 21:41:51 +01:00
parent b1d43d46bf
commit 6c2462e410
1 changed files with 39 additions and 10 deletions

View File

@ -1693,31 +1693,60 @@ namespace OpenSim.Region.ClientStack.LindenUDP
CompleteAgentMovementPacket packet = (CompleteAgentMovementPacket)array[1]; CompleteAgentMovementPacket packet = (CompleteAgentMovementPacket)array[1];
// Determine which agent this packet came from // Determine which agent this packet came from
// We need to wait here because in when using the OpenSimulator V2 teleport protocol to travel to a destination
// simulator with no existing child presence, the viewer (at least LL 3.3.4) will send UseCircuitCode
// and then CompleteAgentMovement immediately without waiting for an ack. As we are now handling these
// packets asynchronously, we need to account for this thread proceeding more quickly than the
// UseCircuitCode thread.
int count = 20; int count = 20;
bool ready = false; while (count-- > 0)
while (!ready && count-- > 0)
{ {
if (m_scene.TryGetClient(endPoint, out client) && client.IsActive && client.SceneAgent != null) if (m_scene.TryGetClient(endPoint, out client))
{ {
LLClientView llClientView = (LLClientView)client; if (client.IsActive)
LLUDPClient udpClient = llClientView.UDPClient; {
if (udpClient != null && udpClient.IsConnected) break;
ready = true; }
else else
{ {
m_log.Debug("[LLUDPSERVER]: Received a CompleteMovementIntoRegion in " + m_scene.RegionInfo.RegionName + " (not ready yet)"); // This check exists to catch a condition where the client has been closed by another thread
Thread.Sleep(200); // but has not yet been removed from the client manager (and possibly a new connection has
// not yet been established).
m_log.DebugFormat(
"[LLUDPSERVER]: Received a CompleteMovementIntoRegion from {0} for {1} in {2} but client is not active. Waiting.",
endPoint, client.Name, m_scene.Name);
} }
} }
else else
{ {
m_log.Debug("[LLUDPSERVER]: Received a CompleteMovementIntoRegion in " + m_scene.RegionInfo.RegionName + " (not ready yet)"); m_log.DebugFormat(
"[LLUDPSERVER]: Received a CompleteMovementIntoRegion from {0} in {1} but no client exists. Waiting.",
endPoint, m_scene.Name);
Thread.Sleep(200); Thread.Sleep(200);
} }
} }
if (client == null) if (client == null)
{
m_log.DebugFormat(
"[LLUDPSERVER]: No client found for CompleteMovementIntoRegion from {0} in {1} after wait. Dropping.",
endPoint, m_scene.Name);
return; return;
}
else if (!client.IsActive)
{
// This check exists to catch a condition where the client has been closed by another thread
// but has not yet been removed from the client manager.
// The packet could be simply ignored but it is useful to know if this condition occurred for other debugging
// purposes.
m_log.DebugFormat(
"[LLUDPSERVER]: Received a CompleteMovementIntoRegion from {0} for {1} in {2} but client is not active after wait. Dropping.",
endPoint, client.Name, m_scene.Name);
return;
}
IncomingPacket incomingPacket1; IncomingPacket incomingPacket1;