diff options
author | Romeo Disca <romeo.disca@gmail.com> | 2020-08-18 00:11:09 +0200 |
---|---|---|
committer | Romeo Disca <romeo.disca@gmail.com> | 2020-08-18 06:13:12 +0200 |
commit | bfc63947702ffb3ca1dca6e8184f0998fb98ed13 (patch) | |
tree | 50483c4c1c7263968c947615f0cff855c6c73e4d /src/main.rs | |
parent | d50a95ba36c86d49545c9fe7c3bcb85530c48093 (diff) |
chore: non-blocking read stream
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index 28eb8dc..dd068fe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,8 +8,6 @@ use std::error::Error; use std::time::Duration; use std::sync::Arc; -use tokio::sync::Mutex; - use client::*; use commands::Command; @@ -34,14 +32,12 @@ async fn main() -> Result<(), Box<dyn Error>> { client1.stop().await; }); let lst = tokio::spawn(async move { - while client2.is_running().await { - client2.listen().await; - } + client2.listen().await; println!("stop"); }); - lst.await; - cmd.await; + lst.await?; + cmd.await?; Ok(()) } |