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
f23f931cdd
commit
89a12509ed
@ -1,6 +1,6 @@
|
||||
//use crossbeam_channel::unbounded;
|
||||
use socket2::SockAddr;
|
||||
use tokio::{net::UdpSocket, sync::{Mutex, mpsc, oneshot}, io::{BufReader, BufWriter, AsyncWriteExt, AsyncReadExt}, fs::File};
|
||||
use tokio::{net::UdpSocket, sync::{Mutex, mpsc}, io::{BufReader, BufWriter, AsyncWriteExt, AsyncReadExt}, fs::File};
|
||||
use tokio_util::sync::CancellationToken;
|
||||
use base64::prelude::*;
|
||||
use log::{error, info, warn};
|
||||
@ -44,13 +44,13 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, close_toke
|
||||
|
||||
let cipher_shared: Arc<Mutex<Option<x25519_dalek::SharedSecret>>> = Arc::new(Mutex::new(None));
|
||||
|
||||
let (cancel_dr, mut listen_dr) = oneshot::channel();
|
||||
let cancel_dr = close_token.clone();
|
||||
let dev_read_task = tokio::spawn(async move {
|
||||
let mut buf = vec![0; 1400]; // mtu
|
||||
let listen = listen_dr.clone();
|
||||
loop {
|
||||
tokio::select! {
|
||||
_ = listen => {
|
||||
_ = cancel_dr.cancelled() => {
|
||||
return;
|
||||
}
|
||||
rr = dev_reader.read(&mut buf) => {
|
||||
@ -66,13 +66,13 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, close_toke
|
||||
let priv_key = BASE64_STANDARD.decode(client_config.client.private_key).unwrap();
|
||||
|
||||
let cipher_shared_clone = cipher_shared.clone();
|
||||
let (cancel_sr, mut listen_sr) = oneshot::channel();
|
||||
let cancel_sr = close_token.clone();
|
||||
let sock_read_task = tokio::spawn(async move {
|
||||
let mut buf = vec![0; 4096];
|
||||
|
||||
loop {
|
||||
tokio::select! {
|
||||
_ = listen_sr => {
|
||||
_ = cancel_sr.cancelled() => {
|
||||
return;
|
||||
}
|
||||
rr = sock_rec.recv(&mut buf) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user