1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-21 21:09:22 +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_json",
"sha1",
"tokio",
"url",
"webauthn-rs",
"webpage",

View File

@ -42,4 +42,5 @@ webpage = "1.2.0"
gouth = "0.2.0"
webauthn-rs = "0.3.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())
}
fn stopped(&mut self, ctx: &mut Self::Context) {
fn stopping(&mut self, _: &mut Self::Context) -> Running {
println!("Closed connection to RTC relay.");
let future = async move {
// Propagate information
if let Err(e) = events_helper::propagate_event(Event::ClosedRTCRelayWebSocket).await {
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 {
if let Err(e) = events_helper::propagate_event(Event::UserWsClosed(conn)).await {
eprintln!("Failed to propagate web socket closed event ! {:#?}", e);
} else {
eprintln!("Successfully propagated user ws stopping event!");
}
// TODO : remove
eprintln!("Successfully propagated user ws stopping event!");
};
future.into_actor(self).wait(ctx);
futures::executor::block_on(future);
}
remove_connection(ctx.address());