Add Windows named-pipe local control

This commit is contained in:
Eric Wendland 2026-07-18 17:05:38 +02:00
commit 3c84713472
9 changed files with 338 additions and 72 deletions

View file

@ -56,15 +56,6 @@ fn check_config(paths: &GethPaths, checks: &mut Vec<DoctorCheck>) {
}
async fn check_daemon(paths: &GethPaths, checks: &mut Vec<DoctorCheck>) {
if !paths.socket_path().exists() {
checks.push(fail(
"daemon-not-running",
format!("daemon socket is absent: {}", paths.socket_path().display()),
"start the daemon with `geth daemon run` or the user service command for your platform",
));
return;
}
match send_control(paths, ControlRequest::Status).await {
Ok(ControlResponse::Status(status)) => checks.push(ok(
"daemon-ok",
@ -79,13 +70,21 @@ async fn check_daemon(paths: &GethPaths, checks: &mut Vec<DoctorCheck>) {
format!("daemon returned unexpected response: {other:?}"),
"restart the daemon and rerun `geth doctor`",
)),
Err(error) => checks.push(fail(
"daemon-stale-socket",
Err(error) if crate::local_transport::endpoint_file_exists(paths) => checks.push(fail(
"daemon-stale-control-endpoint",
format!(
"daemon socket exists but control connection failed: {}",
"daemon control endpoint exists but the connection failed: {}",
error
),
"stop any stale daemon, remove the socket if no daemon is running, then start `geth daemon run`",
"restart the user service or foreground daemon; on Unix, remove the stale socket only after confirming no daemon is running",
)),
Err(error) => checks.push(fail(
"daemon-not-running",
format!(
"daemon control endpoint did not answer at {}: {error}",
paths.control_endpoint()
),
"start the daemon with `geth daemon run` or `geth daemon install`",
)),
}
}
@ -320,6 +319,7 @@ mod tests {
}
#[tokio::test]
#[cfg(unix)]
async fn doctor_reports_bad_config_and_stale_socket() {
let home = tempfile::tempdir().expect("home");
let paths = GethPaths::from_home(home.path());
@ -329,7 +329,7 @@ mod tests {
let report = run_doctor(&paths).await.expect("doctor");
assert!(!report.ok);
assert!(has_code(&report, "config-invalid"));
assert!(has_code(&report, "daemon-stale-socket"));
assert!(has_code(&report, "daemon-stale-control-endpoint"));
}
fn has_code(report: &DoctorReport, code: &str) -> bool {