summaryrefslogtreecommitdiff
path: root/client-native-lib
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-10-13 17:53:50 +0200
committermetamuffin <metamuffin@disroot.org>2022-10-13 17:53:50 +0200
commitd081461dd7fe2a6db94b196324bc485c10a77c7a (patch)
treeaf467fcac40f12943941c1ee128c612dbf40b114 /client-native-lib
parentbc8bba637e51d1c813c3edcf8747991dc69319e9 (diff)
downloadkeks-meet-d081461dd7fe2a6db94b196324bc485c10a77c7a.tar
keks-meet-d081461dd7fe2a6db94b196324bc485c10a77c7a.tar.bz2
keks-meet-d081461dd7fe2a6db94b196324bc485c10a77c7a.tar.zst
show progress in human readable format
Diffstat (limited to 'client-native-lib')
-rw-r--r--client-native-lib/src/instance.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/client-native-lib/src/instance.rs b/client-native-lib/src/instance.rs
index cd720f1..162241d 100644
--- a/client-native-lib/src/instance.rs
+++ b/client-native-lib/src/instance.rs
@@ -44,6 +44,24 @@ impl Instance {
})
}
+ pub async fn spawn_ping(self: &Arc<Self>) {
+ let blub = self.clone();
+ tokio::spawn(async move {
+ loop {
+ blub.ping();
+ }
+ });
+ }
+
+ pub async fn ping(&self) {
+ self.conn
+ .send
+ .write()
+ .await
+ .send(ServerboundPacket::Ping)
+ .await;
+ }
+
pub async fn my_id(&self) -> usize {
self.my_id.read().await.expect("not initialized yet")
}