Better UI waiting
This commit is contained in:
parent
119af02dfa
commit
2d9b9dbf9a
1 changed files with 5 additions and 5 deletions
10
src/lib.rs
10
src/lib.rs
|
|
@ -335,7 +335,7 @@ async fn client_main<Reader: AsyncRead + Unpin, Writer: AsyncWrite + Unpin>(
|
||||||
let (port_sender, mut port_receiver) = mpsc::channel(2);
|
let (port_sender, mut port_receiver) = mpsc::channel(2);
|
||||||
let connections = ConnectionTable::new();
|
let connections = ConnectionTable::new();
|
||||||
|
|
||||||
let ui = tokio::spawn(async move { ui::run_ui(&mut port_receiver).await });
|
let mut ui = tokio::spawn(async move { ui::run_ui(&mut port_receiver).await });
|
||||||
|
|
||||||
// And now really get into it...
|
// And now really get into it...
|
||||||
let (msg_sender, mut msg_receiver) = mpsc::channel(32);
|
let (msg_sender, mut msg_receiver) = mpsc::channel(32);
|
||||||
|
|
@ -349,6 +349,10 @@ async fn client_main<Reader: AsyncRead + Unpin, Writer: AsyncWrite + Unpin>(
|
||||||
let (mut done_writing, mut done_reading) = (false, false);
|
let (mut done_writing, mut done_reading) = (false, false);
|
||||||
while !(done_reading && done_writing) {
|
while !(done_reading && done_writing) {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
|
_ = &mut ui => {
|
||||||
|
// UI said to quit.
|
||||||
|
break;
|
||||||
|
}
|
||||||
result = async {
|
result = async {
|
||||||
loop {
|
loop {
|
||||||
use tokio::time::{sleep, Duration};
|
use tokio::time::{sleep, Duration};
|
||||||
|
|
@ -376,10 +380,6 @@ async fn client_main<Reader: AsyncRead + Unpin, Writer: AsyncWrite + Unpin>(
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(_) = ui.await {
|
|
||||||
//TODO
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue