Commit 60f1de87373cfc78fd9902eb8293777144226830

Authored by Wiebe Cazemier
1 parent b7d6798c

Packet identifier must be > 0

Showing 1 changed file with 5 additions and 1 deletions
session.cpp
... ... @@ -73,7 +73,11 @@ void Session::writePacket(const MqttPacket &packet, char max_qos)
73 73 logger->logf(LOG_WARNING, "Dropping QoS message for client '%s', because its QoS buffers were full.", client_id.c_str());
74 74 return;
75 75 }
76   - const uint16_t pid = nextPacketId++;
  76 + nextPacketId++;
  77 + if (nextPacketId == 0)
  78 + nextPacketId++;
  79 +
  80 + const uint16_t pid = nextPacketId;
77 81 copyPacket->setPacketId(pid);
78 82 QueuedQosPacket p;
79 83 p.packet = copyPacket;
... ...