From b6350cb3b3802a1fff2bae98b14a300f30037a30 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 13 Mar 2021 13:46:36 +0100 Subject: [PATCH] Fix issue when closing connection --- src/controllers/calls_controller.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controllers/calls_controller.rs b/src/controllers/calls_controller.rs index c0b60ac..53a4828 100644 --- a/src/controllers/calls_controller.rs +++ b/src/controllers/calls_controller.rs @@ -464,16 +464,16 @@ pub fn handle_event(e: &events_helper::Event) -> Res { // Call active call of user (if any) Event::DeletedConversation(conv_id) => { - let mut conn = None; + let mut connections = vec![]; user_ws_controller::foreach_connection(|f| { if f.is_having_call_with_conversation(conv_id) { - conn = Some(f.clone()); + connections.push(f.clone()); } Ok(()) })?; - if let Some(c) = conn { - make_user_leave_call(conv_id, &c)?; + for con in connections { + make_user_leave_call(conv_id, &con)?; } }