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

Should save messageId in queue #31

Merged

Conversation

gnought
Copy link
Collaborator

@gnought gnought commented Jul 15, 2019

Any PUBLISH message in offline queue for QoS 1 and 2 should be resent with same messageId for a proper acknowledge by clients.

Broker uses `brokerCounter` to track how many packets it emits, as `messageId` will be rotated after it reaches max 65535. If there are two PUBLISH packets which brokerCounter is different but same messageId, the second PUBLISH will update the first slot in the queue, as `outgoingUpdate` is using `for` loop starting at index 0. This will fix the issue. We use `outgoingEnqueue` or `outgoingEnqueueCombi` to enqueue PUBLISH packets, and and use `outgoingUpdate` to update those PUBLSIH items to next state (say PUBREL), so `outgoing` array should not contain PUBLISH, and that's why this issue could be fixed by a check `packet.cmd !== 'publish'`
Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you mind updating aedes-packet as well?

.travis.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mcollina mcollina merged commit fd41167 into moscajs:master Jul 17, 2019
@gnought gnought deleted the hotfix/should_save_messageid_in_queue branch July 17, 2019 19:07
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.

2 participants