Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client Association connection timeout working #570

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions ul/src/association/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -571,14 +566,10 @@ impl<'a> ClientAssociationOptions<'a> {
});

let conn_result: Result<TcpStream> = 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<TcpStream, std::io::Error> =
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);
Expand Down
Loading