Skip to content

Commit 19dcced

Browse files
authored
Merge pull request #846 from ryanbrainard/book-fix-accept-loop
Book: Accept Loop Variable Fixes
2 parents f9c8974 + 50e7cf0 commit 19dcced

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: docs/src/patterns/accept-loop.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ async fn accept_loop(addr: impl ToSocketAddrs) -> Result<()> {
121121
let listener = TcpListener::bind(addr).await?;
122122
let mut incoming = listener.incoming();
123123
while let Some(result) = incoming.next().await {
124-
let stream = match stream {
124+
let stream = match result {
125125
Err(ref e) if is_connection_error(e) => continue, // 1
126126
Err(e) => {
127-
eprintln!("Error: {}. Pausing for 500ms."); // 3
127+
eprintln!("Error: {}. Pausing for 500ms.", e); // 3
128128
task::sleep(Duration::from_millis(500)).await; // 2
129129
continue;
130130
}

0 commit comments

Comments
 (0)