예제 #1
1
파일: IdleState.cs 프로젝트: buskovic/cobas
            /// <summary>
            /// Handler koji se poziva kad istekne timer
            /// Ovo je 10 sekundni timer starta se ukoliko kao odgovor na ENQ ne dobijemo ACK vec neto drugo
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            /// <param name="protocol"></param>
            private void TimeoutUnknownHandler(object sender, ElapsedEventArgs e, Protocol protocol)
            {
                log.Debug("IdleState:TimeoutUnknownHandler");

                try
                {
                    protocol.AckTimer.Elapsed -= _timerHandler;
                    protocol.SendEot();
                    protocol.ChangeState(Idle);

                    CleanState();
                    protocol._waitHandle.Set();

                    log.Error("IdleState:TimeoutUnknownHandler:Answer is not [ACK]");
                }
                catch (Exception ex)
                {
                    log.Error(ex.ToString());
                    throw;
                }
            }
예제 #2
1
파일: IdleState.cs 프로젝트: buskovic/cobas
            /// <summary>
            /// Handler koji se poziva kad istekne timer
            /// Ovo je 15 sekundni timer starta se kad posaljemo ENQ
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            /// <param name="protocol"></param>
            private void TimeoutHandler(object sender, ElapsedEventArgs e, Protocol protocol)
            {
                log.Debug("IdleState:TimeoutHandler");

                try
                {
                    protocol.AckTimer.Elapsed -= _timerHandler;
                    protocol.SendEot();

                    CleanState();
                    protocol._waitHandle.Set();
                    log.Error("IdleState:TimeoutHandler:No answer from host");
                }
                catch (Exception ex)
                {
                    log.Error(ex.ToString());
                    throw;
                }
            }