commit 77bef8bb6bdcb6808a79e6e85ae54c6326b3fc7f
parent 054852d93bacf21a31bb50486fcc5b78e5600136
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Fri, 7 Apr 2023 17:03:06 -0700
cleanup
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/main.rs b/src/main.rs
@@ -294,6 +294,10 @@ impl LeChatPHPClient {
let tx = self.tx.clone();
let send_to = self.config.keepalive_send_to.clone();
thread::spawn(move || loop {
+ let clb = || {
+ tx.send(PostType::Post("<keepalive>".to_owned(), send_to.clone())).unwrap();
+ tx.send(PostType::DeleteLast).unwrap();
+ };
let timeout = after(Duration::from_secs(60 * 75));
select! {
// Whenever we send a message to chat server,
@@ -301,10 +305,7 @@ impl LeChatPHPClient {
// and reset the timer for next keepalive.
recv(&last_post_rx) -> _ => {},
recv(&exit_rx) -> _ => return,
- recv(&timeout) -> _ => {
- tx.send(PostType::Post("<keepalive>".to_owned(), send_to.clone())).unwrap();
- tx.send(PostType::DeleteLast).unwrap();
- },
+ recv(&timeout) -> _ => clb(),
}
})
}