Skip to content

Commit

Permalink
Merge pull request #846 from ryanbrainard/book-fix-accept-loop
Browse files Browse the repository at this point in the history
Book: Accept Loop Variable Fixes
  • Loading branch information
yoshuawuyts authored Aug 3, 2020
2 parents f9c8974 + 50e7cf0 commit 19dcced
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/src/patterns/accept-loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ async fn accept_loop(addr: impl ToSocketAddrs) -> Result<()> {
let listener = TcpListener::bind(addr).await?;
let mut incoming = listener.incoming();
while let Some(result) = incoming.next().await {
let stream = match stream {
let stream = match result {
Err(ref e) if is_connection_error(e) => continue, // 1
Err(e) => {
eprintln!("Error: {}. Pausing for 500ms."); // 3
eprintln!("Error: {}. Pausing for 500ms.", e); // 3
task::sleep(Duration::from_millis(500)).await; // 2
continue;
}
Expand Down

0 comments on commit 19dcced

Please sign in to comment.