Changeset 976 in ntrip for trunk/BNC/bncapp.cpp


Ignore:
Timestamp:
Jul 26, 2008, 10:33:00 AM (16 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncapp.cpp

    r975 r976  
    623623  _corrs->insert(coTime, QString(line + " " + staID));
    624624
    625   QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
    626   while (is.hasNext()) {
    627     QTcpSocket* sock = is.next();
    628     if (sock->state() == QAbstractSocket::ConnectedState) {
    629       if (sock->write(QString(line + " " + staID + "\n").toAscii()) == -1) {
    630         delete sock;
    631         is.remove();
    632       }
    633     }
    634     else if (sock->state() != QAbstractSocket::ConnectingState) {
    635       delete sock;
    636       is.remove();
    637     }
    638   }
    639 }
     625  // Dump Corrections
     626  // ----------------
     627  if (coTime - _waitCoTime > _lastDumpCoSec) {
     628    dumpCorrs(_lastDumpCoSec + 1, coTime - _waitCoTime);
     629    _lastDumpCoSec = coTime - _waitCoTime;
     630  }
     631}
     632
     633// Dump Complete Correction Epochs
     634////////////////////////////////////////////////////////////////////////////
     635void bncApp::dumpCorrs(long minTime, long maxTime) {
     636
     637  for (long sec = minTime; sec <= maxTime; sec++) {
     638    QList<QString> allCorrs = _corrs->values(sec);
     639    QListIterator<QString> it(allCorrs);
     640    while (it.hasNext()) {
     641      QString corrLine = it.next() + "\n";
     642
     643      QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
     644      while (is.hasNext()) {
     645        QTcpSocket* sock = is.next();
     646        if (sock->state() == QAbstractSocket::ConnectedState) {
     647          if (sock->write(corrLine.toAscii()) == -1) {
     648            delete sock;
     649            is.remove();
     650          }
     651        }
     652        else if (sock->state() != QAbstractSocket::ConnectingState) {
     653          delete sock;
     654          is.remove();
     655        }
     656      }
     657    }
     658    _corrs->remove(sec);
     659  }
     660}
Note: See TracChangeset for help on using the changeset viewer.