Allow clients with protocol version 3.1.0 to connect to the server

pull/9/head
Michael Zanetti 2020-02-14 10:47:59 +01:00
parent 44248e0223
commit c2b6ad87f0
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);