Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server_core): 🐛 Fix server locking the session unnecessarily #2619

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions alvr/server_core/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,14 @@ pub fn handshake_loop(ctx: Arc<ConnectionContext>, lifecycle_state: Arc<RwLock<L
dbg_connection!("handshake_loop: Try connect to wired device");

let mut wired_client_ips = HashMap::new();
if let Some((client_hostname, _)) =
SESSION_MANAGER
.read()
.client_list()
.iter()
.find(|(hostname, info)| {
info.connection_state == ConnectionState::Disconnected
&& hostname.as_str() == WIRED_CLIENT_HOSTNAME
})
if SESSION_MANAGER
.read()
.client_list()
.iter()
.any(|(hostname, info)| {
info.connection_state == ConnectionState::Disconnected
&& hostname.as_str() == WIRED_CLIENT_HOSTNAME
})
{
// Make sure the wired connection is created once and kept alive
let wired_connection = if let Some(connection) = &wired_connection {
Expand Down Expand Up @@ -320,7 +319,7 @@ pub fn handshake_loop(ctx: Arc<ConnectionContext>, lifecycle_state: Arc<RwLock<L
}

let client_ip = IpAddr::V4(Ipv4Addr::LOCALHOST);
wired_client_ips.insert(client_ip, client_hostname.to_owned());
wired_client_ips.insert(client_ip, WIRED_CLIENT_HOSTNAME.to_owned());
}

if !wired_client_ips.is_empty()
Expand Down