diff options
author | Adam Carpenter <53hornet@gmail.com> | 2019-03-26 15:50:24 -0400 |
---|---|---|
committer | Adam Carpenter <53hornet@gmail.com> | 2019-03-26 15:50:24 -0400 |
commit | b560fca37f6571c18b12d6fff4b3e86e549db6be (patch) | |
tree | 1f8a9f228e57b35ba19360b0ab97fd60182a768f /hello_server/src/bin | |
parent | 5718a0b54869b341bc74416bf82b716aa15d582c (diff) | |
download | learning-rust-b560fca37f6571c18b12d6fff4b3e86e549db6be.tar.xz learning-rust-b560fca37f6571c18b12d6fff4b3e86e549db6be.zip |
Added graceful termination. Book done for real this time XD
Diffstat (limited to 'hello_server/src/bin')
-rw-r--r-- | hello_server/src/bin/main.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hello_server/src/bin/main.rs b/hello_server/src/bin/main.rs index 522777a..bcf1e46 100644 --- a/hello_server/src/bin/main.rs +++ b/hello_server/src/bin/main.rs @@ -10,7 +10,7 @@ fn main() { let listener = TcpListener::bind("127.0.0.1:7878").unwrap(); let pool = ThreadPool::new(4).unwrap(); - for stream in listener.incoming() { + for stream in listener.incoming().take(2) { let stream = stream.unwrap(); pool.execute(|| { @@ -18,6 +18,8 @@ fn main() { }); } + println!("shutting down..."); + } fn handle_connection(mut stream: TcpStream) { |