fix: set nodelay on socket

This commit is contained in:
Michel de Graaf
2025-10-13 10:12:04 +02:00
parent cd3dca40c5
commit 9ccc4fa1e9
9 changed files with 343 additions and 249 deletions
+27 -20
View File
@@ -11,30 +11,37 @@ fn main() {
client.connect();
match client.login() {
Ok(_) => match client
.search("michel test file", Duration::from_secs(20))
{
Ok(results) => {
if let Some(result) =
results.iter().find(|r| !r.files.is_empty())
{
let file = result.files[0].clone();
match client.download(file.name, file.username, file.size) {
Ok(download_result) => {
println!("Download result: {:?}", download_result);
}
Err(e) => {
eprintln!("Failed to download: {}", e);
Ok(_) => {
match client.search("michel test file", Duration::from_secs(1)) {
Ok(results) => {
if let Some(result) =
results.iter().find(|r| !r.files.is_empty())
{
let file = result.files[0].clone();
match client.download(
file.name,
file.username,
file.size,
) {
Ok(download_result) => {
println!(
"Download result: {:?}",
download_result
);
}
Err(e) => {
eprintln!("Failed to download: {}", e);
}
}
} else {
eprint!("No results")
}
} else {
eprint!("No results")
}
Err(e) => {
eprintln!("Failed to search: {}", e);
}
}
Err(e) => {
eprintln!("Failed to search: {}", e);
}
},
}
Err(e) => {
eprintln!("Failed to login: {}", e);
}