diff options
author | Melanie Thielker | 2008-07-22 17:58:42 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-07-22 17:58:42 +0000 |
commit | f112cebde2c1bc06108839acac82bc8addd7c506 (patch) | |
tree | 7f1e7fabf2fec74171d5982f09d847b47e20d7ca /OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | |
parent | * refactor: move new inventory service call by user server to OGS1 with all t... (diff) | |
download | opensim-SC_OLD-f112cebde2c1bc06108839acac82bc8addd7c506.zip opensim-SC_OLD-f112cebde2c1bc06108839acac82bc8addd7c506.tar.gz opensim-SC_OLD-f112cebde2c1bc06108839acac82bc8addd7c506.tar.bz2 opensim-SC_OLD-f112cebde2c1bc06108839acac82bc8addd7c506.tar.xz |
Refactor the packet scheduling out of ClientView. Add intelligent
resending, timeouts, packet discarding. Add notification event for
packet discarding. Add priority scheduling for packet queues.
Add outgoing duplicate detection facility. Correct packet sequencing.
Make provisions for automatic server side throttle adjustments (comes
in next installment)
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | 68 |
1 files changed, 46 insertions, 22 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs index 51dcde7..96f8ac6 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | |||
@@ -54,6 +54,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
54 | private Queue<LLQueItem> WindOutgoingPacketQueue; | 54 | private Queue<LLQueItem> WindOutgoingPacketQueue; |
55 | private Queue<LLQueItem> CloudOutgoingPacketQueue; | 55 | private Queue<LLQueItem> CloudOutgoingPacketQueue; |
56 | private Queue<LLQueItem> TaskOutgoingPacketQueue; | 56 | private Queue<LLQueItem> TaskOutgoingPacketQueue; |
57 | private Queue<LLQueItem> TaskLowpriorityPacketQueue; | ||
57 | private Queue<LLQueItem> TextureOutgoingPacketQueue; | 58 | private Queue<LLQueItem> TextureOutgoingPacketQueue; |
58 | private Queue<LLQueItem> AssetOutgoingPacketQueue; | 59 | private Queue<LLQueItem> AssetOutgoingPacketQueue; |
59 | 60 | ||
@@ -99,6 +100,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
99 | WindOutgoingPacketQueue = new Queue<LLQueItem>(); | 100 | WindOutgoingPacketQueue = new Queue<LLQueItem>(); |
100 | CloudOutgoingPacketQueue = new Queue<LLQueItem>(); | 101 | CloudOutgoingPacketQueue = new Queue<LLQueItem>(); |
101 | TaskOutgoingPacketQueue = new Queue<LLQueItem>(); | 102 | TaskOutgoingPacketQueue = new Queue<LLQueItem>(); |
103 | TaskLowpriorityPacketQueue = new Queue<LLQueItem>(); | ||
102 | TextureOutgoingPacketQueue = new Queue<LLQueItem>(); | 104 | TextureOutgoingPacketQueue = new Queue<LLQueItem>(); |
103 | AssetOutgoingPacketQueue = new Queue<LLQueItem>(); | 105 | AssetOutgoingPacketQueue = new Queue<LLQueItem>(); |
104 | 106 | ||
@@ -106,8 +108,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
106 | // Set up the throttle classes (min, max, current) in bytes | 108 | // Set up the throttle classes (min, max, current) in bytes |
107 | ResendThrottle = new LLPacketThrottle(5000, 100000, 16000); | 109 | ResendThrottle = new LLPacketThrottle(5000, 100000, 16000); |
108 | LandThrottle = new LLPacketThrottle(1000, 100000, 2000); | 110 | LandThrottle = new LLPacketThrottle(1000, 100000, 2000); |
109 | WindThrottle = new LLPacketThrottle(1000, 100000, 1000); | 111 | WindThrottle = new LLPacketThrottle(0, 100000, 0); |
110 | CloudThrottle = new LLPacketThrottle(1000, 100000, 1000); | 112 | CloudThrottle = new LLPacketThrottle(0, 100000, 0); |
111 | TaskThrottle = new LLPacketThrottle(1000, 800000, 3000); | 113 | TaskThrottle = new LLPacketThrottle(1000, 800000, 3000); |
112 | AssetThrottle = new LLPacketThrottle(1000, 800000, 1000); | 114 | AssetThrottle = new LLPacketThrottle(1000, 800000, 1000); |
113 | TextureThrottle = new LLPacketThrottle(1000, 800000, 4000); | 115 | TextureThrottle = new LLPacketThrottle(1000, 800000, 4000); |
@@ -149,6 +151,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
149 | return; | 151 | return; |
150 | } | 152 | } |
151 | 153 | ||
154 | if (item.Incoming) | ||
155 | { | ||
156 | SendQueue.PriorityEnqueue(item); | ||
157 | return; | ||
158 | } | ||
159 | |||
152 | lock (this) | 160 | lock (this) |
153 | { | 161 | { |
154 | switch (item.throttleType) | 162 | switch (item.throttleType) |
@@ -162,6 +170,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
162 | case ThrottleOutPacketType.Task: | 170 | case ThrottleOutPacketType.Task: |
163 | ThrottleCheck(ref TaskThrottle, ref TaskOutgoingPacketQueue, item); | 171 | ThrottleCheck(ref TaskThrottle, ref TaskOutgoingPacketQueue, item); |
164 | break; | 172 | break; |
173 | case ThrottleOutPacketType.LowpriorityTask: | ||
174 | ThrottleCheck(ref TaskThrottle, ref TaskLowpriorityPacketQueue, item); | ||
175 | break; | ||
165 | case ThrottleOutPacketType.Land: | 176 | case ThrottleOutPacketType.Land: |
166 | ThrottleCheck(ref LandThrottle, ref LandOutgoingPacketQueue, item); | 177 | ThrottleCheck(ref LandThrottle, ref LandOutgoingPacketQueue, item); |
167 | break; | 178 | break; |
@@ -178,7 +189,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
178 | default: | 189 | default: |
179 | // Acknowledgements and other such stuff should go directly to the blocking Queue | 190 | // Acknowledgements and other such stuff should go directly to the blocking Queue |
180 | // Throttling them may and likely 'will' be problematic | 191 | // Throttling them may and likely 'will' be problematic |
181 | SendQueue.Enqueue(item); | 192 | SendQueue.PriorityEnqueue(item); |
182 | break; | 193 | break; |
183 | } | 194 | } |
184 | } | 195 | } |
@@ -214,7 +225,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
214 | } | 225 | } |
215 | if (TaskOutgoingPacketQueue.Count > 0) | 226 | if (TaskOutgoingPacketQueue.Count > 0) |
216 | { | 227 | { |
217 | SendQueue.Enqueue(TaskOutgoingPacketQueue.Dequeue()); | 228 | SendQueue.PriorityEnqueue(TaskOutgoingPacketQueue.Dequeue()); |
229 | } | ||
230 | if (TaskLowpriorityPacketQueue.Count > 0) | ||
231 | { | ||
232 | SendQueue.Enqueue(TaskLowpriorityPacketQueue.Dequeue()); | ||
218 | } | 233 | } |
219 | if (TextureOutgoingPacketQueue.Count > 0) | 234 | if (TextureOutgoingPacketQueue.Count > 0) |
220 | { | 235 | { |
@@ -261,6 +276,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
261 | WindOutgoingPacketQueue.Count > 0 || | 276 | WindOutgoingPacketQueue.Count > 0 || |
262 | CloudOutgoingPacketQueue.Count > 0 || | 277 | CloudOutgoingPacketQueue.Count > 0 || |
263 | TaskOutgoingPacketQueue.Count > 0 || | 278 | TaskOutgoingPacketQueue.Count > 0 || |
279 | TaskLowpriorityPacketQueue.Count > 0 || | ||
264 | AssetOutgoingPacketQueue.Count > 0 || | 280 | AssetOutgoingPacketQueue.Count > 0 || |
265 | TextureOutgoingPacketQueue.Count > 0); | 281 | TextureOutgoingPacketQueue.Count > 0); |
266 | } | 282 | } |
@@ -319,11 +335,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
319 | TotalThrottle.Add(qpack.Packet.ToBytes().Length); | 335 | TotalThrottle.Add(qpack.Packet.ToBytes().Length); |
320 | CloudThrottle.Add(qpack.Packet.ToBytes().Length); | 336 | CloudThrottle.Add(qpack.Packet.ToBytes().Length); |
321 | } | 337 | } |
322 | if (TaskThrottle.UnderLimit() && TaskOutgoingPacketQueue.Count > 0) | 338 | if (TaskThrottle.UnderLimit() && (TaskOutgoingPacketQueue.Count > 0 || TaskLowpriorityPacketQueue.Count > 0)) |
323 | { | 339 | { |
324 | LLQueItem qpack = TaskOutgoingPacketQueue.Dequeue(); | 340 | LLQueItem qpack; |
325 | 341 | if(TaskOutgoingPacketQueue.Count > 0) | |
326 | SendQueue.Enqueue(qpack); | 342 | { |
343 | qpack = TaskOutgoingPacketQueue.Dequeue(); | ||
344 | SendQueue.PriorityEnqueue(qpack); | ||
345 | } | ||
346 | else | ||
347 | { | ||
348 | qpack = TaskLowpriorityPacketQueue.Dequeue(); | ||
349 | SendQueue.Enqueue(qpack); | ||
350 | } | ||
327 | TotalThrottle.Add(qpack.Packet.ToBytes().Length); | 351 | TotalThrottle.Add(qpack.Packet.ToBytes().Length); |
328 | TaskThrottle.Add(qpack.Packet.ToBytes().Length); | 352 | TaskThrottle.Add(qpack.Packet.ToBytes().Length); |
329 | } | 353 | } |
@@ -490,18 +514,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
490 | AssetThrottle.Throttle = tAsset; | 514 | AssetThrottle.Throttle = tAsset; |
491 | TotalThrottle.Throttle = tall; | 515 | TotalThrottle.Throttle = tall; |
492 | } | 516 | } |
493 | else if (tall < 1) | 517 | // else if (tall < 1) |
494 | { | 518 | // { |
495 | // client is stupid, penalize him by minning everything | 519 | // // client is stupid, penalize him by minning everything |
496 | ResendThrottle.Throttle = ResendThrottle.Min; | 520 | // ResendThrottle.Throttle = ResendThrottle.Min; |
497 | LandThrottle.Throttle = LandThrottle.Min; | 521 | // LandThrottle.Throttle = LandThrottle.Min; |
498 | WindThrottle.Throttle = WindThrottle.Min; | 522 | // WindThrottle.Throttle = WindThrottle.Min; |
499 | CloudThrottle.Throttle = CloudThrottle.Min; | 523 | // CloudThrottle.Throttle = CloudThrottle.Min; |
500 | TaskThrottle.Throttle = TaskThrottle.Min; | 524 | // TaskThrottle.Throttle = TaskThrottle.Min; |
501 | TextureThrottle.Throttle = TextureThrottle.Min; | 525 | // TextureThrottle.Throttle = TextureThrottle.Min; |
502 | AssetThrottle.Throttle = AssetThrottle.Min; | 526 | // AssetThrottle.Throttle = AssetThrottle.Min; |
503 | TotalThrottle.Throttle = TotalThrottle.Min; | 527 | // TotalThrottle.Throttle = TotalThrottle.Min; |
504 | } | 528 | // } |
505 | else | 529 | else |
506 | { | 530 | { |
507 | // we're over so figure out percentages and use those | 531 | // we're over so figure out percentages and use those |
@@ -516,7 +540,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
516 | TotalThrottle.Throttle = TotalThrottle.Max; | 540 | TotalThrottle.Throttle = TotalThrottle.Max; |
517 | } | 541 | } |
518 | // effectively wiggling the slider causes things reset | 542 | // effectively wiggling the slider causes things reset |
519 | ResetCounters(); | 543 | // ResetCounters(); // DO NOT reset, better to send less for one period than more |
520 | } | 544 | } |
521 | 545 | ||
522 | // See IPullStatsProvider | 546 | // See IPullStatsProvider |
@@ -540,4 +564,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
540 | return SendQueue.GetQueueArray(); | 564 | return SendQueue.GetQueueArray(); |
541 | } | 565 | } |
542 | } | 566 | } |
543 | } \ No newline at end of file | 567 | } |