From dadab486d2ec8a86b30f618d17599c1a563f2163 Mon Sep 17 00:00:00 2001 From: Konstantin Seiler Date: Thu, 23 Jan 2020 19:51:09 +1100 Subject: [PATCH] Don't exit if too many spirc failures. --- src/main.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 988f62b..a461857 100644 --- a/src/main.rs +++ b/src/main.rs @@ -513,16 +513,17 @@ impl Future for Main { while (!self.auto_connect_times.is_empty()) && ((Instant::now() - self.auto_connect_times[0]).as_secs() > 600) { let _ = self.auto_connect_times.remove(0); } - if self.auto_connect_times.len() >= 5 { - error!("Spirc shut down too often. Exiting to avoid too many login attempts."); - return Ok(Async::Ready(())); - } + if let Some(credentials) = self.last_credentials.clone() { - self.auto_connect_times.push(Instant::now()); - self.credentials(credentials); - progress = true; + if self.auto_connect_times.len() >= 5 { + warn!("Spirc shut down too often. Not reconnecting automatically."); + } else { + self.auto_connect_times.push(Instant::now()); + self.credentials(credentials); + } } } + progress = true; } }