Allow clients with protocol version 3.1.0 to connect to the server
This commit is contained in:
parent
44248e0223
commit
c2b6ad87f0
@ -34,6 +34,7 @@ namespace Mqtt {
|
|||||||
|
|
||||||
enum Protocol {
|
enum Protocol {
|
||||||
ProtocolUnknown = 0x00,
|
ProtocolUnknown = 0x00,
|
||||||
|
Protocol310 = 0x03,
|
||||||
Protocol311 = 0x04
|
Protocol311 = 0x04
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -280,8 +280,8 @@ void MqttServerPrivate::processPacket(const MqttPacket &packet, QTcpSocket *clie
|
|||||||
|
|
||||||
MqttPacket response(MqttPacket::TypeConnack, packet.packetId());
|
MqttPacket response(MqttPacket::TypeConnack, packet.packetId());
|
||||||
|
|
||||||
if (packet.protocolLevel() != Mqtt::Protocol311) {
|
if (packet.protocolLevel() != Mqtt::Protocol310 && packet.protocolLevel() != Mqtt::Protocol311) {
|
||||||
qCWarning(dbgServer) << "This MQTT broker only supports Protocol version 3.1.1";
|
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);
|
response.setConnectReturnCode(Mqtt::ConnectReturnCodeUnacceptableProtocolVersion);
|
||||||
client->write(response.serialize());
|
client->write(response.serialize());
|
||||||
cleanupClient(client);
|
cleanupClient(client);
|
||||||
|
|||||||
Reference in New Issue
Block a user