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')
-rwxr-xr-xOpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs29
1 files changed, 14 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 2863b8d..6994efb 100755
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -880,8 +880,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
880 // If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will 880 // If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will
881 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object 881 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object
882 // packet so that it isn't sent before a queued update packet. 882 // packet so that it isn't sent before a queued update packet.
883 bool requestQueue = type == PacketType.KillObject; 883 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, highPriority))
884 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority))
885 { 884 {
886 SendPacketFinal(outgoingPacket); 885 SendPacketFinal(outgoingPacket);
887 return true; 886 return true;
@@ -952,7 +951,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
952 } 951 }
953 952
954 public void SendUDPPacket( 953 public void SendUDPPacket(
955 LLUDPClient udpClient, UDPPacketBuffer buffer, ThrottleOutPacketType category, UnackedPacketMethod method, bool forcequeue, bool zerocode) 954 LLUDPClient udpClient, UDPPacketBuffer buffer, ThrottleOutPacketType category, UnackedPacketMethod method, bool zerocode)
956 { 955 {
957 bool highPriority = false; 956 bool highPriority = false;
958 957
@@ -971,7 +970,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
971 if ((outgoingPacket.Buffer.Data[0] & Helpers.MSG_RELIABLE) != 0) 970 if ((outgoingPacket.Buffer.Data[0] & Helpers.MSG_RELIABLE) != 0)
972 outgoingPacket.UnackedMethod = ((method == null) ? delegate (OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method); 971 outgoingPacket.UnackedMethod = ((method == null) ? delegate (OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method);
973 972
974 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, forcequeue, highPriority)) 973 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, highPriority))
975 SendPacketFinal(outgoingPacket); 974 SendPacketFinal(outgoingPacket);
976 } 975 }
977 976
@@ -991,7 +990,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
991 if ((outgoingPacket.Buffer.Data[0] & Helpers.MSG_RELIABLE) != 0) 990 if ((outgoingPacket.Buffer.Data[0] & Helpers.MSG_RELIABLE) != 0)
992 outgoingPacket.UnackedMethod = delegate (OutgoingPacket oPacket) { ResendUnacked(oPacket); }; 991 outgoingPacket.UnackedMethod = delegate (OutgoingPacket oPacket) { ResendUnacked(oPacket); };
993 992
994 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false, highPriority)) 993 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, highPriority))
995 SendPacketFinal(outgoingPacket); 994 SendPacketFinal(outgoingPacket);
996 } 995 }
997 996
@@ -1056,11 +1055,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1056 1055
1057 data[7] = udpClient.CurrentPingSequence++; 1056 data[7] = udpClient.CurrentPingSequence++;
1058 // older seq number of our un ack packets, so viewers could clean deduplication lists TODO 1057 // older seq number of our un ack packets, so viewers could clean deduplication lists TODO
1059 //Utils.UIntToBytes(0, data, 8); 1058 Utils.UIntToBytes(udpClient.NeedAcks.Oldest(), data, 8);
1060 data[8] = 0;
1061 data[9] = 0;
1062 data[10] = 0;
1063 data[11] = 0;
1064 1059
1065 buf.DataLength = 12; 1060 buf.DataLength = 12;
1066 SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown); 1061 SendUDPPacket(udpClient, buf, ThrottleOutPacketType.Unknown);
@@ -1140,7 +1135,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1140 1135
1141 // Bump up the resend count on this packet 1136 // Bump up the resend count on this packet
1142 Interlocked.Increment(ref outgoingPacket.ResendCount); 1137 Interlocked.Increment(ref outgoingPacket.ResendCount);
1143
1144 // Requeue or resend the packet 1138 // Requeue or resend the packet
1145 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false)) 1139 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, false))
1146 SendPacketFinal(outgoingPacket); 1140 SendPacketFinal(outgoingPacket);
@@ -1162,7 +1156,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1162 return; 1156 return;
1163 LLUDPClient udpClient = outgoingPacket.Client; 1157 LLUDPClient udpClient = outgoingPacket.Client;
1164 if (!udpClient.IsConnected) 1158 if (!udpClient.IsConnected)
1159 {
1160 FreeUDPBuffer(buffer);
1165 return; 1161 return;
1162 }
1166 1163
1167 byte flags = buffer.Data[0]; 1164 byte flags = buffer.Data[0];
1168 bool isResend = (flags & Helpers.MSG_RESENT) != 0; 1165 bool isResend = (flags & Helpers.MSG_RESENT) != 0;
@@ -1172,7 +1169,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1172 int dataLength = buffer.DataLength; 1169 int dataLength = buffer.DataLength;
1173 1170
1174 // only append acks on plain reliable messages 1171 // only append acks on plain reliable messages
1175 if (flags == Helpers.MSG_RELIABLE) 1172 if (flags == Helpers.MSG_RELIABLE && outgoingPacket.UnackedMethod == null)
1176 { 1173 {
1177 // Keep appending ACKs until there is no room left in the buffer or there are 1174 // Keep appending ACKs until there is no room left in the buffer or there are
1178 // no more ACKs to append 1175 // no more ACKs to append
@@ -1211,10 +1208,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1211 // Stats tracking 1208 // Stats tracking
1212 Interlocked.Increment(ref udpClient.PacketsSent); 1209 Interlocked.Increment(ref udpClient.PacketsSent);
1213 PacketsSentCount++; 1210 PacketsSentCount++;
1211
1214 SyncSend(buffer); 1212 SyncSend(buffer);
1215 1213
1216 // Keep track of when this packet was sent out (right now) 1214 // Keep track of when this packet was sent out (right now)
1217 outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; 1215 int enow = Environment.TickCount & Int32.MaxValue;
1216 Interlocked.Exchange(ref outgoingPacket.TickCount, enow);
1218 1217
1219 if (outgoingPacket.UnackedMethod == null) 1218 if (outgoingPacket.UnackedMethod == null)
1220 FreeUDPBuffer(buffer); 1219 FreeUDPBuffer(buffer);
@@ -1935,7 +1934,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1935 { 1934 {
1936 m_resendUnacked = true; 1935 m_resendUnacked = true;
1937 m_elapsedMSOutgoingPacketHandler = 0.0; 1936 m_elapsedMSOutgoingPacketHandler = 0.0;
1938 m_elapsed100MSOutgoingPacketHandler += 1; 1937 ++m_elapsed100MSOutgoingPacketHandler;
1939 } 1938 }
1940 1939
1941 // Check for pending outgoing ACKs every 500ms 1940 // Check for pending outgoing ACKs every 500ms
@@ -1943,7 +1942,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1943 { 1942 {
1944 m_sendAcks = true; 1943 m_sendAcks = true;
1945 m_elapsed100MSOutgoingPacketHandler = 0; 1944 m_elapsed100MSOutgoingPacketHandler = 0;
1946 m_elapsed500MSOutgoingPacketHandler += 1; 1945 ++m_elapsed500MSOutgoingPacketHandler;
1947 } 1946 }
1948 1947
1949 // Send pings to clients every 5000ms 1948 // Send pings to clients every 5000ms