Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix packet identifier #199

Conversation

fipwmaqzufheoxq92ebc
Copy link

The MQTT specification requires (Ref: MQTT-2.3.1-1) that

[...] Control Packets MUST contain a non-zero 16-bit Packet Identifier
The current implementation uses a counter "packet_id_counter", which is set in the constructor to zero.
That causes the first SUBSCRIBE, PUBLISH or UNSUBSCRIBE to cause a disconnect by the broker because of protocol violation.
The packet_id_counter is not reset on reconnect, so after a reconnect everything works normally.
This PR fixes the behavior to:

  • start by packet id "1"
  • in case of an overflow (i.e. packet id > 65535) to restart at 1

@fipwmaqzufheoxq92ebc
Copy link
Author

Oops, there is already a PR open for that. Sorry

@brentru
Copy link
Member

brentru commented Jul 19, 2021

@fipwmaqzufheoxq92ebc Which PR addresses this? Thanks

@fipwmaqzufheoxq92ebc
Copy link
Author

fipwmaqzufheoxq92ebc commented Jul 19, 2021

@brentru #190

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants