From 2ea25d734a07183b3779379b890bf6a97d974c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Mon, 19 Aug 2024 16:48:24 +0200 Subject: [PATCH] Change instance when attempting a retry --- pkcs11/src/backend/login.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkcs11/src/backend/login.rs b/pkcs11/src/backend/login.rs index 3421f7c2..c885f43e 100644 --- a/pkcs11/src/backend/login.rs +++ b/pkcs11/src/backend/login.rs @@ -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, }; @@ -241,6 +241,9 @@ impl LoginCtx { warn!("Connection attempt {retry_count} failed: IO error connecting to the instance, {err}, retrying in {delay_seconds}s"); thread::sleep(delay); + if let Some(new_conf) = self.get_config_user_mode(&user_mode) { + conf = new_conf; + } } // Otherwise, return the error Err(err) => return Err(err.into()),