aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs40
1 files changed, 30 insertions, 10 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index ad01135..f2e76d3 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -33,6 +33,7 @@ using OpenMetaverse;
33 33
34namespace OpenSim.Region.ClientStack.LindenUDP 34namespace OpenSim.Region.ClientStack.LindenUDP
35{ 35{
36 public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes);
36 public delegate void QueueEmpty(ThrottleOutPacketType category); 37 public delegate void QueueEmpty(ThrottleOutPacketType category);
37 38
38 public class LLUDPClient 39 public class LLUDPClient
@@ -41,6 +42,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
41 /// or removed, this number must also change</summary> 42 /// or removed, this number must also change</summary>
42 const int THROTTLE_CATEGORY_COUNT = 7; 43 const int THROTTLE_CATEGORY_COUNT = 7;
43 44
45 public event PacketStats OnPacketStats;
44 public event QueueEmpty OnQueueEmpty; 46 public event QueueEmpty OnQueueEmpty;
45 47
46 /// <summary>AgentID for this client</summary> 48 /// <summary>AgentID for this client</summary>
@@ -84,6 +86,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
84 /// <summary>Number of bytes received since the last acknowledgement was sent out. This is used 86 /// <summary>Number of bytes received since the last acknowledgement was sent out. This is used
85 /// to loosely follow the TCP delayed ACK algorithm in RFC 1122 (4.2.3.2)</summary> 87 /// to loosely follow the TCP delayed ACK algorithm in RFC 1122 (4.2.3.2)</summary>
86 public int BytesSinceLastACK; 88 public int BytesSinceLastACK;
89 /// <summary>Number of packets received from this client</summary>
90 public int PacketsReceived;
91 /// <summary>Number of packets sent to this client</summary>
92 public int PacketsSent;
93 /// <summary>Total byte count of unacked packets sent to this client</summary>
94 public int UnackedBytes;
95
96 /// <summary>Total number of received packets that we have reported to the OnPacketStats event(s)</summary>
97 private int m_packetsReceivedReported;
98 /// <summary>Total number of sent packets that we have reported to the OnPacketStats event(s)</summary>
99 private int m_packetsSentReported;
87 100
88 /// <summary>Throttle bucket for this agent's connection</summary> 101 /// <summary>Throttle bucket for this agent's connection</summary>
89 private readonly TokenBucket throttle; 102 private readonly TokenBucket throttle;
@@ -162,17 +175,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
162 175
163 public string GetStats() 176 public string GetStats()
164 { 177 {
178 // TODO: ???
165 return string.Format("{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}", 179 return string.Format("{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}",
166 0, 180 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
167 0, 181 }
168 0, 182
169 0, 183 public void SendPacketStats()
170 0, 184 {
171 0, 185 PacketStats callback = OnPacketStats;
172 0, 186 if (callback != null)
173 0, 187 {
174 0, 188 int newPacketsReceived = PacketsReceived - m_packetsReceivedReported;
175 0); 189 int newPacketsSent = PacketsSent - m_packetsSentReported;
190
191 callback(newPacketsReceived, newPacketsSent, UnackedBytes);
192
193 m_packetsReceivedReported += newPacketsReceived;
194 m_packetsSentReported += newPacketsSent;
195 }
176 } 196 }
177 197
178 public void SetThrottles(byte[] throttleData) 198 public void SetThrottles(byte[] throttleData)