diff --git a/src/main.rs b/src/main.rs index c3a5860..8f16351 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,10 +15,12 @@ fn main() { let listener = TcpListener::bind("127.0.0.1:4762").unwrap(); let pool = ThreadPool::new(4); for stream in listener.incoming() { - let stream = stream.unwrap(); - pool.execute(|| { - handle_connection(stream); - }); + match stream { + Ok(s) => pool.execute(|| { + handle_connection(s); + }), + Err(e) => println!("invalid stream: {:?}\n", e), + } } }