diff --git a/src/client.rs b/src/client.rs index 87905f7..3efb6a6 100644 --- a/src/client.rs +++ b/src/client.rs @@ -17,7 +17,7 @@ use crate::udp::{UDPVpnPacket, UDPVpnHandshake, UDPSerializable}; use network_interface::NetworkInterface; use network_interface::NetworkInterfaceConfig; -pub async fn client_mode(client_config: ClientConfiguration, fd: i32) { +pub async fn client_mode(client_config: ClientConfiguration, fd: i32) -> i16 { info!("Starting client..."); let sock = UdpSocket::bind("0.0.0.0:25565").await.unwrap(); @@ -136,10 +136,9 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32) { } }*/ let mut buf = vec![0; 2048]; - loop { - while let Ok(n) = dev.read(&mut buf) { - info!("Read from tun. {:?} bytes", n); - } + while let Ok(n) = dev.read(&mut buf) { + info!("Read from tun. {:?} bytes", n); } info!("end."); + -2 } \ No newline at end of file diff --git a/src/mobile.rs b/src/mobile.rs index 992fdd1..c1cc466 100644 --- a/src/mobile.rs +++ b/src/mobile.rs @@ -8,7 +8,7 @@ use jni::sys::jint; pub fn mobile_run(cfg_raw: String, close_fd_on_drop: bool, tun_fd: jint) -> c_int { let config: ClientConfiguration = serde_yaml::from_slice(RFC4648.decode(cfg_raw.as_bytes()).unwrap().as_slice()).expect("Bad client config file structure"); - client::client_mode(config, tun_fd).await; + client::client_mode(config, tun_fd).await /*let block = async move { let mut config = tun2::Configuration::default(); @@ -20,7 +20,6 @@ pub fn mobile_run(cfg_raw: String, close_fd_on_drop: bool, tun_fd: jint) -> c_in join_handle.await.map_err(std::io::Error::from)? };*/ - -1 } pub fn mobile_stop() -> c_int {