diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 102e581..cdc1668 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -1693,31 +1693,60 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1693 | CompleteAgentMovementPacket packet = (CompleteAgentMovementPacket)array[1]; | 1693 | CompleteAgentMovementPacket packet = (CompleteAgentMovementPacket)array[1]; |
1694 | 1694 | ||
1695 | // Determine which agent this packet came from | 1695 | // Determine which agent this packet came from |
1696 | // We need to wait here because in when using the OpenSimulator V2 teleport protocol to travel to a destination | ||
1697 | // simulator with no existing child presence, the viewer (at least LL 3.3.4) will send UseCircuitCode | ||
1698 | // and then CompleteAgentMovement immediately without waiting for an ack. As we are now handling these | ||
1699 | // packets asynchronously, we need to account for this thread proceeding more quickly than the | ||
1700 | // UseCircuitCode thread. | ||
1696 | int count = 20; | 1701 | int count = 20; |
1697 | bool ready = false; | 1702 | while (count-- > 0) |
1698 | while (!ready && count-- > 0) | ||
1699 | { | 1703 | { |
1700 | if (m_scene.TryGetClient(endPoint, out client) && client.IsActive && client.SceneAgent != null) | 1704 | if (m_scene.TryGetClient(endPoint, out client)) |
1701 | { | 1705 | { |
1702 | LLClientView llClientView = (LLClientView)client; | 1706 | if (client.IsActive) |
1703 | LLUDPClient udpClient = llClientView.UDPClient; | 1707 | { |
1704 | if (udpClient != null && udpClient.IsConnected) | 1708 | break; |
1705 | ready = true; | 1709 | } |
1706 | else | 1710 | else |
1707 | { | 1711 | { |
1708 | m_log.Debug("[LLUDPSERVER]: Received a CompleteMovementIntoRegion in " + m_scene.RegionInfo.RegionName + " (not ready yet)"); | 1712 | // This check exists to catch a condition where the client has been closed by another thread |
1709 | Thread.Sleep(200); | 1713 | // but has not yet been removed from the client manager (and possibly a new connection has |
1714 | // not yet been established). | ||
1715 | m_log.DebugFormat( | ||
1716 | "[LLUDPSERVER]: Received a CompleteMovementIntoRegion from {0} for {1} in {2} but client is not active. Waiting.", | ||
1717 | endPoint, client.Name, m_scene.Name); | ||
1710 | } | 1718 | } |
1711 | } | 1719 | } |
1712 | else | 1720 | else |
1713 | { | 1721 | { |
1714 | m_log.Debug("[LLUDPSERVER]: Received a CompleteMovementIntoRegion in " + m_scene.RegionInfo.RegionName + " (not ready yet)"); | 1722 | m_log.DebugFormat( |
1723 | "[LLUDPSERVER]: Received a CompleteMovementIntoRegion from {0} in {1} but no client exists. Waiting.", | ||
1724 | endPoint, m_scene.Name); | ||
1725 | |||
1715 | Thread.Sleep(200); | 1726 | Thread.Sleep(200); |
1716 | } | 1727 | } |
1717 | } | 1728 | } |
1718 | 1729 | ||
1719 | if (client == null) | 1730 | if (client == null) |
1731 | { | ||
1732 | m_log.DebugFormat( | ||
1733 | "[LLUDPSERVER]: No client found for CompleteMovementIntoRegion from {0} in {1} after wait. Dropping.", | ||
1734 | endPoint, m_scene.Name); | ||
1735 | |||
1720 | return; | 1736 | return; |
1737 | } | ||
1738 | else if (!client.IsActive) | ||
1739 | { | ||
1740 | // This check exists to catch a condition where the client has been closed by another thread | ||
1741 | // but has not yet been removed from the client manager. | ||
1742 | // The packet could be simply ignored but it is useful to know if this condition occurred for other debugging | ||
1743 | // purposes. | ||
1744 | m_log.DebugFormat( | ||
1745 | "[LLUDPSERVER]: Received a CompleteMovementIntoRegion from {0} for {1} in {2} but client is not active after wait. Dropping.", | ||
1746 | endPoint, client.Name, m_scene.Name); | ||
1747 | |||
1748 | return; | ||
1749 | } | ||
1721 | 1750 | ||
1722 | IncomingPacket incomingPacket1; | 1751 | IncomingPacket incomingPacket1; |
1723 | 1752 | ||