This commit is contained in:
AJ ONeal 2018-10-02 14:56:26 -06:00
parent 1416356db9
commit da89562800
1 ha cambiato i file con 2 aggiunte e 6 eliminazioni

Vedi File

@ -24,11 +24,6 @@ fn main() {
let counter = Arc::clone(&counter);
tasks.run(move || {
{
// in a subscope to release borrow automatically
let mut count = counter.lock().unwrap();
*count += 1;
}
handle_connection(counter, stream);
});
}
@ -44,7 +39,8 @@ fn handle_connection(counter: Arc<Mutex<usize>>, mut stream: TcpStream) {
{
// in a subscope to unlock automatically
let count = counter.lock().unwrap();
let mut count = counter.lock().unwrap();
*count += 1;
println!("Request: {}\n{}", count, String::from_utf8_lossy(&buffer[..]));
}