Reconnect Client after disconnect in iced_sentinel
This commit is contained in:
parent
88a688e6ab
commit
df62075040
2 changed files with 8 additions and 6 deletions
|
|
@ -46,18 +46,20 @@ async fn run(mut receiver: mpsc::Receiver<Input>) {
|
|||
&mut stream,
|
||||
Input::Connected {
|
||||
at: SystemTime::now(),
|
||||
version,
|
||||
version: version.clone(),
|
||||
},
|
||||
)
|
||||
.await;
|
||||
|
||||
while let Some(input) = receiver.recv().await {
|
||||
if send(&mut stream, input).await.is_err() {
|
||||
break;
|
||||
match send(&mut stream, input).await {
|
||||
Ok(()) => {}
|
||||
Err(error) => {
|
||||
log::warn!("Error sending message to sentinel server: {error}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
Err(_) => {
|
||||
time::sleep(time::Duration::from_secs(2)).await;
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ pub fn run() -> impl Stream<Item = Event> {
|
|||
},
|
||||
State::Connected(stream) => match receive(stream).await {
|
||||
Ok((stream, input)) => {
|
||||
let event = match dbg!(input) {
|
||||
let event = match input {
|
||||
Input::Connected { at, version } => {
|
||||
Event::Connected { at, version }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue