Skip to content

Commit a824d37

Browse files
committed
Adding check for empty id before applying the clean start in v5
1 parent 005f73c commit a824d37

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rumqttc/src/v5/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ impl MqttOptions {
255255
/// operations on the client when reconnection with same `client_id`
256256
/// happens. Local queue state is also held to retransmit packets after reconnection.
257257
pub fn set_clean_start(&mut self, clean_start: bool) -> &mut Self {
258+
assert!(
259+
!self.client_id.is_empty() || clean_start,
260+
"Cannot unset clean session when client id is empty"
261+
);
258262
self.clean_start = clean_start;
259263
self
260264
}

0 commit comments

Comments
 (0)