Merge pull request #5212 from sahilyeole/master

seat tries for sovling connection refuse problem while login
This commit is contained in:
RustDesk 2023-08-01 09:37:26 +08:00 committed by GitHub
commit bd914497c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -124,12 +124,24 @@ fn line_values(indices: &[usize], line: &str) -> Vec<String> {
#[inline]
pub fn get_values_of_seat0(indices: &[usize]) -> Vec<String> {
_get_values_of_seat0(indices, true)
_get_values_of_seat0_tries(indices, true, 20)
}
#[inline]
pub fn get_values_of_seat0_with_gdm_wayland(indices: &[usize]) -> Vec<String> {
_get_values_of_seat0(indices, false)
_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, "")
}
fn _get_values_of_seat0(indices: &[usize], ignore_gdm_wayland: bool) -> Vec<String> {