Fix UI not updating when connecting to room fails
This commit is contained in:
parent
6c637390e4
commit
2201e04e15
1 changed files with 7 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ pub enum EuphRoomEvent {
|
||||||
Connected,
|
Connected,
|
||||||
Disconnected,
|
Disconnected,
|
||||||
Packet(Box<ParsedPacket>),
|
Packet(Box<ParsedPacket>),
|
||||||
|
Stopped,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
@ -77,6 +78,11 @@ impl State {
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
error!("e&{name}: {}", e);
|
error!("e&{name}: {}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure that whoever is using this room knows that it's gone.
|
||||||
|
// Otherwise, the users of the Room may be left in an inconsistent or
|
||||||
|
// outdated state, and the UI may not update correctly.
|
||||||
|
let _ = euph_room_event_tx.send(EuphRoomEvent::Stopped);
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn reconnect(
|
async fn reconnect(
|
||||||
|
|
@ -98,6 +104,7 @@ impl State {
|
||||||
event_tx.send(Event::Disconnected)?;
|
event_tx.send(Event::Disconnected)?;
|
||||||
} else {
|
} else {
|
||||||
info!("e&{}: could not connect", name);
|
info!("e&{}: could not connect", name);
|
||||||
|
event_tx.send(Event::Disconnected)?;
|
||||||
}
|
}
|
||||||
tokio::time::sleep(Duration::from_secs(5)).await; // TODO Make configurable
|
tokio::time::sleep(Duration::from_secs(5)).await; // TODO Make configurable
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue