modified: src/client.rs
Some checks failed
gitea/Frida-android-native/pipeline/head There was a failure building this commit
Some checks failed
gitea/Frida-android-native/pipeline/head There was a failure building this commit
This commit is contained in:
parent
b2519a7b2a
commit
685b2a7fb9
@ -27,6 +27,8 @@ use crate::jni::FridaLib;
|
|||||||
pub async fn client_mode(client_config: ClientConfiguration, fd: i32, close_token: CancellationToken) {
|
pub async fn client_mode(client_config: ClientConfiguration, fd: i32, close_token: CancellationToken) {
|
||||||
info!("Starting client...");
|
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();
|
let sock = UdpSocket::bind("0.0.0.0:25565").await.unwrap();
|
||||||
sock.connect(&client_config.server.endpoint).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
|
let mut buf = vec![0; 1400]; // mtu
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = cancel_dr.cancelled() => {
|
_ = subtasks_quit.lock().cancelled() => {
|
||||||
info!("Cancellation token has been thrown dev_read_task");
|
info!("Cancellation token has been thrown dev_read_task");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -72,7 +74,7 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, close_toke
|
|||||||
|
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = cancel_sr.cancelled() => {
|
_ = subtasks_quit.lock().cancelled() => {
|
||||||
info!("Cancellation token has been thrown sock_read_task");
|
info!("Cancellation token has been thrown sock_read_task");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -136,6 +138,9 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, close_toke
|
|||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = close_token.cancelled() => {
|
_ = close_token.cancelled() => {
|
||||||
info!("Cancellation token has been thrown");
|
info!("Cancellation token has been thrown");
|
||||||
|
if let Ok(mut l) = subtasks_quit.lock() {
|
||||||
|
l.cancel();
|
||||||
|
}
|
||||||
dev_read_task.await;
|
dev_read_task.await;
|
||||||
sock_read_task.await;
|
sock_read_task.await;
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user