diff --git a/Cargo.toml b/Cargo.toml index 1721bd1..7861eed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,5 +3,12 @@ name = "nocloud-core" version = "0.1.0" edition = "2024" +[profile.release] +opt-level = 3 +lto = true +codegen-units = 1 +strip = true +panic = "abort" + [dependencies] tokio = { version = "1", features = ["full"] } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 08c7bbe..bb88d0f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,7 @@ use tokio::net::{TcpListener, TcpStream}; #[tokio::main] async fn main() -> io::Result<()> { - let listener = TcpListener::bind("127.0.0.1:32768").await?; + let listener = TcpListener::bind("192.168.1.152:32768").await?; println!("Сервер слушает 127.0.0.1:32768"); @@ -24,7 +24,7 @@ async fn main() -> io::Result<()> { } async fn handle_client(mut stream:TcpStream) -> io::Result<()> { - let mut buffer = [0_u8; 1024]; + let mut buffer = [0_u8; 3]; loop { let bytes_read = stream.read(&mut buffer).await?; @@ -32,7 +32,7 @@ async fn handle_client(mut stream:TcpStream) -> io::Result<()> { return Ok(()); } - println!("получено {bytes_read} байт"); + println!("получено {bytes_read} байт {:?}", String::from_utf8_lossy(&buffer[..bytes_read])); stream.write_all(&buffer[..bytes_read]).await?; }