modified: src/client.rs
Some checks failed
gitea/Frida-android-native/pipeline/head There was a failure building this commit

This commit is contained in:
Michael Wain 2024-10-13 20:56:28 +03:00
parent b2519a7b2a
commit 685b2a7fb9

View File

@ -27,6 +27,8 @@ use crate::jni::FridaLib;
pub async fn client_mode(client_config: ClientConfiguration, fd: i32, close_token: CancellationToken) {
info!("Starting client...");
let subtasks_quit: std::sync::Mutex<tokio_util::sync::CancellationToken> = std::sync::Mutex::new(tokio_util::sync::CancellationToken::new());
let sock = UdpSocket::bind("0.0.0.0:25565").await.unwrap();
sock.connect(&client_config.server.endpoint).await.unwrap();
@ -49,7 +51,7 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, close_toke
let mut buf = vec![0; 1400]; // mtu
loop {
tokio::select! {
_ = cancel_dr.cancelled() => {
_ = subtasks_quit.lock().cancelled() => {
info!("Cancellation token has been thrown dev_read_task");
return;
}
@ -72,7 +74,7 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, close_toke
loop {
tokio::select! {
_ = cancel_sr.cancelled() => {
_ = subtasks_quit.lock().cancelled() => {
info!("Cancellation token has been thrown sock_read_task");
return;
}
@ -136,6 +138,9 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, close_toke
tokio::select! {
_ = close_token.cancelled() => {
info!("Cancellation token has been thrown");
if let Ok(mut l) = subtasks_quit.lock() {
l.cancel();
}
dev_read_task.await;
sock_read_task.await;
return;