summaryrefslogtreecommitdiff
path: root/src/client/client.rs
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-09-14 22:58:49 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-09-14 22:58:49 +0800
commit3d2874a218b0abe736dffa6d9a6b79c103ca5186 (patch)
treec73677067738f4e6c3d810f7cf70a331705b92e0 /src/client/client.rs
parent6fc21196b8283c397e7fe46e9a266b33166ca7cb (diff)
refactor: move event loop to client
Diffstat (limited to 'src/client/client.rs')
-rw-r--r--src/client/client.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client/client.rs b/src/client/client.rs
index 2a5f595..cc4cea8 100644
--- a/src/client/client.rs
+++ b/src/client/client.rs
@@ -1,11 +1,12 @@
use gethostname::gethostname;
-use std::net::IpAddr;
+use std::{net::IpAddr, thread::sleep, time::Duration};
use whoami::{DesktopEnv, Language};
use crate::connector::Connection;
pub struct Client<C: Connection> {
pub connector: C,
+
ip: Option<IpAddr>,
hostname: String,
device_name: String,
@@ -71,4 +72,11 @@ impl<C: Connection> Client<C> {
c.connector.init(&c);
c
}
+
+ pub fn enter_loop(mut self) -> ! {
+ loop {
+ sleep(Duration::from_millis(500));
+ self.connector.tick();
+ }
+ }
}