Fix/linux keep terminal sessions (#12222)

* fix: linux, keep terminal sessions

Signed-off-by: fufesou <linlong1266@gmail.com>

* fix: terminal service stucked at reader join

Signed-off-by: fufesou <linlong1266@gmail.com>

---------

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2025-07-03 17:27:50 +08:00
committed by GitHub
parent 7ad3023285
commit f766d28c36
3 changed files with 88 additions and 13 deletions

View File

@@ -370,6 +370,12 @@ fn should_start_server(
&& ((*cm0 && last_restart.elapsed().as_secs() > 60)
|| last_restart.elapsed().as_secs() > 3600)
{
let terminal_session_count = crate::ipc::get_terminal_session_count().unwrap_or(0);
if terminal_session_count > 0 {
// There are terminal sessions, so we don't restart the server.
// We also need to keep `cm0` unchanged, so that we can reach this branch the next time.
return false;
}
// restart server if new connections all closed, or every one hour,
// as a workaround to resolve "SpotUdp" (dns resolve)
// and x server get displays failure issue