aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs70
1 files changed, 63 insertions, 7 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 653f648..6fd782a 100755
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -274,10 +274,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
274 /// <summary>The measured resolution of Environment.TickCount</summary> 274 /// <summary>The measured resolution of Environment.TickCount</summary>
275 public readonly float TickCountResolution; 275 public readonly float TickCountResolution;
276 276
277 /// <summary>Number of prim updates to put on the queue each time the
278 /// OnQueueEmpty event is triggered for updates</summary>
279 public readonly int PrimUpdatesPerCallback;
280
281 /// <summary>Number of texture packets to put on the queue each time the 277 /// <summary>Number of texture packets to put on the queue each time the
282 /// OnQueueEmpty event is triggered for textures</summary> 278 /// OnQueueEmpty event is triggered for textures</summary>
283 public readonly int TextureSendLimit; 279 public readonly int TextureSendLimit;
@@ -440,7 +436,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
440 m_recvBufferSize = config.GetInt("client_socket_rcvbuf_size", 0); 436 m_recvBufferSize = config.GetInt("client_socket_rcvbuf_size", 0);
441 sceneThrottleBps = config.GetInt("scene_throttle_max_bps", 0); 437 sceneThrottleBps = config.GetInt("scene_throttle_max_bps", 0);
442 438
443 PrimUpdatesPerCallback = config.GetInt("PrimUpdatesPerCallback", 100);
444 TextureSendLimit = config.GetInt("TextureSendLimit", 20); 439 TextureSendLimit = config.GetInt("TextureSendLimit", 20);
445 440
446 m_defaultRTO = config.GetInt("DefaultRTO", 0); 441 m_defaultRTO = config.GetInt("DefaultRTO", 0);
@@ -451,7 +446,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
451 } 446 }
452 else 447 else
453 { 448 {
454 PrimUpdatesPerCallback = 100;
455 TextureSendLimit = 20; 449 TextureSendLimit = 20;
456 m_ackTimeout = 1000 * 60; // 1 minute 450 m_ackTimeout = 1000 * 60; // 1 minute
457 m_pausedAckTimeout = 1000 * 300; // 5 minutes 451 m_pausedAckTimeout = 1000 * 300; // 5 minutes
@@ -934,11 +928,73 @@ namespace OpenSim.Region.ClientStack.LindenUDP
934 #endregion Queue or Send 928 #endregion Queue or Send
935 } 929 }
936 930
931 public unsafe UDPPacketBuffer ZeroEncode(UDPPacketBuffer input)
932 {
933 UDPPacketBuffer zb = GetNewUDPBuffer(null);
934 int srclen = input.DataLength;
935 byte[] src = input.Data;
936 byte[] dest = zb.Data;
937
938 int zerolen = 6;
939 byte zerocount = 0;
940
941 for (int i = zerolen; i < srclen; i++)
942 {
943 if (src[i] == 0x00)
944 {
945 zerocount++;
946 if (zerocount == 0)
947 {
948 dest[zerolen++] = 0x00;
949 dest[zerolen++] = 0xff;
950 zerocount++;
951 }
952 }
953 else
954 {
955 if (zerocount != 0)
956 {
957 dest[zerolen++] = 0x00;
958 dest[zerolen++] = zerocount;
959 zerocount = 0;
960 }
961
962 dest[zerolen++] = src[i];
963 }
964 }
965
966 if (zerocount != 0)
967 {
968 dest[zerolen++] = 0x00;
969 dest[zerolen++] = zerocount;
970 }
971
972 if(zerolen >= srclen)
973 {
974 FreeUDPBuffer(zb);
975
976 src[0] &= unchecked((byte)~Helpers.MSG_ZEROCODED);
977 return input;
978 }
979
980 Buffer.BlockCopy(src, 0, dest, 0, 6);
981
982 zb.RemoteEndPoint = input.RemoteEndPoint;
983 zb.DataLength = zerolen;
984
985 FreeUDPBuffer(input);
986
987 return zb;
988 }
989
937 public void SendUDPPacket( 990 public void SendUDPPacket(
938 LLUDPClient udpClient, UDPPacketBuffer buffer, ThrottleOutPacketType category, UnackedPacketMethod method, bool forcequeue) 991 LLUDPClient udpClient, UDPPacketBuffer buffer, ThrottleOutPacketType category, UnackedPacketMethod method, bool forcequeue, bool zerocode)
939 { 992 {
940 bool highPriority = false; 993 bool highPriority = false;
941 994
995 if(zerocode)
996 buffer = ZeroEncode(buffer);
997
942 if (category != ThrottleOutPacketType.Unknown && (category & ThrottleOutPacketType.HighPriority) != 0) 998 if (category != ThrottleOutPacketType.Unknown && (category & ThrottleOutPacketType.HighPriority) != 0)
943 { 999 {
944 category = (ThrottleOutPacketType)((int)category & 127); 1000 category = (ThrottleOutPacketType)((int)category & 127);