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

Remove SubAck/UnsubAck/PubAck/PubRec/PubRel/PubComp reason code errors from critical state error #877

Merged
merged 7 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rumqttc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Ordering of `State.events` related to `QoS > 0` publishes
* Filter PUBACK in pending save requests to fix unexpected PUBACK sent to reconnected broker.
* Resume session only if broker sends `CONNACK` with `session_present == 1`.
* No disconnection on v5 PubAck/PubRec/PubRel/PubComp/Sub/Unsub failures.
xiaocq2001 marked this conversation as resolved.
Show resolved Hide resolved

### Security

Expand Down
14 changes: 13 additions & 1 deletion rumqttc/src/v5/eventloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,19 @@ impl EventLoop {
Err(e) => {
// MQTT requires that packets pending acknowledgement should be republished on session resume.
// Move pending messages from state to eventloop.
self.clean();
// The PubAckFail/PubRecFail/PubRelFail/PubCompFail/SubFail/UnsubFail errors are not critical errors.
match e {
ConnectionError::MqttState(StateError::PubAckFail { .. })
| ConnectionError::MqttState(StateError::PubRecFail { .. })
| ConnectionError::MqttState(StateError::PubRelFail { .. })
| ConnectionError::MqttState(StateError::PubCompFail { .. })
| ConnectionError::MqttState(StateError::SubFail { .. })
| ConnectionError::MqttState(StateError::UnsubFail { .. }) => {}
swanandx marked this conversation as resolved.
Show resolved Hide resolved
_ => {
warn!("Disconnect due to a critical error: {:?}", e);
self.clean()
}
};
Err(e)
}
}
Expand Down