From: Stephen Seo Date: Mon, 17 Mar 2025 08:23:52 +0000 (+0900) Subject: Fix prev commit: no passwd close on disconnect X-Git-Tag: 0.5.0^2~5 X-Git-Url: https://git.seodisparate.com/stephenseo/static/git-logo.png?a=commitdiff_plain;h=dd31ed3957e106ecc519c7e84c24b031a365134d;p=mpd_info_screen Fix prev commit: no passwd close on disconnect --- diff --git a/src/display.rs b/src/display.rs index e3d8607..85a9e05 100644 --- a/src/display.rs +++ b/src/display.rs @@ -759,7 +759,7 @@ impl MPDDisplay { } pub fn is_authenticated(&self) -> bool { - self.password_entered && self.is_authenticated + self.is_authenticated } pub fn get_is_mpd_handler_stopped(&self) -> Result { diff --git a/src/main.rs b/src/main.rs index c942512..c4dba05 100644 --- a/src/main.rs +++ b/src/main.rs @@ -75,6 +75,8 @@ fn main() -> Result<(), String> { } println!("Got host addr == {}, port == {}", opt.host, opt.port); + let password_opted = opt.password_file.is_some() || opt.enable_prompt_password; + // Read password from file if exists, error otherwise. if let Some(psswd_file_path) = opt.password_file.as_ref() { let mut file = File::open(psswd_file_path).expect("pfile/password_file should exist"); @@ -115,7 +117,8 @@ fn main() -> Result<(), String> { event_loop.run(move |mut event, _window_target, control_flow| { if !ctx.continuing || ctx.quit_requested - || (display.is_authenticated() && display.get_is_mpd_handler_stopped().unwrap_or(false)) + || ((!password_opted || display.is_authenticated()) + && display.get_is_mpd_handler_stopped().unwrap_or(false)) { *control_flow = ControlFlow::Exit; return;