From 3d2874a218b0abe736dffa6d9a6b79c103ca5186 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 14 Sep 2025 22:58:49 +0800 Subject: refactor: move event loop to client --- src/client/client.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/client/client.rs') 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 { pub connector: C, + ip: Option, hostname: String, device_name: String, @@ -71,4 +72,11 @@ impl Client { c.connector.init(&c); c } + + pub fn enter_loop(mut self) -> ! { + loop { + sleep(Duration::from_millis(500)); + self.connector.tick(); + } + } } -- cgit v1.2.3