diff options
author | Ashelyn Rose <git@ashen.earth> | 2025-03-01 14:43:02 -0700 |
---|---|---|
committer | Ashelyn Rose <git@ashen.earth> | 2025-03-01 14:43:02 -0700 |
commit | 93eea2ba1ef9a6493801ea7211dd8d046588d28a (patch) | |
tree | 5b8769912af4d78b87e11c96cf12e561cc49d1bf | |
parent | 89bf5a8b4f85583795b9211eaca485d6fc633389 (diff) |
Fix deadlock in unlatch command
-rw-r--r-- | src/system/plugin/autoproxy.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/system/plugin/autoproxy.rs b/src/system/plugin/autoproxy.rs index bba25a5..67d93a0 100644 --- a/src/system/plugin/autoproxy.rs +++ b/src/system/plugin/autoproxy.rs @@ -53,13 +53,22 @@ impl SeancePlugin for Autoproxy { } async fn handle_message(&self, logger: &Logger, system: &System, message: &Message, response: &mut Response) { + let starting_state = {self.current_state.lock().await.clone()}; if message.content.starts_with("\\") { + logger.log_line(None, "Skipping proxy".to_string()).await; + if message.content.starts_with("\\\\") { - if let InnerState::LatchActive {current_member: _, last_message: _} = {self.current_state.lock().await.clone()} { + if let InnerState::LatchActive {current_member: _, last_message: _} = starting_state { + logger.log_line(None, "Unlatching".to_string()).await; {*self.current_state.lock().await = InnerState::LatchInactive}; + logger.log_line(None, "Done".to_string()).await; } } + if message.content == "\\\\" { + logger.log_line(None, "Deleting source message".to_string()).await; + } + *response = Response::Noop { delete_source: message.content == "\\\\" }; return } |