You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have encounted a new issue, if client don't disconnect positively(connection is the stream type, client receive the push message from server), service will block on .await forever even after received the Ctrl+ C signal, how to get the all connection handlers and disconnect?
#[tokio::main]
async fn main() {
// pull this out into a variable so it can be shared between tasks
let data = Arc::new(Mutex::new(vec![]));
let game = Game { data: Arc::clone(&data) };
let mut route = Server::builder().add_service(GameServer::new(game));
// register callback when shutdown
route.serve_with_shutdown(addr, async move {
tokio::signal::ctrl_c().await.unwrap();
// println!("received ctrl+C"); // <--- can running to here.
// tonic::alose_all_stream(); // how to close all conection for client ?
}).await.unwrap();
// <---- can't reach here
// somehow actually save the data
let data = data.lock();
println!("saving {:?}", data);
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have encounted a new issue, if client don't disconnect positively(connection is the stream type, client receive the push message from server), service will block on .await forever even after received the Ctrl+ C signal, how to get the all connection handlers and disconnect?
in my.proto
Beta Was this translation helpful? Give feedback.
All reactions