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

Fixed qos2_publish_handled_ invalidly remains issue. #986

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

redboltz
Copy link
Owner

@redboltz redboltz commented Oct 3, 2023

qos2_publish_handled_ is used for avoid qos2 publish handling twice or more. On publish receive, if it doesn't contain the packet_id, then handle the publish message and add the packet_id to qos2_publish_handled_. On pubrel receive, erase the packet_id from qos2_publish_handled_ because the publish packet that has the packet_id is no logner resend. It is the basic logic.
However, when user sends pubrec with error reason_code, then the communication partner doesn't send back pubrel due to the error. In this case, there is no chance to erase qos2_publish_handled_ entry.

It should be erased when user sends pubrec with error reason_code. This fix adds it.

qos2_publish_handled_ used to access from only on strand. But this addition introduce out of strand access. It is user's timing. So I introduced mutex for qos2_publish_handled_.

qos2_publish_handled_ is used for avoid qos2 publish handling twice or
more. On publish receive, if it doesn't contain the packet_id, then handle the
publish message and add the packet_id to qos2_publish_handled_.
On pubrel receive, erase the packet_id from qos2_publish_handled_
because the publish packet that has the packet_id is no logner resend.
It is the basic logic.
However, when user sends pubrec with error reason_code, then the communication
partner doesn't send back pubrel due to the error.
In this case, there is no chance to erase qos2_publish_handled_ entry.

It should be erased when user sends pubrec with error reason_code.
This fix adds it.

qos2_publish_handled_ used to access from only on strand. But this
addition introduce out of strand access. It is user's timing. So I
introduced mutex for qos2_publish_handled_.
@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

Merging #986 (0310600) into master (8e9c8f9) will decrease coverage by 0.03%.
The diff coverage is 76.47%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #986      +/-   ##
==========================================
- Coverage   84.04%   84.01%   -0.03%     
==========================================
  Files          65       65              
  Lines       10717    10713       -4     
==========================================
- Hits         9007     9001       -6     
- Misses       1710     1712       +2     

@redboltz redboltz merged commit ec7bc54 into master Oct 3, 2023
23 of 25 checks passed
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

1 participant