feat : 더미 플레이어 구현 / 더미클라 서비스 에코용, 더미 플레이어용 분기
This commit is contained in:
@@ -3,9 +3,9 @@ using Serilog;
|
||||
|
||||
namespace ClientTester.EchoDummyService;
|
||||
|
||||
public class DummyClientService
|
||||
public class EchoDummyClientService
|
||||
{
|
||||
private readonly List<DummyClients> clients;
|
||||
private readonly List<EchoDummyClients> clients;
|
||||
private readonly int sendInterval;
|
||||
|
||||
// 유닛 테스트용 (n패킷 시간체크)
|
||||
@@ -24,10 +24,10 @@ public class DummyClientService
|
||||
// 모든거 강종
|
||||
public event Action? OnAllDisconnected;
|
||||
|
||||
public DummyClientService(int count, string ip, int port, string key, int sendIntervalMs = 1000)
|
||||
public EchoDummyClientService(int count, string ip, int port, string key, int sendIntervalMs = 1000)
|
||||
{
|
||||
sendInterval = sendIntervalMs;
|
||||
clients = Enumerable.Range(0, count).Select(i => new DummyClients(i, ip, port, key)).ToList();
|
||||
clients = Enumerable.Range(0, count).Select(i => new EchoDummyClients(i, ip, port, key)).ToList();
|
||||
|
||||
Log.Information("[SERVICE] {Count}개 클라이언트 생성 → {Ip}:{Port}", count, ip, port);
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public class DummyClientService
|
||||
{
|
||||
if (IsTest)
|
||||
{
|
||||
foreach (DummyClients c in clients)
|
||||
foreach (EchoDummyClients c in clients)
|
||||
{
|
||||
c.TestCount = TestCount;
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class DummyClientService
|
||||
{
|
||||
while (!ct.IsCancellationRequested)
|
||||
{
|
||||
foreach (DummyClients c in clients)
|
||||
foreach (EchoDummyClients c in clients)
|
||||
{
|
||||
c.PollEvents();
|
||||
}
|
||||
@@ -72,15 +72,6 @@ public class DummyClientService
|
||||
|
||||
private async Task SendLoopAsync(CancellationToken ct)
|
||||
{
|
||||
try
|
||||
{
|
||||
await Task.Delay(500, ct);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int tick = 0;
|
||||
|
||||
while (!ct.IsCancellationRequested)
|
||||
@@ -88,7 +79,7 @@ public class DummyClientService
|
||||
int sent = 0;
|
||||
int total = clients.Count;
|
||||
|
||||
foreach (DummyClients client in clients)
|
||||
foreach (EchoDummyClients client in clients)
|
||||
{
|
||||
client.SendPing();
|
||||
if (client.peer != null)
|
||||
@@ -132,7 +123,7 @@ public class DummyClientService
|
||||
|
||||
double totalAvgRtt = 0;
|
||||
|
||||
foreach (DummyClients c in clients)
|
||||
foreach (EchoDummyClients c in clients)
|
||||
{
|
||||
NetStatistics? stats = c.peer?.Statistics;
|
||||
long loss = stats?.PacketLoss ?? 0;
|
||||
@@ -166,7 +157,7 @@ public class DummyClientService
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
foreach (DummyClients c in clients)
|
||||
foreach (EchoDummyClients c in clients)
|
||||
{
|
||||
c.Stop();
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using Serilog;
|
||||
|
||||
namespace ClientTester.EchoDummyService;
|
||||
|
||||
public class DummyClients
|
||||
public class EchoDummyClients
|
||||
{
|
||||
private NetManager manager;
|
||||
private EventBasedNetListener listener;
|
||||
@@ -58,7 +58,7 @@ public class DummyClients
|
||||
get;
|
||||
}
|
||||
|
||||
public DummyClients(int clientId, string ip, int port, string key)
|
||||
public EchoDummyClients(int clientId, string ip, int port, string key)
|
||||
{
|
||||
this.clientId = clientId;
|
||||
listener = new EventBasedNetListener();
|
||||
@@ -131,7 +131,7 @@ public class DummyClients
|
||||
|
||||
PacketHeader packetHeader = new PacketHeader();
|
||||
packetHeader.Code = 0;
|
||||
packetHeader.BodyLength = $"Echo seq:{seq}".Length;
|
||||
packetHeader.BodyLength = (ushort)$"Echo seq:{seq}".Length;
|
||||
writer.Put((short)packetHeader.Code);
|
||||
writer.Put((short)packetHeader.BodyLength);
|
||||
writer.Put($"Echo seq:{seq}");
|
||||
6
ClientTester/EchoClientTester/EchoDummyService/Map.cs
Normal file
6
ClientTester/EchoClientTester/EchoDummyService/Map.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace ClientTester.EchoDummyService;
|
||||
|
||||
public class Map
|
||||
{
|
||||
// TODO : 맵 정보 필요
|
||||
}
|
||||
Reference in New Issue
Block a user