/// <summary> /// initializes the RegistrationServer /// </summary> internal void initialize() { _ConfigManager = new ConfigManager(); //timer registration _timeoutTimer = new Timer(ConfigManager._ClientConfigObject.clientConnectionConfig.keepAliveInterval + 1000); _timeoutTimer.Elapsed += intervalTimer_Elapsed; _timeoutTimer.AutoReset = true; _timeoutTimer.Start(); LogManager.updateClientStatus(Post_KNV_Client.MainWindow.ClientStatus.disconnected); RequestHelloEvent(HelloRequestObject.createHelloFromClientConfig(ConfigManager._ClientConfigObject)); }
/// <summary> /// gets thrown every time the keepAliveInterval hits /// </summary> void intervalTimer_Elapsed(object sender, ElapsedEventArgs e) { if (ConfigManager._ClientConfigObject.clientRequestObject.isConnected) { LogManager.updateClientStatus(Post_KNV_Client.MainWindow.ClientStatus.waiting_for_ping); } if (timerRounds < 2) { timerRounds++; return; } timerRounds = 0; LogManager.writeLog("[RegistrationService] TIMEOUT: Requesting new HELLO"); ConfigManager._ClientConfigObject.clientRequestObject.isConnected = false; LogManager.updateClientStatus(Post_KNV_Client.MainWindow.ClientStatus.disconnected); RequestHelloEvent(HelloRequestObject.createHelloFromClientConfig(ConfigManager._ClientConfigObject)); }