(socket_path: &Path)
| 567 | |
| 568 | #[cfg(unix)] |
| 569 | async fn connect_compute_driver(socket_path: &Path) -> Result<Channel> { |
| 570 | let socket_path = socket_path.to_path_buf(); |
| 571 | let display_path = socket_path.clone(); |
| 572 | Endpoint::from_static("http://[::]:50051") |
| 573 | .connect_with_connector(service_fn(move |_: tonic::transport::Uri| { |
| 574 | let socket_path = socket_path.clone(); |
| 575 | async move { UnixStream::connect(socket_path).await.map(TokioIo::new) } |
| 576 | })) |
| 577 | .await |
| 578 | .map_err(|e| { |
| 579 | Error::execution(format!( |
| 580 | "failed to connect to vm compute driver socket '{}': {e}", |
| 581 | display_path.display() |
| 582 | )) |
| 583 | }) |
| 584 | } |
| 585 | |
| 586 | #[cfg(all(test, unix))] |
| 587 | mod tests { |
no test coverage detected