client: clear app state after disconnect
This commit is contained in:
parent
c6c7bbc51a
commit
178b6c80ef
|
@ -29,6 +29,11 @@ impl App {
|
|||
tx
|
||||
}
|
||||
|
||||
pub fn clear(&self) {
|
||||
let mut state = self.state.write().unwrap();
|
||||
*state = None;
|
||||
}
|
||||
|
||||
// TODO: async drop til 1st header
|
||||
pub fn subscribe(&self) -> Option<Receiver<Payload>> {
|
||||
let state = self.state.read().unwrap();
|
||||
|
|
|
@ -57,6 +57,7 @@ pub async fn run(app: App) {
|
|||
loop {
|
||||
run_once(&app).await
|
||||
.unwrap_or_else(|e| println!("Client: {:?}", e));
|
||||
app.clear();
|
||||
|
||||
sleep(Duration::from_secs(1)).await;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue