Merge pull request #5276 from sahilyeole/master

Improved fix for connection refused on restart/logout lightdm
This commit is contained in:
RustDesk 2023-08-09 21:21:19 +08:00 committed by GitHub
commit d3b305ced3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 16 deletions

View File

@ -124,24 +124,12 @@ fn line_values(indices: &[usize], line: &str) -> Vec<String> {
#[inline]
pub fn get_values_of_seat0(indices: &[usize]) -> Vec<String> {
_get_values_of_seat0_tries(indices, true, 20)
_get_values_of_seat0(indices, true)
}
#[inline]
pub fn get_values_of_seat0_with_gdm_wayland(indices: &[usize]) -> Vec<String> {
_get_values_of_seat0_tries(indices, false, 20)
}
fn _get_values_of_seat0_tries(indices: &[usize], ignore_gdm_wayland: bool, attempts: usize) -> Vec<String> {
for _ in 0..attempts{
let value = _get_values_of_seat0(indices, ignore_gdm_wayland);
if value != line_values(indices, "") {
return value;
}
// Wait for 300ms and try again
std::thread::sleep(std::time::Duration::from_millis(300));
}
line_values(indices, "")
_get_values_of_seat0(indices, false)
}
fn _get_values_of_seat0(indices: &[usize], ignore_gdm_wayland: bool) -> Vec<String> {

View File

@ -1073,11 +1073,13 @@ mod desktop {
}
pub fn refresh(&mut self) {
let seat0_values = get_values_of_seat0(&[0, 1, 2]);
if !self.sid.is_empty() && is_active(&self.sid) {
return;
if self.sid == seat0_values[0] {
return;
}
}
let seat0_values = get_values_of_seat0(&[0, 1, 2]);
if seat0_values[0].is_empty() {
*self = Self::default();
self.is_rustdesk_subprocess = false;