From df427814a0e08f40fb1a7fa31eee00842cf8093f Mon Sep 17 00:00:00 2001 From: OliverBalfour <11626018+OliverBalfour@users.noreply.github.com> Date: Sun, 29 Nov 2020 19:51:30 +1100 Subject: [PATCH] Correct chapter 20 final listing In chapter 20 on writing a web server, one of the listings includes `.take(2)` on the TCP stream iterator to only handle 2 requests and then quit. This is as an example to demonstrate that the web server shuts down gracefully. However, this has slipped into the final code listing, which I don't think should include this arbitrary restriction. This pull request amends this error. --- listings/ch20-web-server/listing-20-25/src/bin/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/listings/ch20-web-server/listing-20-25/src/bin/main.rs b/listings/ch20-web-server/listing-20-25/src/bin/main.rs index 22534d2f4e..226423c22c 100644 --- a/listings/ch20-web-server/listing-20-25/src/bin/main.rs +++ b/listings/ch20-web-server/listing-20-25/src/bin/main.rs @@ -12,7 +12,7 @@ fn main() { let listener = TcpListener::bind("127.0.0.1:7878").unwrap(); let pool = ThreadPool::new(4); - for stream in listener.incoming().take(2) { + for stream in listener.incoming() { let stream = stream.unwrap(); pool.execute(|| {