Changeset 9732 in ntrip


Ignore:
Timestamp:
May 27, 2022, 12:27:30 PM (5 weeks ago)
Author:
stuerze
Message:

minor changes

File:
1 edited

Legend:

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

    r9731 r9732  
    5050  _isToBeDeleted = false;
    5151
    52   connect(this, SIGNAL(newMessage(QByteArray,bool)),
    53   BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
    54 
    55   if (BNC_CORE->_uploadTableItems.find(_iRow)
    56       != BNC_CORE->_uploadTableItems.end()) {
     52  connect(this, SIGNAL(newMessage(QByteArray,bool)), BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
     53
     54  if (BNC_CORE->_uploadTableItems.find(_iRow) != BNC_CORE->_uploadTableItems.end()) {
    5755    connect(this, SIGNAL(newBytes(QByteArray,double)),
    58     BNC_CORE->_uploadTableItems.value(iRow),
    59         SLOT(slotNewBytes(const QByteArray,double)));
    60   }
    61   if (BNC_CORE->_uploadEphTableItems.find(_iRow)
    62       != BNC_CORE->_uploadEphTableItems.end()) {
     56            BNC_CORE->_uploadTableItems.value(iRow),
     57            SLOT(slotNewBytes(const QByteArray,double)));
     58  }
     59  if (BNC_CORE->_uploadEphTableItems.find(_iRow) != BNC_CORE->_uploadEphTableItems.end()) {
    6360    connect(this, SIGNAL(newBytes(QByteArray,double)),
    64     BNC_CORE->_uploadEphTableItems.value(iRow),
    65         SLOT(slotNewBytes(const QByteArray,double)));
    66   }
    67 
    68   _sslIgnoreErrors = (Qt::CheckState(settings.value("sslIgnoreErrors").toInt())
    69       == Qt::Checked);
     61            BNC_CORE->_uploadEphTableItems.value(iRow),
     62            SLOT(slotNewBytes(const QByteArray,double)));
     63  }
     64
     65  _sslIgnoreErrors = (Qt::CheckState(settings.value("sslIgnoreErrors").toInt()) == Qt::Checked);
    7066
    7167  _proxyOutHost = settings.value("proxyHost").toString();
     
    176172          _outSocket->flush();
    177173        } else {
    178           QString chunkSize = QString("%1").arg(_outBuffer.size(), 0, 16,
    179               QLatin1Char('0'));
    180           QByteArray chunkedData = chunkSize.toLatin1() + "\r\n" + _outBuffer
    181               + "\r\n";
     174          QString chunkSize = QString("%1").arg(_outBuffer.size(), 0, 16,  QLatin1Char('0'));
     175          QByteArray chunkedData = chunkSize.toLatin1() + "\r\n" + _outBuffer  + "\r\n";
    182176          _outSocket->write(chunkedData);
    183177          _outSocket->flush();
     
    205199  QByteArray msg;
    206200
    207 
    208201  if (_mountpoint.isEmpty()) {
    209202    return;
     
    231224  _outSocket->setProxy(QNetworkProxy::NoProxy);
    232225  _outSocket->setSslConfiguration(sslConfig);
    233 
    234226  connect(_outSocket, SIGNAL(disconnected()), this, SLOT(slotSslSocketConnectionClosed()));
    235227  connect(_outSocket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(slotSslErrors(QList<QSslError>)));
     
    262254      _outSocket->waitForBytesWritten();
    263255      _outSocket->waitForReadyRead();
    264       QByteArray ans = _outSocket->readLine();      cout << ans.toStdString().c_str() << endl;
     256      QByteArray ans = _outSocket->readAll();      cout << ans.toStdString().c_str() << endl;
    265257      if (ans.indexOf("200") == -1) {
    266         emit(newMessage(
    267             "Proxy: Connection broken for " + _mountpoint.toLatin1()
    268                 + ": " + ans.left(ans.length() - 2), true));
     258        emit(newMessage("Proxy: Connection broken for " + _mountpoint.toLatin1()
     259                        + ": " + ans.left(ans.length() - 2), true));
    269260        _outSocket->close();
    270261        return;
    271262      } else {
    272         emit(newMessage(
    273             "Proxy: Connection opened for " + _mountpoint.toLatin1()
    274                 + ": " + ans.left(ans.length() - 2), true));
     263        emit(newMessage("Proxy: Connection established for " + _mountpoint.toLatin1(), true));
    275264        _sOpenTrial = 0;
    276265        _outSocket->setPeerVerifyName(_casterOutHost);
    277266        _outSocket->startClientEncryption();
    278267        if (!_outSocket->waitForEncrypted(timeOut)) {
    279           emit(newMessage(
    280               "Proxy/Caster: Encrypt timeout for " + _mountpoint.toLatin1() + " ("
    281                   + _casterOutHost.toLatin1() + ":"
    282                   + QString("%1) ").arg(_casterOutPort).toLatin1()
    283                   + _outSocket->errorString().toLatin1(), true));
     268          emit(newMessage("Proxy/Caster: Encrypt timeout for " + _mountpoint.toLatin1() + " ("
     269                          + _casterOutHost.toLatin1() + ":"
     270                          + QString("%1) ").arg(_casterOutPort).toLatin1()
     271                          + _outSocket->errorString().toLatin1(), true));
    284272          return;
    285273        } else {
     
    301289        + "Connection: close\r\n" + "Transfer-Encoding: chunked\r\n\r\n";
    302290  }
    303   cout << msg.toStdString().c_str();
     291  //cout << msg.toStdString().c_str();
    304292  _outSocket->write(msg);
    305293  _outSocket->waitForBytesWritten();
     
    308296   QByteArray ans = "";
    309297  if (_outSocket->canReadLine()) {
    310     ans = _outSocket->readLine();  cout << "ans: " << ans.toStdString().c_str() << endl;
     298    ans = _outSocket->readLine();  //cout << "ans: " << ans.toStdString().c_str() << endl;
    311299  }
    312300
    313301  if (ans.indexOf("200") == -1) {
    314302    _outSocket->close();
    315     emit(newMessage(
    316         "Broadcaster: Connection broken for " + _mountpoint.toLatin1() + ": "
    317             + ans.left(ans.length() - 2), true));
    318   } else {
    319     emit(newMessage(
    320         "Broadcaster: Connection opened for " + _mountpoint.toLatin1() + ": "
    321             + ans.left(ans.length() - 2), true));
     303    emit(newMessage("Broadcaster: Connection broken for " + _mountpoint.toLatin1() + ": "
     304                    + ans.left(ans.length() - 2), true));
     305  } else {
     306    emit(newMessage("Broadcaster: Connection opened for " + _mountpoint.toLatin1(), true));
    322307    _sOpenTrial = 0;
    323308  }
Note: See TracChangeset for help on using the changeset viewer.