Skip to content

Commit

Permalink
Change instance when attempting a retry
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed Aug 19, 2024
1 parent a44281a commit 79b94a1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkcs11/src/backend/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl LoginCtx {
{
// we loop for a maximum of instances.len() times
for _ in 0..self.instances.len() {
let conf = match self.get_config_user_mode(&user_mode) {
let mut conf = match self.get_config_user_mode(&user_mode) {
Some(conf) => conf,
None => continue,
};
Expand Down Expand Up @@ -241,6 +241,10 @@ impl LoginCtx {

warn!("Connection attempt {retry_count} failed: IO error connecting to the instance, {err}, retrying in {delay_seconds}s");
thread::sleep(delay);
match self.get_config_user_mode(&user_mode) {
Some(new_conf) => conf = new_conf,
None => {}
}

Check failure on line 247 in pkcs11/src/backend/login.rs

View workflow job for this annotation

GitHub Actions / clippy

you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> pkcs11/src/backend/login.rs:244:25 | 244 | / match self.get_config_user_mode(&user_mode) { 245 | | Some(new_conf) => conf = new_conf, 246 | | None => {} 247 | | } | |_________________________^ help: try: `if let Some(new_conf) = self.get_config_user_mode(&user_mode) { conf = new_conf }` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match = note: `-D clippy::single-match` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::single_match)]`

Check failure on line 247 in pkcs11/src/backend/login.rs

View workflow job for this annotation

GitHub Actions / clippy

you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> pkcs11/src/backend/login.rs:244:25 | 244 | / match self.get_config_user_mode(&user_mode) { 245 | | Some(new_conf) => conf = new_conf, 246 | | None => {} 247 | | } | |_________________________^ help: try: `if let Some(new_conf) = self.get_config_user_mode(&user_mode) { conf = new_conf }` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match = note: `-D clippy::single-match` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::single_match)]`
}
// Otherwise, return the error
Err(err) => return Err(err.into()),
Expand Down

0 comments on commit 79b94a1

Please sign in to comment.