-
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
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.