stop on internal app state
This commit is contained in:
parent
1995aaa858
commit
c32b0d289e
1 changed files with 5 additions and 3 deletions
|
@ -69,6 +69,7 @@ enum CurrentScreen {
|
||||||
Main,
|
Main,
|
||||||
Sending,
|
Sending,
|
||||||
Receiving,
|
Receiving,
|
||||||
|
Stopping,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
|
@ -84,8 +85,8 @@ impl App {
|
||||||
loop {
|
loop {
|
||||||
terminal.draw(|frame| self.draw(frame))?;
|
terminal.draw(|frame| self.draw(frame))?;
|
||||||
self.handle_events().await?;
|
self.handle_events().await?;
|
||||||
let rstate = self.state.running_state.lock().await;
|
|
||||||
if *rstate == RunningState::Stopping {
|
if self.screen == CurrentScreen::Stopping {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let peers = self.state.peers.lock().await;
|
let peers = self.state.peers.lock().await;
|
||||||
|
@ -126,8 +127,9 @@ impl App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn exit(&self) {
|
async fn exit(&mut self) {
|
||||||
self.state.stop().await;
|
self.state.stop().await;
|
||||||
|
self.screen = CurrentScreen::Stopping;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn send(&mut self) {
|
async fn send(&mut self) {
|
||||||
|
|
Loading…
Reference in a new issue