Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-69305

QMQTT does not connect signal

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • 5.11.2, 5.12.0 Alpha
    • 5.11.1
    • MQTT
    • None
    • Windows
    • c129d6650508063e438e80f4c755159ead413e28

    Description

      Description:

      When MQTT over QSslSocket by QMqttConnection::setTransport(ssocket, QMqttClient::SecureSocket), then signal QAbstractSocket::connected and QAbstractSocket::disconnected is lost.

      The following is my code. FYI. thanks.

       

      void QMqttConnection::setTransport(QIODevice *device, QMqttClient::TransportType transport)
      {
      qCDebug(lcMqttConnection) << Q_FUNC_INFO << device << " Type:" << transport;

      if (m_transport) {
      disconnect(m_transport, &QIODevice::aboutToClose, this, &QMqttConnection::transportConnectionClosed);
      disconnect(m_transport, &QIODevice::readyRead, this, &QMqttConnection::transportReadReady);

      // Start: Added By Jerry.Liu (jerry-liu@outlook.com)
      auto socket = dynamic_cast<QAbstractSocket*>(m_transport);
      if (socket) {
      disconnect(socket, &QAbstractSocket::connected, this, &QMqttConnection::transportConnectionEstablished);
      disconnect(socket, &QAbstractSocket::disconnected, this, &QMqttConnection::transportConnectionClosed);
      }
      // End: Added By Jerry (jerry-liu@outlook.com)
      if (m_ownTransport)
      delete m_transport;
      }

      m_transport = device;
      m_transportType = transport;
      m_ownTransport = false;

      connect(m_transport, &QIODevice::aboutToClose, this, &QMqttConnection::transportConnectionClosed);
      connect(m_transport, &QIODevice::readyRead, this, &QMqttConnection::transportReadReady);

      // Start: Added By Jerry.Liu (jerry-liu@outlook.com)
      auto socket = dynamic_cast<QAbstractSocket*>(device);
      if (socket){
      bool ret = false;
      ret = connect(socket, &QAbstractSocket::connected, this, &QMqttConnection::transportConnectionEstablished);
      Q_ASSERT(ret);
      ret = connect(socket, &QAbstractSocket::disconnected, this, &QMqttConnection::transportConnectionClosed);
      Q_ASSERT(ret);
      }
      // End: Added By Jerry (jerry-liu@outlook.com)
      }

       

       

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mkalinow Maurice Kalinowski
            jirauser44008 user-fddb0 (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes