From f0b9735187bd865e31a2da60c80e1a705fa5dcd8 Mon Sep 17 00:00:00 2001 From: Juraj Mlaka Date: Sat, 12 Oct 2024 20:18:07 +0200 Subject: [PATCH] - conn timeout working - multiple SocketAddrs accepted --- ul/src/association/client.rs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/ul/src/association/client.rs b/ul/src/association/client.rs index 4fa7bc6f..35a5b82f 100644 --- a/ul/src/association/client.rs +++ b/ul/src/association/client.rs @@ -41,11 +41,6 @@ pub enum Error { backtrace: Backtrace, }, - /// converted SocketAddrs iterator did not yield - #[snafu(display("not a single tcp addreess provided"))] - #[non_exhaustive] - NoAddress { backtrace: Backtrace }, - /// could not connect to server Connect { source: std::io::Error, @@ -571,14 +566,10 @@ impl<'a> ClientAssociationOptions<'a> { }); let conn_result: Result = if let Some(timeout) = connection_timeout { - let mut addresses = ae_address.to_socket_addrs().context(ToAddressSnafu)?; - - if addresses.by_ref().count() == 0 { - return NoAddressSnafu.fail(); - } + let addresses = ae_address.to_socket_addrs().context(ToAddressSnafu)?; let mut result: Result = - Result::Err(std::io::Error::from(std::io::ErrorKind::NotConnected)); + Result::Err(std::io::Error::from(std::io::ErrorKind::AddrNotAvailable)); for address in addresses { result = std::net::TcpStream::connect_timeout(&address, timeout);