fix : 더미클라 시간계산 버그 수정

This commit is contained in:
qornwh1
2026-03-02 16:15:05 +09:00
parent 5dc944d644
commit 8fcdd3494e
3 changed files with 67 additions and 5 deletions

View File

@@ -23,21 +23,25 @@ public class DummyClients
set;
get;
}
public int ReceivedCount
{
set;
get;
}
public double LastRttMs
{
set;
get;
}
public double TotalRttMs
{
set;
get;
}
public int RttCount
{
set;
@@ -48,7 +52,7 @@ public class DummyClients
{
this.clientId = clientId;
listener = new EventBasedNetListener();
manager = new NetManager(listener);
manager = new NetManager(listener);
listener.PeerConnectedEvent += netPeer =>
{
@@ -58,13 +62,16 @@ public class DummyClients
listener.NetworkReceiveEvent += (peer, reader, channel, deliveryMethod) =>
{
short code = reader.GetShort();
short bodyLength = reader.GetShort();
string? msg = reader.GetString();
string[] parts = msg.Split(':');
if (parts.Length == 3 && parts[0] == "ack" && parts[1] == "seq" && int.TryParse(parts[2], out int seq) && pendingPings.TryGetValue(seq, out long sentTick))
if (msg != null && msg.StartsWith("Echo seq:") &&
int.TryParse(msg.Substring("Echo seq:".Length), out int seq) &&
pendingPings.TryGetValue(seq, out long sentTick))
{
double rttMs = (Stopwatch.GetTimestamp() - sentTick) * 1000.0 / Stopwatch.Frequency;
LastRttMs = rttMs;
LastRttMs = rttMs;
TotalRttMs += rttMs;
RttCount++;
pendingPings.Remove(seq);