(
port: u16,
timeout_duration: Duration,
service_name: &str,
)
| 497 | } |
| 498 | |
| 499 | async fn connect_loopback_devtools_service( |
| 500 | port: u16, |
| 501 | timeout_duration: Duration, |
| 502 | service_name: &str, |
| 503 | ) -> Result<(String, TcpStream), String> { |
| 504 | let mut errors = Vec::new(); |
| 505 | for host in DEVTOOLS_DISCOVERY_HOSTS { |
| 506 | let address = format!("{host}:{port}"); |
| 507 | match timeout(timeout_duration, TcpStream::connect(&address)).await { |
| 508 | Ok(Ok(stream)) => return Ok((address, stream)), |
| 509 | Ok(Err(error)) => errors.push(format!("{address}: {error}")), |
| 510 | Err(_) => errors.push(format!("{address}: timed out")), |
| 511 | } |
| 512 | } |
| 513 | Err(format!( |
| 514 | "Unable to connect to {service_name} on loopback port {port}: {}", |
| 515 | errors.join("; ") |
| 516 | )) |
| 517 | } |
| 518 | |
| 519 | async fn candidate_devtools_ports() -> Vec<u16> { |
| 520 | let mut ports = BTreeSet::new(); |
no test coverage detected