1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 07:06:30 +09:00

Resend bug fixed, unit tests expanded, misc cleanup

This commit is contained in:
lidgren
2010-06-01 18:28:14 +00:00
parent 09c241f428
commit 38c4a7a446
10 changed files with 120 additions and 39 deletions

View File

@@ -36,6 +36,8 @@ namespace Lidgren.Network
internal int m_sentBytes;
internal int m_receivedBytes;
internal int m_resentMessages;
internal NetConnectionStatistics(NetConnection conn)
{
m_connection = conn;
@@ -86,18 +88,32 @@ namespace Lidgren.Network
m_receivedMessages += numMessages;
}
[Conditional("DEBUG")]
internal void MessageResent()
{
m_resentMessages++;
}
public override string ToString()
{
StringBuilder bdr = new StringBuilder();
bdr.AppendLine("Average roundtrip time: " + NetTime.ToReadable(m_connection.m_averageRoundtripTime));
bdr.AppendLine("Sent " + m_sentBytes + " bytes in " + m_sentMessages + " messages in " + m_sentPackets + " packets");
bdr.AppendLine("Received " + m_receivedBytes + " bytes in " + m_receivedMessages + " messages in " + m_receivedPackets + " packets");
if (m_resentMessages > 0)
bdr.AppendLine("Resent messages: " + m_resentMessages);
int numUnsent = m_connection.m_unsentMessages.Count;
if (numUnsent > 0)
bdr.AppendLine("Unsent messages: " + numUnsent);
int numStored = m_connection.GetStoredMessagesCount();
if (numStored > 0)
bdr.AppendLine("Stored messages: " + numStored);
int numWithheld = m_connection.GetWithheldMessagesCount();
if (numWithheld > 0)
bdr.AppendLine("Withheld messages: " + numWithheld);
return bdr.ToString();
}
}