aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-22 19:01:53 +0000
committerTeravus Ovares2007-11-22 19:01:53 +0000
commit999eec603ea62056f599761b90c7a0510336cdd9 (patch)
tree436e7a97ec06ab22b2378d24c5feb5296cfd7a6a /OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
parent* removed erroneous comments (diff)
downloadopensim-SC_OLD-999eec603ea62056f599761b90c7a0510336cdd9.zip
opensim-SC_OLD-999eec603ea62056f599761b90c7a0510336cdd9.tar.gz
opensim-SC_OLD-999eec603ea62056f599761b90c7a0510336cdd9.tar.bz2
opensim-SC_OLD-999eec603ea62056f599761b90c7a0510336cdd9.tar.xz
Created a client driven packet throttler. The sim now respects the client's network throttle settings but does sanity checks to avoid too little(nothing gets sent) or too much(the sim crashes) data.
* Consider this experimental.. however, it looks very promising.
Diffstat (limited to 'OpenSim/Region/ClientStack/ClientView.PacketQueue.cs')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.PacketQueue.cs50
1 files changed, 47 insertions, 3 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
index 179d02a..3ce3d8c 100644
--- a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
+++ b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
@@ -40,6 +40,17 @@ namespace OpenSim.Region.ClientStack
40 public partial class ClientView 40 public partial class ClientView
41 { 41 {
42 protected BlockingQueue<QueItem> PacketQueue; 42 protected BlockingQueue<QueItem> PacketQueue;
43
44 protected Queue<QueItem> IncomingPacketQueue;
45 protected Queue<QueItem> OutgoingPacketQueue;
46 protected Queue<QueItem> ResendOutgoingPacketQueue;
47 protected Queue<QueItem> LandOutgoingPacketQueue;
48 protected Queue<QueItem> WindOutgoingPacketQueue;
49 protected Queue<QueItem> CloudOutgoingPacketQueue;
50 protected Queue<QueItem> TaskOutgoingPacketQueue;
51 protected Queue<QueItem> TextureOutgoingPacketQueue;
52 protected Queue<QueItem> AssetOutgoingPacketQueue;
53
43 protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); 54 protected Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
44 protected Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); 55 protected Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
45 56
@@ -213,7 +224,39 @@ namespace OpenSim.Region.ClientStack
213 QueItem item = new QueItem(); 224 QueItem item = new QueItem();
214 item.Packet = NewPack; 225 item.Packet = NewPack;
215 item.Incoming = false; 226 item.Incoming = false;
216 PacketQueue.Enqueue(item); 227 item.throttleType = throttlePacketType; // Packet throttle type
228 switch (throttlePacketType)
229 {
230 case ThrottleOutPacketType.Resend:
231 ResendOutgoingPacketQueue.Enqueue(item);
232 break;
233 case ThrottleOutPacketType.Texture:
234 TextureOutgoingPacketQueue.Enqueue(item);
235 break;
236 case ThrottleOutPacketType.Task:
237 TaskOutgoingPacketQueue.Enqueue(item);
238 break;
239 case ThrottleOutPacketType.Land:
240 LandOutgoingPacketQueue.Enqueue(item);
241 break;
242 case ThrottleOutPacketType.Asset:
243 AssetOutgoingPacketQueue.Enqueue(item);
244 break;
245 case ThrottleOutPacketType.Cloud:
246 CloudOutgoingPacketQueue.Enqueue(item);
247 break;
248 case ThrottleOutPacketType.Wind:
249 WindOutgoingPacketQueue.Enqueue(item);
250 break;
251
252 default:
253
254 // Acknowledgements and other such stuff should go directly to the blocking Queue
255 // Throttling them may and likely 'will' be problematic
256 PacketQueue.Enqueue(item);
257 break;
258 }
259 //OutgoingPacketQueue.Enqueue(item);
217 } 260 }
218 261
219 # region Low Level Packet Methods 262 # region Low Level Packet Methods
@@ -228,7 +271,7 @@ namespace OpenSim.Region.ClientStack
228 ack_it.Packets[0].ID = Pack.Header.Sequence; 271 ack_it.Packets[0].ID = Pack.Header.Sequence;
229 ack_it.Header.Reliable = false; 272 ack_it.Header.Reliable = false;
230 273
231 OutPacket(ack_it, ThrottleOutPacketType.Task); 274 OutPacket(ack_it, ThrottleOutPacketType.Unknown);
232 } 275 }
233 /* 276 /*
234 if (Pack.Header.Reliable) 277 if (Pack.Header.Reliable)
@@ -289,7 +332,7 @@ namespace OpenSim.Region.ClientStack
289 } 332 }
290 333
291 acks.Header.Reliable = false; 334 acks.Header.Reliable = false;
292 OutPacket(acks, ThrottleOutPacketType.Task); 335 OutPacket(acks, ThrottleOutPacketType.Unknown);
293 336
294 PendingAcks.Clear(); 337 PendingAcks.Clear();
295 } 338 }
@@ -314,6 +357,7 @@ namespace OpenSim.Region.ClientStack
314 357
315 public Packet Packet; 358 public Packet Packet;
316 public bool Incoming; 359 public bool Incoming;
360 public ThrottleOutPacketType throttleType;
317 } 361 }
318 362
319 #endregion 363 #endregion