aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index d3a8254..c1f4126 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -63,7 +63,14 @@ namespace OpenSim.Region.ClientStack
63 // private InventoryCache m_inventoryCache; 63 // private InventoryCache m_inventoryCache;
64 private int m_cachedTextureSerial = 0; 64 private int m_cachedTextureSerial = 0;
65 private Timer m_clientPingTimer; 65 private Timer m_clientPingTimer;
66
66 private int m_packetsReceived = 0; 67 private int m_packetsReceived = 0;
68 private int m_lastpacketsSentToScene = 0;
69 private int m_unAckedBytes = 0;
70
71 private int m_packetsSent = 0;
72 private int m_lastPacketsSent = 0;
73
67 private int m_probesWithNoIngressPackets = 0; 74 private int m_probesWithNoIngressPackets = 0;
68 private int m_lastPacketsReceived = 0; 75 private int m_lastPacketsReceived = 0;
69 private byte[] ZeroOutBuffer = new byte[4096]; 76 private byte[] ZeroOutBuffer = new byte[4096];
@@ -409,6 +416,7 @@ namespace OpenSim.Region.ClientStack
409 { 416 {
410 // this will normally trigger at least one packet (ping response) 417 // this will normally trigger at least one packet (ping response)
411 SendStartPingCheck(0); 418 SendStartPingCheck(0);
419
412 } 420 }
413 } 421 }
414 else 422 else
@@ -416,6 +424,7 @@ namespace OpenSim.Region.ClientStack
416 // Something received in the meantime - we can reset the counters 424 // Something received in the meantime - we can reset the counters
417 m_probesWithNoIngressPackets = 0; 425 m_probesWithNoIngressPackets = 0;
418 m_lastPacketsReceived = m_packetsReceived; 426 m_lastPacketsReceived = m_packetsReceived;
427
419 } 428 }
420 } 429 }
421 430
@@ -566,6 +575,9 @@ namespace OpenSim.Region.ClientStack
566 public event FriendActionDelegate OnDenyFriendRequest; 575 public event FriendActionDelegate OnDenyFriendRequest;
567 public event FriendshipTermination OnTerminateFriendship; 576 public event FriendshipTermination OnTerminateFriendship;
568 577
578 public event PacketStats OnPacketStats;
579
580
569 #region Scene/Avatar to Client 581 #region Scene/Avatar to Client
570 582
571 /// <summary> 583 /// <summary>
@@ -2245,6 +2257,7 @@ namespace OpenSim.Region.ClientStack
2245 try 2257 try
2246 { 2258 {
2247 m_needAck.Add(Pack.Header.Sequence, Pack); 2259 m_needAck.Add(Pack.Header.Sequence, Pack);
2260 m_unAckedBytes += Pack.ToBytes().Length;
2248 } 2261 }
2249 catch (Exception) // HACKY 2262 catch (Exception) // HACKY
2250 { 2263 {
@@ -2298,6 +2311,7 @@ namespace OpenSim.Region.ClientStack
2298 if (Pack.Header.Reliable) //DIRTY HACK 2311 if (Pack.Header.Reliable) //DIRTY HACK
2299 { 2312 {
2300 AddAck(Pack); // this adds the need to ack this packet later 2313 AddAck(Pack); // this adds the need to ack this packet later
2314
2301 2315
2302 if (Pack.Type != PacketType.PacketAck && Pack.Type != PacketType.LogoutRequest) 2316 if (Pack.Type != PacketType.PacketAck && Pack.Type != PacketType.LogoutRequest)
2303 { 2317 {
@@ -2343,6 +2357,7 @@ namespace OpenSim.Region.ClientStack
2343 { 2357 {
2344 foreach (uint ack in NewPack.Header.AckList) 2358 foreach (uint ack in NewPack.Header.AckList)
2345 { 2359 {
2360 m_unAckedBytes -= m_needAck[ack].ToBytes().Length;
2346 m_needAck.Remove(ack); 2361 m_needAck.Remove(ack);
2347 } 2362 }
2348 } 2363 }
@@ -2358,6 +2373,7 @@ namespace OpenSim.Region.ClientStack
2358 { 2373 {
2359 foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) 2374 foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets)
2360 { 2375 {
2376 m_unAckedBytes -= m_needAck[block.ID].ToBytes().Length;
2361 m_needAck.Remove(block.ID); 2377 m_needAck.Remove(block.ID);
2362 } 2378 }
2363 } 2379 }
@@ -2387,6 +2403,7 @@ namespace OpenSim.Region.ClientStack
2387 item.Incoming = false; 2403 item.Incoming = false;
2388 item.throttleType = throttlePacketType; // Packet throttle type 2404 item.throttleType = throttlePacketType; // Packet throttle type
2389 m_packetQueue.Enqueue(item); 2405 m_packetQueue.Enqueue(item);
2406 m_packetsSent++;
2390 } 2407 }
2391 2408
2392 # region Low Level Packet Methods 2409 # region Low Level Packet Methods
@@ -2472,8 +2489,21 @@ namespace OpenSim.Region.ClientStack
2472 2489
2473 protected void AckTimer_Elapsed(object sender, ElapsedEventArgs ea) 2490 protected void AckTimer_Elapsed(object sender, ElapsedEventArgs ea)
2474 { 2491 {
2492
2475 SendAcks(); 2493 SendAcks();
2476 ResendUnacked(); 2494 ResendUnacked();
2495 SendPacketStats();
2496
2497 }
2498
2499 protected void SendPacketStats()
2500 {
2501 if (OnPacketStats != null)
2502 {
2503 OnPacketStats(m_packetsReceived - m_lastPacketsReceived, m_packetsSent - m_lastPacketsSent, m_unAckedBytes);
2504 m_lastPacketsReceived = m_packetsReceived;
2505 m_lastPacketsSent = m_packetsSent;
2506 }
2477 } 2507 }
2478 2508
2479 #endregion 2509 #endregion