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-12 17:10:44 +03:00
parent 2818a34862
commit b87703d285

View File

@ -119,12 +119,14 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, env: &JNIE
let s_cipher = cipher_shared.clone(); let s_cipher = cipher_shared.clone();
loop { loop {
if close_token.is_cancelled() { tokio::select! {
_ = close_token.cancelled() => {
sock_read_task.abort(); sock_read_task.abort();
dev_read_task.abort(); dev_read_task.abort();
return; break;
} }
if let Ok(bytes) = rx.try_recv() { rr = rx.recv() => {
if let Ok(bytes) = rr {
ltx.send("Write to tun.".as_bytes().to_vec()); ltx.send("Write to tun.".as_bytes().to_vec());
if let Err(e) = dev_writer.write_all(&bytes).await { if let Err(e) = dev_writer.write_all(&bytes).await {
ltx.send(format!("Writing error: {:?}", e).as_bytes().to_vec()); ltx.send(format!("Writing error: {:?}", e).as_bytes().to_vec());
@ -133,10 +135,14 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, env: &JNIE
ltx.send(format!("Flushing error: {:?}", e).as_bytes().to_vec()); ltx.send(format!("Flushing error: {:?}", e).as_bytes().to_vec());
} }
} }
if let Ok(bytes) = lrx.try_recv() { }
rr1 = lrx.recv() {
if let Ok(bytes) = rr1 {
FridaLib::traceFromNative(&env, String::from_utf8_lossy(&bytes).to_string()); FridaLib::traceFromNative(&env, String::from_utf8_lossy(&bytes).to_string());
} }
if let Ok(bytes) = mx.try_recv() { }
rr2 = mx.recv() {
if let Ok(bytes) = rr2 {
let s_c = s_cipher.lock().await; let s_c = s_cipher.lock().await;
if s_c.is_some() { if s_c.is_some() {
@ -156,6 +162,7 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, env: &JNIE
ltx.send("There is no shared_secret in main loop".as_bytes().to_vec()); ltx.send("There is no shared_secret in main loop".as_bytes().to_vec());
} }
} }
//ltx.send("We've got there!".as_bytes().to_vec()); }
};
} }
} }