1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 13:29:21 +00:00

Fix propagation issue

This commit is contained in:
Pierre HUBERT 2022-03-12 08:02:58 +01:00
parent 09ce13c554
commit 366d9ee25c
4 changed files with 12 additions and 9 deletions

1
Cargo.lock generated
View File

@ -735,6 +735,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"sha1", "sha1",
"tokio",
"url", "url",
"webauthn-rs", "webauthn-rs",
"webpage", "webpage",

View File

@ -43,3 +43,4 @@ gouth = "0.2.0"
webauthn-rs = "0.3.2" webauthn-rs = "0.3.2"
url = "2.2.2" url = "2.2.2"
async-recursion = "1.0.0" async-recursion = "1.0.0"
tokio = "1.17.0"

View File

@ -99,18 +99,20 @@ impl actix::Actor for RtcRelayActor {
}).unwrap()) }).unwrap())
} }
fn stopped(&mut self, ctx: &mut Self::Context) { fn stopping(&mut self, _: &mut Self::Context) -> Running {
println!("Closed connection to RTC relay."); println!("Closed connection to RTC relay.");
let future = async move { let future = async move {
// Propagate information // Propagate information
if let Err(e) = events_helper::propagate_event(Event::ClosedRTCRelayWebSocket).await { if let Err(e) = events_helper::propagate_event(Event::ClosedRTCRelayWebSocket).await {
eprintln!("Failed to propagate rtc closed event! {:#?}", e); eprintln!("Failed to propagate rtc closed event! {:#?}", e);
} else {
eprintln!("Successfully propagated RTC relay stopped event!");
} }
eprintln!("Successfully propagated RTC relay stopped envent!");
}; };
future.into_actor(self).wait(ctx); futures::executor::block_on(future);
Running::Stop
} }
} }

View File

@ -320,13 +320,12 @@ impl Actor for WsSession {
let future = async move { let future = async move {
if let Err(e) = events_helper::propagate_event(Event::UserWsClosed(conn)).await { if let Err(e) = events_helper::propagate_event(Event::UserWsClosed(conn)).await {
eprintln!("Failed to propagate web socket closed event ! {:#?}", e); eprintln!("Failed to propagate web socket closed event ! {:#?}", e);
} } else {
// TODO : remove
eprintln!("Successfully propagated user ws stopping event!"); eprintln!("Successfully propagated user ws stopping event!");
}
}; };
future.into_actor(self).wait(ctx); futures::executor::block_on(future);
} }
remove_connection(ctx.address()); remove_connection(ctx.address());