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

QMqttClient doesn't work if transport is set manually

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Out of scope
    • Affects Version/s: 5.11.0 Beta 4
    • Fix Version/s: 5.11.2, 5.12.0 Alpha
    • Component/s: MQTT
    • Labels:
      None
    • Commits:
      c129d6650508063e438e80f4c755159ead413e28

      Description

      When transport is set manually, QMqttClient does nothing after estabilishing connection, because sendControlConnect() method from QMqttConnection is never called.

      sendControlConnect() should be called from QMqttConnection::transportConnectionEstablished(). When using default transport, "connected" signal of the socked is connected to transportConnectionEstablished() slot in ensureTransport(). 

       

      connect(socket, &QAbstractSocket::connected, this, &QMqttConnection::transportConnectionEstablished);
      

      However, when using manually set transport, ensureTransport() returns before connecting that signal to slot.

      Adding

      connect((QAbstractSocket *)m_transport, &QAbstractSocket::connected, this, &QMqttConnection::transportConnectionEstablished);
      

      at the end of QMqttConnection::setTransport() solves the problem, but only for transports that inherit from QAbstractSocket.

       

        Attachments

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

          Activity

            People

            Assignee:
            mkalinow Maurice Kalinowski
            Reporter:
            lukzaj Łukasz Zając
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes