Changeset 3210 in ntrip for trunk/BNC/upload


Ignore:
Timestamp:
Mar 31, 2011, 7:49:49 AM (14 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/upload/bncuploadcaster.cpp

    r3209 r3210  
    191191////////////////////////////////////////////////////////////////////////////
    192192void bncUploadCaster::deleteSafely() {
    193   QMutexLocker locker(&_mutex);
    194193  _isToBeDeleted = true;
    195194  if (!isRunning()) {
     
    214213void bncUploadCaster::run() {
    215214  while (true) {
    216     {
    217       QMutexLocker locker(&_mutex);
    218       if (_isToBeDeleted) {
    219         QThread::quit();
    220         deleteLater();
    221         return;
    222       }
    223     }
     215    if (_isToBeDeleted) {
     216      QThread::quit();
     217      deleteLater();
     218      return;
     219    }
     220    open();
    224221    uploadClockOrbitBias();
    225222    msleep(10);
     
    290287////////////////////////////////////////////////////////////////////////////
    291288void bncUploadCaster::write(char* buffer, unsigned len) {
    292   if (_outSocket) {
     289  if (_outSocket && _outSocket->state() == QAbstractSocket::ConnectedState) {
    293290    _outSocket->write(buffer, len);
    294291    _outSocket->flush();
     
    304301  // Append to buffer
    305302  // ----------------
     303  const int MAXBUFFSIZE = 1000;
    306304  _rtnetStreamBuffer.append(QByteArray(buffer, bufLen));
     305  if (_rtnetStreamBuffer.size() > MAXBUFFSIZE) {
     306    _rtnetStreamBuffer = _rtnetStreamBuffer.right(MAXBUFFSIZE);
     307  }
    307308}
    308309
     
    322323    for (int ii = 0; ii < hlpLines.size(); ii++) {
    323324      if      (hlpLines[ii].indexOf('*') != -1) {
     325        lines.clear();
    324326        QTextStream in(hlpLines[ii].toAscii());
    325327        QString hlp;
     
    338340    return;
    339341  }
    340 
    341   this->open();
    342342
    343343  unsigned year, month, day;
     
    452452  }
    453453 
    454   if (_outSocket && (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0)) {
     454  if (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) {
    455455    char obuffer[CLOCKORBIT_BUFFERSIZE];
    456456 
     
    461461  }
    462462 
    463   if (_outSocket && (bias.NumberOfGPSSat > 0 || bias.NumberOfGLONASSSat > 0)) {
     463  if (bias.NumberOfGPSSat > 0 || bias.NumberOfGLONASSSat > 0) {
    464464    char obuffer[CLOCKORBIT_BUFFERSIZE];
    465465    int len = MakeBias(&bias, BTYPE_AUTO, 0, obuffer, sizeof(obuffer));
Note: See TracChangeset for help on using the changeset viewer.