From 488b2455b7d9e2f16bcd74e4aa04073e292b157e Mon Sep 17 00:00:00 2001 From: rustdesk Date: Thu, 3 Mar 2022 20:46:27 +0800 Subject: [PATCH] another possible cpu burning --- src/server/connection.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server/connection.rs b/src/server/connection.rs index 32d489140..529e0d7e5 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -112,7 +112,9 @@ impl Connection { challenge: Config::get_auto_password(), ..Default::default() }; - let (tx_from_cm, mut rx_from_cm) = mpsc::unbounded_channel::(); + let (tx_from_cm_holder, mut rx_from_cm) = mpsc::unbounded_channel::(); + // holding tx_from_cm_holde to avoid cpu burning of rx_from_cm.recv when all sender closed + let tx_from_cm = tx_from_cm_holder.clone(); let (tx_to_cm, rx_to_cm) = mpsc::unbounded_channel::(); let (tx, mut rx) = mpsc::unbounded_channel::<(Instant, Arc)>(); let (tx_video, mut rx_video) = mpsc::unbounded_channel::<(Instant, Arc)>();