From 93eea2ba1ef9a6493801ea7211dd8d046588d28a Mon Sep 17 00:00:00 2001 From: Ashelyn Rose Date: Sat, 1 Mar 2025 14:43:02 -0700 Subject: Fix deadlock in unlatch command --- src/system/plugin/autoproxy.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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 } -- cgit 1.4.1