chore: sytle

This commit is contained in:
2020-08-30 00:37:28 +08:00
parent e8dc9a49fb
commit 9eaaa185ca
2 changed files with 8 additions and 17 deletions

View File

@@ -13,22 +13,16 @@ fn main() {
let mut data = [0_u8; 6]; // using 6 byte buffer let mut data = [0_u8; 6]; // using 6 byte buffer
match stream.read_exact(&mut data) { match stream.read_exact(&mut data) {
Ok(_) => { Ok(_) => if &data == msg {
if &data == msg { println!("Reply is ok!");
println!("Reply is ok!"); } else {
} else { let text = from_utf8(&data).unwrap();
let text = from_utf8(&data).unwrap(); println!("Unexpected reply: {}", text);
println!("Unexpected reply: {}", text);
}
}, },
Err(e) => { Err(e) => println!("Failed to receive data: {}", e),
println!("Failed to receive data: {}", e);
}
} }
}, },
Err(e) => { Err(e) => println!("Failed to connect: {}", e),
println!("Failed to connect: {}", e);
}
} }
println!("Terminated."); println!("Terminated.");
} }

View File

@@ -31,10 +31,7 @@ fn main() {
handle_client(stream) handle_client(stream)
}); });
}, },
Err(e) => { Err(e) => println!("Error: {}", e),
println!("Error: {}", e);
/* connection failed */
},
} }
} }
// close the socket server // close the socket server