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

Bugfix/dont send ack on new connection #428

Merged
merged 7 commits into from
Aug 9, 2020

Conversation

SgtSilvio
Copy link
Member

@SgtSilvio SgtSilvio commented Jun 26, 2020

Motivation
MQTT 5 specification

When a Client reconnects with Clean Start set to 0 and a session is present, both the Client and Server MUST resend any unacknowledged PUBLISH packets (where QoS > 0) and PUBREL packets using their original Packet Identifiers. This is the only circumstance where a Client or Server is REQUIRED to resend messages. Clients and Servers MUST NOT resend messages at any other time [MQTT-4.4.0-1].

Currently it is possible that PUBACK and PUBREC packets can be sent on a new connection after a reconnect.
Can be reproduced by:

  1. using manual acknowledgement
  2. receive a message
  3. reconnect the client
  4. acknowledge the message before the server resends the corresponding PUBLISH message

Changes

  • Added a connectionIndex to pending incoming messages

@cla-bot cla-bot bot added the cla-signed label Jun 26, 2020
@SgtSilvio SgtSilvio added the bug label Jun 26, 2020
@SgtSilvio SgtSilvio self-assigned this Jun 26, 2020
@SgtSilvio SgtSilvio added this to the 1.2.1 milestone Jun 26, 2020
@SgtSilvio SgtSilvio requested a review from AcidSepp June 29, 2020 08:48
@SgtSilvio SgtSilvio merged commit 18fc441 into develop Aug 9, 2020
@SgtSilvio SgtSilvio deleted the bugfix/dont-send-ack-on-new-connection branch August 9, 2020 13:50
@SgtSilvio SgtSilvio mentioned this pull request Aug 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants