From 3065888bce6abe4580362b56f80bfbc7d405593c Mon Sep 17 00:00:00 2001 From: Riccardo Zaglia Date: Mon, 4 Dec 2023 01:08:44 +0800 Subject: [PATCH] fix(server): :bug: Fix busy loop in server handshake --- alvr/server/src/connection.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/alvr/server/src/connection.rs b/alvr/server/src/connection.rs index 45de17d01e..b56d959f27 100644 --- a/alvr/server/src/connection.rs +++ b/alvr/server/src/connection.rs @@ -243,11 +243,15 @@ pub fn handshake_loop() { warn!("UDP handshake listening error: {e:?}"); thread::sleep(RETRY_CONNECT_MIN_INTERVAL); - continue; } }; + if clients.is_empty() { + thread::sleep(RETRY_CONNECT_MIN_INTERVAL); + continue; + } + for (client_hostname, client_ip) in clients { let trusted = { let mut data_manager = SERVER_DATA_MANAGER.write(); @@ -290,6 +294,8 @@ pub fn handshake_loop() { thread::sleep(RETRY_CONNECT_MIN_INTERVAL); } + } else { + thread::sleep(RETRY_CONNECT_MIN_INTERVAL); } }