Skip to content

Commit

Permalink
Merge pull request #236 from halfgaar/fix-packetid-zero
Browse files Browse the repository at this point in the history
Fix publishing packet ID zero on wrap-around
  • Loading branch information
mwallnoefer authored Feb 14, 2022
2 parents 4edfd85 + abc31a1 commit 0bd198e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/mqtt/qmqtt_client_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,12 @@ void QMQTT::ClientPrivate::stopKeepAlive()

quint16 QMQTT::ClientPrivate::nextmid()
{
return _gmid++;
const quint16 result = _gmid;
_gmid++;
if (_gmid == 0)
_gmid++;

return result;
}

quint16 QMQTT::ClientPrivate::publish(const Message& message)
Expand Down

0 comments on commit 0bd198e

Please sign in to comment.