Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
5.11.0 Beta 4
-
None
-
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.