aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs79
1 files changed, 79 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 7a4c6f4..544b54b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -1302,6 +1302,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1302 queue.Enqueue(buffer); 1302 queue.Enqueue(buffer);
1303 return; 1303 return;
1304 } 1304 }
1305 else if (packet.Type == PacketType.CompleteAgentMovement)
1306 {
1307 // Send ack straight away to let the viewer know that we got it.
1308 SendAckImmediate(endPoint, packet.Header.Sequence);
1309
1310 // We need to copy the endpoint so that it doesn't get changed when another thread reuses the
1311 // buffer.
1312 object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet };
1313
1314 Util.FireAndForget(HandleCompleteMovementIntoRegion, array);
1315
1316 return;
1317 }
1305 } 1318 }
1306 1319
1307 // Determine which agent this packet came from 1320 // Determine which agent this packet came from
@@ -1676,6 +1689,72 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1676 } 1689 }
1677 } 1690 }
1678 1691
1692 private void HandleCompleteMovementIntoRegion(object o)
1693 {
1694 IPEndPoint endPoint = null;
1695 IClientAPI client = null;
1696
1697 try
1698 {
1699 object[] array = (object[])o;
1700 endPoint = (IPEndPoint)array[0];
1701 CompleteAgentMovementPacket packet = (CompleteAgentMovementPacket)array[1];
1702
1703 // Determine which agent this packet came from
1704 int count = 20;
1705 bool ready = false;
1706 while (!ready && count-- > 0)
1707 {
1708 if (m_scene.TryGetClient(endPoint, out client) && client.IsActive && client.SceneAgent != null)
1709 {
1710 LLClientView llClientView = (LLClientView)client;
1711 LLUDPClient udpClient = llClientView.UDPClient;
1712 if (udpClient != null && udpClient.IsConnected)
1713 ready = true;
1714 else
1715 {
1716 m_log.Debug("[LLUDPSERVER]: Received a CompleteMovementIntoRegion in " + m_scene.RegionInfo.RegionName + " (not ready yet)");
1717 Thread.Sleep(200);
1718 }
1719 }
1720 else
1721 {
1722 m_log.Debug("[LLUDPSERVER]: Received a CompleteMovementIntoRegion in " + m_scene.RegionInfo.RegionName + " (not ready yet)");
1723 Thread.Sleep(200);
1724 }
1725 }
1726
1727 if (client == null)
1728 return;
1729
1730 IncomingPacket incomingPacket1;
1731
1732 // Inbox insertion
1733 if (UsePools)
1734 {
1735 incomingPacket1 = m_incomingPacketPool.GetObject();
1736 incomingPacket1.Client = (LLClientView)client;
1737 incomingPacket1.Packet = packet;
1738 }
1739 else
1740 {
1741 incomingPacket1 = new IncomingPacket((LLClientView)client, packet);
1742 }
1743
1744 packetInbox.Enqueue(incomingPacket1);
1745 }
1746 catch (Exception e)
1747 {
1748 m_log.ErrorFormat(
1749 "[LLUDPSERVER]: CompleteMovementIntoRegion handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}",
1750 endPoint != null ? endPoint.ToString() : "n/a",
1751 client != null ? client.Name : "unknown",
1752 client != null ? client.AgentId.ToString() : "unknown",
1753 e.Message,
1754 e.StackTrace);
1755 }
1756 }
1757
1679 /// <summary> 1758 /// <summary>
1680 /// Send an ack immediately to the given endpoint. 1759 /// Send an ack immediately to the given endpoint.
1681 /// </summary> 1760 /// </summary>