Async unbounded fix

modified:   Cargo.lock
	modified:   Cargo.toml
	modified:   src/client.rs
This commit is contained in:
Michael Wain 2024-11-25 19:57:11 +03:00
parent 9f6de14855
commit 23d69ef79f
3 changed files with 7 additions and 7 deletions

2
Cargo.lock generated
View File

@ -1555,13 +1555,13 @@ name = "frida_vpn"
version = "0.1.7"
dependencies = [
"aes-gcm",
"async-channel",
"base64 0.22.1",
"block-modes",
"block-padding",
"chrono",
"clap",
"console-subscriber",
"crossbeam-channel",
"dirs 5.0.1",
"embed-resource",
"env_logger",

View File

@ -37,7 +37,7 @@ env_logger = "0.9"
log = "0.4.20"
futures = "0.3.30"
packet = "0.1.4"
crossbeam-channel = "0.5.13"
async-channel = "2.3.1"
hex = "0.4"
serde_yaml = "0.9.34"
x25519-dalek = { version = "2.0.1", features = ["getrandom", "static_secrets"] }

View File

@ -1,7 +1,7 @@
pub mod general {
use crate::config::ClientConfiguration;
use crossbeam_channel::{Receiver, Sender};
use async_channel::{Receiver, Sender};
use futures::{stream::SplitSink, StreamExt};
use tokio_util::{codec::Framed, sync::CancellationToken};
use tokio::{net::UdpSocket, sync::{Mutex, mpsc}, io::{AsyncWriteExt, AsyncReadExt}, fs::File};
@ -29,7 +29,7 @@ pub mod general {
// TODO: implement custom Error
impl ReadWrapper for DevReader {
async fn read(&mut self, buf: &mut Vec<u8>) -> Result<usize, ()> {
if let Ok(tb) = self.dr.recv() {
if let Ok(tb) = self.dr.recv().await {
*buf = tb;
return Ok(buf.len());
}
@ -70,7 +70,7 @@ pub mod general {
match msg {
WriterMessage::Plain(buf) => {
let l = buf.len();
if let Ok(()) = self.dr.send(buf) {
if let Ok(()) = self.dr.send(buf).await {
return Ok(l);
}
Err(())
@ -278,7 +278,7 @@ pub mod desktop {
use futures::{SinkExt, StreamExt};
use log::info;
use tokio::net::UdpSocket;
use crossbeam_channel::unbounded;
use async_channel::unbounded;
#[cfg(target_os = "linux")]
use network_interface::{NetworkInterface, NetworkInterfaceConfig};
@ -388,7 +388,7 @@ pub mod desktop {
tokio::spawn(async move {
loop {
if let Ok(buf) = wrx.recv() {
if let Ok(buf) = wrx.recv().await {
let _ = dev_writer.send(buf).await;
}
}