public Int64 Close() { Int64 currentCount = 0; try { IsConnectToDisconnected = true; Conn.LingerState = new LingerOption(false, 0); //Conn.Close(); Conn.Disconnect(true); Conn.Dispose(); Conn = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); } catch (Exception ex) { LastExceptionMessage = ex.Message; } finally { currentCount = DummyManager.DummyDisConnected(); } return(currentCount); }
void WriteTestResultToLog(DummyManager DummyMgr) { var testConfig = DummyManager.Config; UInt64 allDummyActionCount = 0; int failDummyCount = 0; int successDummyCount = 0; // 실패한 더미 출력하기 foreach (var dummy in DummyMgr.DummyList) { if (dummy.IsSuccessScenarioResult() == false) { ++failDummyCount; WriteLogFunc($"Fail. Dummy Index: {dummy.Index}, ActionCount: {dummy.CurActionRepeatCount}, Error:{dummy.GetScenarioResult()}"); } else { ++successDummyCount; } allDummyActionCount += dummy.CurActionRepeatCount; } var spantTime = DateTime.Now - DummyMgr.TestStartTime; var testResult = $"[{DateTime.Now}][{spantTime.TotalSeconds} s][{testConfig.ScenarioName}] Success:{successDummyCount}, Fail:{failDummyCount}"; WriteLogFunc(testResult); WriteLogFunc($"All Dummy Action Count: {allDummyActionCount}"); }
public ActionBase(TestCase testType, DummyManager dummyManager, TestConfig config) { TestType = testType; DummyManager = dummyManager; TestConfig = config; RegistCommonPacket(); }
protected override async Task <(int, bool, string)> TaskAsync(Dummy dummy, TestConfig config) { var currentCount = await Task.Run <Int64>(() => { var result = dummy.DisConnect(); return(result); }); DummyManager.EndProgress(); return(dummy.Index, true, $"Connected dummy count : {currentCount}"); }
public void Close() { try { Client.Close(); } catch (Exception ex) { LastExceptionMessage = ex.Message; } finally { DummyManager.DummyDisConnected(); } }
public (int, bool, string) CheckNtfRoomNewUser(Dummy dummy, PACKETID packetId, byte[] packetBuffer) { var body = MessagePackSerializer.Deserialize <PKTNtfRoomNewUser>(packetBuffer); var sender = DummyManager.GetDummy(dummy.Index); if (sender == null) { return(dummy.Index, false, $"해당 sender가 존재하지 않음({dummy.Index})"); } if (body.UserID == sender.GetUserID()) { return(dummy.Index, false, $"자신에게 노티됨({body.UserID})"); } return(dummy.Index, true, ""); }
public async Task <(bool, string)> ConnectAsync(string ip, int port) { try { Client = null; Client = new TcpClient(); Client.NoDelay = true; await Client.ConnectAsync(ip, port); DummyManager.DummyConnected(); return(true, ""); } catch (Exception ex) { LastExceptionMessage = ex.Message; return(false, ex.Message); } }
public Int64 Close() { Int64 currentCount = 0; try { Client.Close(); } catch (Exception ex) { LastExceptionMessage = ex.Message; } finally { currentCount = DummyManager.DummyDisConnected(); } return(currentCount); }
public async Task <(bool, int, string)> ConnectAsync(string ip, int port) { try { Conn.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); await Conn.ConnectAsync(ip, port); Conn.NoDelay = true; DummyManager.DummyConnected(); IsConnectToDisconnected = false; return(true, 0, ""); } catch (Exception ex) { var sockEx = (SocketException)ex; LastExceptionMessage = sockEx.Message; return(false, sockEx.ErrorCode, sockEx.Message); } }
public ActionRoomChat(DummyManager dummyMananger, TestConfig config) : base(TestCase.ACTION_ROOM_CHAT, dummyMananger, config) { }
public ActionRoomLeave(DummyManager dummyMananger, TestConfig config) : base(TestCase.ACTION_ROOM_LEAVE, dummyMananger, config) { RegistRecvFunc(PACKETID.RES_ROOM_LEAVE, CheckResRoomLeave, true); }
public ActionLogin(DummyManager dummyMananger, TestConfig config) : base(TestCase.ACTION_LOGIN, dummyMananger, config) { RegistRecvFunc(PACKETID.RES_LOGIN, CheckResLogin, true); }
public void Init(DummyManager dummyMgr, Action <string> logFunc) { DummyMgr = dummyMgr; WriteLogFunc = logFunc; }
public ActionDisconnect(DummyManager dummyManager, TestConfig config) : base(TestCase.ACTION_DISCONNECT, dummyManager, config) { }
public ActionConnect(DummyManager dummyManange, TestConfig config) : base(TestCase.ACTION_CONNECT, dummyManange, config) { }
public ActionRoomEnter(DummyManager dummyMananger, TestConfig config) : base(TestCase.ACTION_ROOM_ENTER, dummyMananger, config) { RegistRecvFunc(PACKETID.RES_ROOM_ENTER, CheckResRoomEnter, true); }