Add release build config

This commit is contained in:
Stanislav N Mikhailov
2026-07-10 22:22:24 +03:00
parent 1f9ec39381
commit b7b028fc92
2 changed files with 10 additions and 3 deletions
+7
View File
@@ -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"] }
+3 -3
View File
@@ -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?;
}