Changeset 6805 in ntrip for trunk/BNC/src/latencychecker.cpp


Ignore:
Timestamp:
Apr 30, 2015, 3:16:10 PM (9 years ago)
Author:
weber
Message:

Bug in stream Failure/Recovery message fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/latencychecker.cpp

    r6769 r6805  
    154154
    155155  _checkTime = QDateTime::currentDateTime();
    156 
    157   _begDateOut = _checkTime.toUTC().date().toString("yy-MM-dd"); // weber
    158   _begTimeOut = _checkTime.toUTC().time().toString("hh:mm:ss");
    159 
    160156  _decodeSucc = QDateTime::currentDateTime();
    161157
    162   _decodeStart = QDateTime::currentDateTime();
    163158  _decodeStop = QDateTime::currentDateTime();
     159
     160  _begDateTimeOut = QDateTime::currentDateTime();
     161  _endDateTimeOut = QDateTime::currentDateTime();
     162
     163  _fromReconnect = false;
    164164 
    165165}
     
    178178  // Begin outage threshold
    179179  // ----------------------
     180  if (!_fromReconnect) {
     181    _endDateTimeOut = QDateTime::currentDateTime();
     182  }
     183  _fromReconnect = true;
     184
    180185  if ( _decodeStop.isValid() ) {
    181     if ( _decodeStop.secsTo(QDateTime::currentDateTime()) >  _adviseFail * 60 ) {
     186    _begDateTimeOut = QDateTime::currentDateTime();
     187    if ( _endDateTimeOut.secsTo(QDateTime::currentDateTime()) >  _adviseFail * 60 ) {
     188      _begDateOut = _endDateTimeOut.toUTC().date().toString("yy-MM-dd");
     189      _begTimeOut = _endDateTimeOut.toUTC().time().toString("hh:mm:ss");
     190      emit(newMessage((_staID + ": Failure threshold exceeded, outage since "
     191                    + _begDateOut + " " + _begTimeOut + " UTC").toAscii(), true));
     192      callScript(("Begin_Outage"
     193                    + _begDateOut + " " + _begTimeOut + " UTC").toAscii());
    182194      _decodeStop.setDate(QDate());
    183195      _decodeStop.setTime(QTime());
    184       _begDateOut = _checkTime.toUTC().date().toString("yy-MM-dd");
    185       _begTimeOut = _checkTime.toUTC().time().toString("hh:mm:ss");
    186       emit(newMessage((_staID
    187                     + ": Failure threshold exceeded, outage since "
    188                     + _begDateOut + " " + _begTimeOut).toAscii(), true));
    189       emit(newMessage((_staID + ": Begin_Outage "  // weber
    190                     + _begDateOut + " " + _begTimeOut).toAscii(),true));
    191       callScript(("Begin_Outage "
    192                     + _begDateOut + " " + _begTimeOut).toAscii());
    193     }
    194   }
    195   _fromReconnect = true;
    196   _decodeStart = QDateTime::currentDateTime();
     196      _decodeStart = QDateTime::currentDateTime();
     197    }
     198  }
    197199}
    198200
     
    232234        _secFail += _inspSegm;
    233235        _secSucc = 0;
    234         if (_secFail > _adviseFail * 60) { 
     236        if (_secFail > _adviseFail * 60) {
    235237          _secFail = _adviseFail * 60 + 1;
    236238        }
     
    248250        }
    249251      }
    250  
     252
    251253      // End corrupt threshold
    252254      // ---------------------
     
    258260                    .addSecs(- _adviseReco * 60)
    259261                    .toUTC().time().toString("hh:mm:ss");
    260         emit(newMessage((_staID 
    261                     + ": Recovery threshold exceeded, corruption ended " 
    262                     + _endDateCor + " " + _endTimeCor).toAscii(), true));
    263         callScript(("End_Corrupted " 
    264                     + _endDateCor + " " + _endTimeCor + " Begin was "
    265                     + _begDateCor + " " + _begTimeCor).toAscii());
     262        emit(newMessage((_staID
     263                    + ": Recovery threshold exceeded, corruption ended "
     264                    + _endDateCor + " " + _endTimeCor + " UTC").toAscii(), true));
     265        callScript(("End_Corrupted "
     266                    + _endDateCor + " " + _endTimeCor + " UTC Begin was "
     267                    + _begDateCor + " " + _begTimeCor + " UTC").toAscii());
    266268        _endCorrupt = true;
    267269        _begCorrupt = false;
    268270        _secFail = 0;
    269       } 
     271      }
    270272      else {
    271273
     
    275277          _begDateCor = _decodeSucc.toUTC().date().toString("yy-MM-dd");
    276278          _begTimeCor = _decodeSucc.toUTC().time().toString("hh:mm:ss");
    277           emit(newMessage((_staID 
    278                     + ": Failure threshold exceeded, corrupted since " 
    279                     + _begDateCor + " " + _begTimeCor).toAscii(), true));
    280           callScript(("Begin_Corrupted " 
    281                     + _begDateCor + " " + _begTimeCor).toAscii());
     279          emit(newMessage((_staID
     280                    + ": Failure threshold exceeded, corrupted since "
     281                    + _begDateCor + " " + _begTimeCor + " UTC").toAscii(), true));
     282          callScript(("Begin_Corrupted "
     283                    + _begDateCor + " " + _begTimeCor + " UTC").toAscii());
    282284          _begCorrupt = true;
    283285          _endCorrupt = false;
     
    290292  }
    291293
    292   if (_fromReconnect) {
    293     _decodeStart = QDateTime::currentDateTime();
    294   }
    295 
    296294  // End outage threshold
    297295  // --------------------
     296  if (_fromReconnect) {
     297    _begDateTimeOut = QDateTime::currentDateTime();
     298  }
     299  _fromReconnect = false;
     300
    298301  if ( _decodeStart.isValid() ) {
    299     if ( _decodeStart.secsTo(QDateTime::currentDateTime()) >  _adviseReco * 60 ) {
     302    _endDateTimeOut = QDateTime::currentDateTime();
     303    if ( _begDateTimeOut.secsTo(QDateTime::currentDateTime()) >  _adviseReco * 60 ) {
     304      _endDateOut = _begDateTimeOut.toUTC().date().toString("yy-MM-dd");
     305      _endTimeOut = _begDateTimeOut.toUTC().time().toString("hh:mm:ss");
     306      emit(newMessage((_staID + ": Recovery threshold exceeded, outage ended "
     307                    + _endDateOut + " " + _endTimeOut + " UTC").toAscii(), true));
     308      callScript(("End_Outage "
     309                    + _endDateOut + " " + _endTimeOut + " UTC Begin was "
     310                    + _begDateOut + " " + _begTimeOut + " UTC").toAscii());
    300311      _decodeStart.setDate(QDate());
    301312      _decodeStart.setTime(QTime());
    302       _endDateOut = QDateTime::currentDateTime()
    303                     .addSecs(- _adviseReco * 60)
    304                     .toUTC().date().toString("yy-MM-dd");
    305       _endTimeOut = QDateTime::currentDateTime()
    306                     .addSecs(- _adviseReco * 60)
    307                     .toUTC().time().toString("hh:mm:ss");
    308       emit(newMessage((_staID
    309                     + ": Recovery threshold exceeded, outage ended "
    310                     + _endDateOut + " " + _endTimeOut).toAscii(), true));
    311       emit(newMessage((_staID + ": End_Outage "  // weber
    312                     + _endDateOut + " " + _endTimeOut + " Begin was "
    313                     + _begDateOut + " " + _begTimeOut).toAscii(),true));
    314       callScript(("End_Outage "
    315                     + _endDateOut + " " + _endTimeOut + " Begin was "
    316                     + _begDateOut + " " + _begTimeOut).toAscii());
    317     }
    318   }
    319   _fromReconnect = false;
    320   _decodeStop = QDateTime::currentDateTime();
     313      _decodeStop = QDateTime::currentDateTime();
     314    }
     315  }
    321316}
    322317
Note: See TracChangeset for help on using the changeset viewer.