From 4a702421d83d28407a0fc65cee5c7f47875e5f12 Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Wed, 27 Apr 2022 15:02:41 +0200 Subject: [PATCH] Reordered packet handling ifs --- mqttpacket.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mqttpacket.cpp b/mqttpacket.cpp index d03b8cb..dcefcdf 100644 --- a/mqttpacket.cpp +++ b/mqttpacket.cpp @@ -297,17 +297,7 @@ void MqttPacket::handle() } } - if (packetType == PacketType::CONNECT) - handleConnect(); - else if (packetType == PacketType::DISCONNECT) - handleDisconnect(); - else if (packetType == PacketType::PINGREQ) - sender->writePingResp(); - else if (packetType == PacketType::SUBSCRIBE) - handleSubscribe(); - else if (packetType == PacketType::UNSUBSCRIBE) - handleUnsubscribe(); - else if (packetType == PacketType::PUBLISH) + if (packetType == PacketType::PUBLISH) handlePublish(); else if (packetType == PacketType::PUBACK) handlePubAck(); @@ -317,6 +307,16 @@ void MqttPacket::handle() handlePubRel(); else if (packetType == PacketType::PUBCOMP) handlePubComp(); + else if (packetType == PacketType::PINGREQ) + sender->writePingResp(); + else if (packetType == PacketType::SUBSCRIBE) + handleSubscribe(); + else if (packetType == PacketType::UNSUBSCRIBE) + handleUnsubscribe(); + else if (packetType == PacketType::CONNECT) + handleConnect(); + else if (packetType == PacketType::DISCONNECT) + handleDisconnect(); else if (packetType == PacketType::AUTH) handleExtendedAuth(); } -- libgit2 0.21.4