public void Next() { //System.Console.WriteLine(state_.ToString()); //this.Log.OnEvent(state_.ToString()); if (!IsEnabled) { if (!IsLoggedOn) { return; } /* TODO * if (!state_.SentLogon) * { * this.Log.OnEvent("Initiated logout request"); * GenerateLogout(state_.LogoutReason); * } */ } /* TODO * if (!CheckSessionTime()) * { * Reset(); * return; * } */ if (!HasResponder) { return; } if (!state_.ReceivedLogon) { if (state_.ShouldSendLogon && IsTimeToGenerateLogon()) { if (GenerateLogon()) { this.Log.OnEvent("Initiated logon request"); } else { this.Log.OnEvent("Error during logon request initiation"); } } else if (state_.SentLogon && state_.LogonTimedOut()) { Disconnect("Timed out waiting for logon response"); } return; } if (0 == state_.HeartBtInt) { return; } if (state_.LogoutTimedOut()) { Disconnect("Timed out waiting for logout response"); } if (state_.WithinHeartbeat()) { return; } if (state_.TimedOut()) { Disconnect("Timed out waiting for heartbeat"); } else { if (state_.NeedTestRequest()) { GenerateTestRequest("TEST"); state_.TestRequestCounter += 1; this.Log.OnEvent("Sent test request TEST"); } else if (state_.NeedHeartbeat()) { GenerateHeartbeat(); } } }