Merge PR #9: Allow clients with protocol version 3.1.0 to connect to the server

This commit is contained in:
Jenkins nymea 2020-02-23 23:38:07 +01:00
commit 21cb545ad5
2 changed files with 3 additions and 2 deletions

View File

@ -34,6 +34,7 @@ namespace Mqtt {
enum Protocol {
ProtocolUnknown = 0x00,
Protocol310 = 0x03,
Protocol311 = 0x04
};

View File

@ -280,8 +280,8 @@ void MqttServerPrivate::processPacket(const MqttPacket &packet, QTcpSocket *clie
MqttPacket response(MqttPacket::TypeConnack, packet.packetId());
if (packet.protocolLevel() != Mqtt::Protocol311) {
qCWarning(dbgServer) << "This MQTT broker only supports Protocol version 3.1.1";
if (packet.protocolLevel() != Mqtt::Protocol310 && packet.protocolLevel() != Mqtt::Protocol311) {
qCWarning(dbgServer) << "This MQTT broker only supports Protocol version 3.1.0 and 3.1.1 but client is" << packet.protocolLevel();
response.setConnectReturnCode(Mqtt::ConnectReturnCodeUnacceptableProtocolVersion);
client->write(response.serialize());
cleanupClient(client);