diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bd8273d..34923be 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -153,6 +153,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
153 | /// <summary>Flag to signal when clients should send pings</summary> | 153 | /// <summary>Flag to signal when clients should send pings</summary> |
154 | private bool m_sendPing; | 154 | private bool m_sendPing; |
155 | 155 | ||
156 | private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); | ||
157 | |||
156 | private int m_defaultRTO = 0; | 158 | private int m_defaultRTO = 0; |
157 | private int m_maxRTO = 0; | 159 | private int m_maxRTO = 0; |
158 | 160 | ||
@@ -701,6 +703,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
701 | { | 703 | { |
702 | object[] array = new object[] { buffer, packet }; | 704 | object[] array = new object[] { buffer, packet }; |
703 | 705 | ||
706 | lock (m_pendingCache) | ||
707 | m_pendingCache.AddOrUpdate(address, new Queue<UDPPacketBuffer>(), 60); | ||
704 | Util.FireAndForget(HandleUseCircuitCode, array); | 708 | Util.FireAndForget(HandleUseCircuitCode, array); |
705 | 709 | ||
706 | return; | 710 | return; |
@@ -710,6 +714,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
710 | IClientAPI client; | 714 | IClientAPI client; |
711 | if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) | 715 | if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) |
712 | { | 716 | { |
717 | lock (m_pendingCache) | ||
718 | { | ||
719 | Queue<UDPPacketBuffer> queue; | ||
720 | if (m_pendingCache.TryGetValue(address, out queue)) | ||
721 | queue.Enqueue(buffer); | ||
722 | } | ||
723 | |||
713 | // m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); | 724 | // m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); |
714 | return; | 725 | return; |
715 | } | 726 | } |
@@ -943,6 +954,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
943 | // We only want to send initial data to new clients, not ones which are being converted from child to root. | 954 | // We only want to send initial data to new clients, not ones which are being converted from child to root. |
944 | if (client != null) | 955 | if (client != null) |
945 | client.SceneAgent.SendInitialDataToMe(); | 956 | client.SceneAgent.SendInitialDataToMe(); |
957 | |||
958 | // Now we know we can handle more data | ||
959 | Thread.Sleep(200); | ||
960 | |||
961 | // Obtain the queue and remove it from the cache | ||
962 | Queue<UDPPacketBuffer> queue = null; | ||
963 | |||
964 | lock (m_pendingCache) | ||
965 | { | ||
966 | if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue)) | ||
967 | return; | ||
968 | m_pendingCache.Remove(remoteEndPoint); | ||
969 | } | ||
970 | |||
971 | // Reinject queued packets | ||
972 | while(queue.Count > 0) | ||
973 | { | ||
974 | UDPPacketBuffer buf = queue.Dequeue(); | ||
975 | PacketReceived(buf); | ||
976 | } | ||
977 | queue = null; | ||
946 | } | 978 | } |
947 | else | 979 | else |
948 | { | 980 | { |
@@ -950,6 +982,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
950 | m_log.WarnFormat( | 982 | m_log.WarnFormat( |
951 | "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}", | 983 | "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}", |
952 | uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint); | 984 | uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint); |
985 | lock (m_pendingCache) | ||
986 | m_pendingCache.Remove(remoteEndPoint); | ||
953 | } | 987 | } |
954 | 988 | ||
955 | // m_log.DebugFormat( | 989 | // m_log.DebugFormat( |