Skip to content

Commit

Permalink
examples: fix echo example by reintroducing concurrency (#1107)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbarsky authored Nov 17, 2020
1 parent 103689a commit 0d661b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/examples/echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
// Essentially here we're executing a new task to run concurrently,
// which will allow all of our clients to be processed concurrently.

tokio::spawn(async move {
let fut = async move {
let mut buf = [0; 1024];

// In a loop, read data from the socket and write the data back.
Expand Down Expand Up @@ -115,8 +115,8 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {

info!(message = "echo'd data", %peer_addr, size = n);
}
})
.instrument(info_span!("echo", %peer_addr))
.await?;
}
.instrument(info_span!("echo", %peer_addr));
tokio::spawn(fut);
}
}

0 comments on commit 0d661b6

Please sign in to comment.