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

QMQTT does not connect signal

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Out of scope
    • Affects Version/s: 5.11.1
    • Fix Version/s: 5.11.2, 5.12.0 Alpha
    • Component/s: MQTT
    • Labels:
      None
    • Platform/s:
      Windows
    • Commits:
      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

        For Gerrit Dashboard: QTBUG-69305
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            mkalinow Maurice Kalinowski
            Reporter:
            jerry-liu jerry-liu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes