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

Revert X11 connection timeout handling #147

Merged
merged 1 commit into from
Apr 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 8 additions & 12 deletions src/platform/linux/x11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ use std::{
collections::{hash_map::Entry, HashMap},
sync::{
atomic::{AtomicBool, Ordering},
mpsc, Arc,
Arc,
},
thread::{self, JoinHandle},
thread::JoinHandle,
thread_local,
time::{Duration, Instant},
usize,
Expand Down Expand Up @@ -134,16 +134,12 @@ struct Inner {
impl XContext {
fn new() -> Result<Self> {
// create a new connection to an X11 server
// with a timeout on connecting to the socket in case of hangage
let (tx, rx) = mpsc::channel();
thread::spawn(move || {
tx.send(RustConnection::connect(None)).ok(); // disregard error sending on channel as main thread has timed out.
});
let patient_conn = rx.recv_timeout(SHORT_TIMEOUT_DUR).map_err(|_| Error::Unknown {
description: String::from("X11 server connection timed out because it was unreachable"),
})?;
let (conn, screen_num): (RustConnection, _) = patient_conn.map_err(into_unknown)?;

let (conn, screen_num): (RustConnection, _) =
RustConnection::connect(None).map_err(|_| Error::Unknown {
description: String::from(
"X11 server connection timed out because it was unreachable",
),
})?;
let screen = conn
.setup()
.roots
Expand Down