1
0
mirror of https://github.com/qt/qtmqtt.git synced 2026-10-25 16:16:26 +00:00

Implement waitForBytesWritten for the websockets case

Not implementing this function causes a lot if Invalid Socket
Specified in the tests.

Also fixed a problem with broker_connection.h where
DefaultVersionTestData did not evaluate to version(0)
if MQTT_TEST_PROTOCOL was defined.

Fixes: QTBUG-137305
Pick-to: 6.10
Change-Id: I4b825196548a3f5bf07c3bb4203a0b46033004ba
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
This commit is contained in:
Even Oscar Andersen 2025-06-02 07:55:31 +02:00
parent 2c9be38a7c
commit 635ae612f1
2 changed files with 16 additions and 1 deletions

View File

@ -56,6 +56,13 @@ public:
return static_cast<qint64>(m_buffer.size()) + QIODevice::bytesAvailable();
}
bool waitForBytesWritten(int msecs) override
{
Q_UNUSED(msecs);
m_socket->flush();
return true;
}
bool isConnected() const
{
return (m_socket->state() == QAbstractSocket::ConnectedState);

View File

@ -314,7 +314,14 @@ Q_DECLARE_METATYPE(QMqttClient::ProtocolVersion)
VersionClientBase(MQTTVERSION, CLIENTNAME, qgetenv("MQTT_TEST_BROKER_TYPE"))
#endif
#ifdef MQTT_TEST_PROTOCOL
#define DefaultVersionTestData(FUNCTION) \
void FUNCTION() \
{ \
QTest::addColumn<QMqttClient::ProtocolVersion>("mqttVersion"); \
QTest::newRow("V0") << QMqttClient::ProtocolVersion(0); \
}
#else
#define DefaultVersionTestData(FUNCTION) \
void FUNCTION() \
{ \
@ -326,3 +333,4 @@ void FUNCTION() \
QTest::newRow("V5.0.0") << QMqttClient::MQTT_5_0; \
} \
}
#endif