(socket_path: &Path)
| 499 | |
| 500 | #[cfg(unix)] |
| 501 | fn daemon_socket_state(socket_path: &Path) -> DaemonSocketState { |
| 502 | if !socket_path.exists() { |
| 503 | return DaemonSocketState::Missing; |
| 504 | } |
| 505 | match StdUnixStream::connect(socket_path) { |
| 506 | Ok(_) => DaemonSocketState::Connectable, |
| 507 | Err(e) if e.kind() == std::io::ErrorKind::ConnectionRefused => DaemonSocketState::Stale, |
| 508 | Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => { |
| 509 | DaemonSocketState::PresentNotAccessible |
| 510 | } |
| 511 | Err(_) => DaemonSocketState::PresentUnreachable, |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | #[cfg(not(unix))] |
| 516 | fn daemon_socket_state(socket_path: &Path) -> DaemonSocketState { |
no test coverage detected