diff options
author | Melanie | 2012-07-16 22:22:42 +0100 |
---|---|---|
committer | Melanie | 2012-07-16 22:22:42 +0100 |
commit | c256447f46db1738131763960c9394f03b072c46 (patch) | |
tree | 277255a693b3ce62366816338482a602d7d979bf /OpenSim/Region/ClientStack/Linden | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Allow setting linked avatar positions from within a prim not the one sat on (diff) | |
download | opensim-SC_OLD-c256447f46db1738131763960c9394f03b072c46.zip opensim-SC_OLD-c256447f46db1738131763960c9394f03b072c46.tar.gz opensim-SC_OLD-c256447f46db1738131763960c9394f03b072c46.tar.bz2 opensim-SC_OLD-c256447f46db1738131763960c9394f03b072c46.tar.xz |
Merge branch 'avination' into careminster
Conflicts:
OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 71 |
1 files changed, 63 insertions, 8 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bcb45cf..79e35f4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -155,6 +155,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
155 | /// <summary>Flag to signal when clients should send pings</summary> | 155 | /// <summary>Flag to signal when clients should send pings</summary> |
156 | protected bool m_sendPing; | 156 | protected bool m_sendPing; |
157 | 157 | ||
158 | private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); | ||
159 | |||
158 | private int m_defaultRTO = 0; | 160 | private int m_defaultRTO = 0; |
159 | private int m_maxRTO = 0; | 161 | private int m_maxRTO = 0; |
160 | private int m_ackTimeout = 0; | 162 | private int m_ackTimeout = 0; |
@@ -765,21 +767,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
765 | 767 | ||
766 | #region Packet to Client Mapping | 768 | #region Packet to Client Mapping |
767 | 769 | ||
768 | // UseCircuitCode handling | 770 | // If there is already a client for this endpoint, don't process UseCircuitCode |
769 | if (packet.Type == PacketType.UseCircuitCode) | 771 | IClientAPI client = null; |
772 | if (!m_scene.TryGetClient(address, out client)) | ||
770 | { | 773 | { |
771 | object[] array = new object[] { buffer, packet }; | 774 | // UseCircuitCode handling |
775 | if (packet.Type == PacketType.UseCircuitCode) | ||
776 | { | ||
777 | // And if there is a UseCircuitCode pending, also drop it | ||
778 | lock (m_pendingCache) | ||
779 | { | ||
780 | if (m_pendingCache.Contains(address)) | ||
781 | return; | ||
772 | 782 | ||
773 | Util.FireAndForget(HandleUseCircuitCode, array); | 783 | m_pendingCache.AddOrUpdate(address, new Queue<UDPPacketBuffer>(), 60); |
784 | } | ||
774 | 785 | ||
775 | return; | 786 | object[] array = new object[] { buffer, packet }; |
787 | |||
788 | Util.FireAndForget(HandleUseCircuitCode, array); | ||
789 | |||
790 | return; | ||
791 | } | ||
792 | } | ||
793 | |||
794 | // If this is a pending connection, enqueue, don't process yet | ||
795 | lock (m_pendingCache) | ||
796 | { | ||
797 | Queue<UDPPacketBuffer> queue; | ||
798 | if (m_pendingCache.TryGetValue(address, out queue)) | ||
799 | { | ||
800 | //m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); | ||
801 | queue.Enqueue(buffer); | ||
802 | return; | ||
803 | } | ||
776 | } | 804 | } |
777 | 805 | ||
778 | // Determine which agent this packet came from | 806 | // Determine which agent this packet came from |
779 | IClientAPI client; | 807 | if (client == null || !(client is LLClientView)) |
780 | if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) | ||
781 | { | 808 | { |
782 | // m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); | 809 | //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); |
783 | return; | 810 | return; |
784 | } | 811 | } |
785 | 812 | ||
@@ -1014,6 +1041,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1014 | // We only want to send initial data to new clients, not ones which are being converted from child to root. | 1041 | // We only want to send initial data to new clients, not ones which are being converted from child to root. |
1015 | if (client != null) | 1042 | if (client != null) |
1016 | client.SceneAgent.SendInitialDataToMe(); | 1043 | client.SceneAgent.SendInitialDataToMe(); |
1044 | |||
1045 | // Now we know we can handle more data | ||
1046 | Thread.Sleep(200); | ||
1047 | |||
1048 | // Obtain the queue and remove it from the cache | ||
1049 | Queue<UDPPacketBuffer> queue = null; | ||
1050 | |||
1051 | lock (m_pendingCache) | ||
1052 | { | ||
1053 | if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue)) | ||
1054 | { | ||
1055 | m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present"); | ||
1056 | return; | ||
1057 | } | ||
1058 | m_pendingCache.Remove(remoteEndPoint); | ||
1059 | } | ||
1060 | |||
1061 | m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); | ||
1062 | |||
1063 | // Reinject queued packets | ||
1064 | while(queue.Count > 0) | ||
1065 | { | ||
1066 | UDPPacketBuffer buf = queue.Dequeue(); | ||
1067 | PacketReceived(buf); | ||
1068 | } | ||
1069 | queue = null; | ||
1017 | } | 1070 | } |
1018 | else | 1071 | else |
1019 | { | 1072 | { |
@@ -1021,6 +1074,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1021 | m_log.WarnFormat( | 1074 | m_log.WarnFormat( |
1022 | "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", | 1075 | "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", |
1023 | uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, remoteEndPoint); | 1076 | uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, remoteEndPoint); |
1077 | lock (m_pendingCache) | ||
1078 | m_pendingCache.Remove(remoteEndPoint); | ||
1024 | } | 1079 | } |
1025 | 1080 | ||
1026 | // m_log.DebugFormat( | 1081 | // m_log.DebugFormat( |