Commit 4a702421d83d28407a0fc65cee5c7f47875e5f12
1 parent
6cd50fa2
Reordered packet handling ifs
Showing
1 changed file
with
11 additions
and
11 deletions
mqttpacket.cpp
| ... | ... | @@ -297,17 +297,7 @@ void MqttPacket::handle() |
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - if (packetType == PacketType::CONNECT) | |
| 301 | - handleConnect(); | |
| 302 | - else if (packetType == PacketType::DISCONNECT) | |
| 303 | - handleDisconnect(); | |
| 304 | - else if (packetType == PacketType::PINGREQ) | |
| 305 | - sender->writePingResp(); | |
| 306 | - else if (packetType == PacketType::SUBSCRIBE) | |
| 307 | - handleSubscribe(); | |
| 308 | - else if (packetType == PacketType::UNSUBSCRIBE) | |
| 309 | - handleUnsubscribe(); | |
| 310 | - else if (packetType == PacketType::PUBLISH) | |
| 300 | + if (packetType == PacketType::PUBLISH) | |
| 311 | 301 | handlePublish(); |
| 312 | 302 | else if (packetType == PacketType::PUBACK) |
| 313 | 303 | handlePubAck(); |
| ... | ... | @@ -317,6 +307,16 @@ void MqttPacket::handle() |
| 317 | 307 | handlePubRel(); |
| 318 | 308 | else if (packetType == PacketType::PUBCOMP) |
| 319 | 309 | handlePubComp(); |
| 310 | + else if (packetType == PacketType::PINGREQ) | |
| 311 | + sender->writePingResp(); | |
| 312 | + else if (packetType == PacketType::SUBSCRIBE) | |
| 313 | + handleSubscribe(); | |
| 314 | + else if (packetType == PacketType::UNSUBSCRIBE) | |
| 315 | + handleUnsubscribe(); | |
| 316 | + else if (packetType == PacketType::CONNECT) | |
| 317 | + handleConnect(); | |
| 318 | + else if (packetType == PacketType::DISCONNECT) | |
| 319 | + handleDisconnect(); | |
| 320 | 320 | else if (packetType == PacketType::AUTH) |
| 321 | 321 | handleExtendedAuth(); |
| 322 | 322 | } | ... | ... |