aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP
diff options
context:
space:
mode:
authorMelanie Thielker2009-05-04 02:24:30 +0000
committerMelanie Thielker2009-05-04 02:24:30 +0000
commitb44a56e0b414c3b68624954f1e36ed49e290b0b8 (patch)
tree51dfe3aba5a8cb116d214c703e728d0537810126 /OpenSim/Region/ClientStack/LindenUDP
parentCreate a working configuration hook to allow LLClient parameters from (diff)
downloadopensim-SC-b44a56e0b414c3b68624954f1e36ed49e290b0b8.zip
opensim-SC-b44a56e0b414c3b68624954f1e36ed49e290b0b8.tar.gz
opensim-SC-b44a56e0b414c3b68624954f1e36ed49e290b0b8.tar.bz2
opensim-SC-b44a56e0b414c3b68624954f1e36ed49e290b0b8.tar.xz
Add a parameter that limits the max size of the outbound packet. Defaulted
at 1400 since the headers get added to that (32 bytes plus UDP headers)
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs47
1 files changed, 41 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 0369369..7cd324c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -140,6 +140,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
140 protected int m_primTerseUpdateRate = 10; 140 protected int m_primTerseUpdateRate = 10;
141 protected int m_primFullUpdateRate = 14; 141 protected int m_primFullUpdateRate = 14;
142 142
143 protected int m_packetMTU = 1400;
144
143 // LLClientView Only 145 // LLClientView Only
144 public delegate void BinaryGenericMessage(Object sender, string method, byte[][] args); 146 public delegate void BinaryGenericMessage(Object sender, string method, byte[][] args);
145 147
@@ -537,6 +539,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
537 m_primFullUpdateRate = clientConfig.GetInt("FullUpdateRate", 539 m_primFullUpdateRate = clientConfig.GetInt("FullUpdateRate",
538 m_primFullUpdateRate); 540 m_primFullUpdateRate);
539 541
542 m_packetMTU = clientConfig.GetInt("PacketMTU", 1400);
540 } 543 }
541 } 544 }
542 545
@@ -3013,9 +3016,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3013 outPacket.RegionData.TimeDilation = 3016 outPacket.RegionData.TimeDilation =
3014 (ushort)(Scene.TimeDilation * ushort.MaxValue); 3017 (ushort)(Scene.TimeDilation * ushort.MaxValue);
3015 3018
3016 int count = m_primFullUpdates.Count; 3019 int max = m_primFullUpdates.Count;
3017 if (count > m_primFullUpdatesPerPacket) 3020 if (max > m_primFullUpdatesPerPacket)
3018 count = m_primFullUpdatesPerPacket; 3021 max = m_primFullUpdatesPerPacket;
3022
3023 int count = 0;
3024 int size = 0;
3025
3026 byte[] zerobuffer = new byte[1024];
3027 byte[] blockbuffer = new byte[1024];
3028
3029 for (count = 0 ; count < max ; count++)
3030 {
3031 int length = 0;
3032 m_primFullUpdates[count].ToBytes(blockbuffer, ref length);
3033 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
3034 if (size + length > m_packetMTU)
3035 break;
3036 size += length;
3037 }
3019 3038
3020 outPacket.ObjectData = 3039 outPacket.ObjectData =
3021 new ObjectUpdatePacket.ObjectDataBlock[count]; 3040 new ObjectUpdatePacket.ObjectDataBlock[count];
@@ -3083,9 +3102,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3083 outPacket.RegionData.TimeDilation = 3102 outPacket.RegionData.TimeDilation =
3084 (ushort)(Scene.TimeDilation * ushort.MaxValue); 3103 (ushort)(Scene.TimeDilation * ushort.MaxValue);
3085 3104
3086 int count = m_primTerseUpdates.Count; 3105 int max = m_primTerseUpdates.Count;
3087 if (count > m_primTerseUpdatesPerPacket) 3106 if (max > m_primTerseUpdatesPerPacket)
3088 count = m_primTerseUpdatesPerPacket; 3107 max = m_primTerseUpdatesPerPacket;
3108
3109 int count = 0;
3110 int size = 0;
3111
3112 byte[] zerobuffer = new byte[1024];
3113 byte[] blockbuffer = new byte[1024];
3114
3115 for (count = 0 ; count < max ; count++)
3116 {
3117 int length = 0;
3118 m_primTerseUpdates[count].ToBytes(blockbuffer, ref length);
3119 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
3120 if (size + length > m_packetMTU)
3121 break;
3122 size += length;
3123 }
3089 3124
3090 outPacket.ObjectData = 3125 outPacket.ObjectData =
3091 new ImprovedTerseObjectUpdatePacket. 3126 new ImprovedTerseObjectUpdatePacket.