We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
socket2
connect_timeout
1 parent 6a54e68 commit 287782cCopy full SHA for 287782c
src/connection.rs
@@ -148,8 +148,12 @@ impl NetConnection for socket2::Socket {
148
let addr = addr.to_socket_addrs()?.next().ok_or(io::ErrorKind::AddrNotAvailable)?;
149
let socket =
150
socket2::Socket::new(socket2::Domain::for_address(addr), socket2::Type::STREAM, None)?;
151
+
152
socket.set_nonblocking(true)?;
- match socket2::Socket::connect_timeout(&socket, &addr.into(), timeout) {
153
+ socket.set_read_timeout(Some(timeout))?;
154
+ socket.set_write_timeout(Some(timeout))?;
155
156
+ match socket2::Socket::connect(&socket, &addr.into()) {
157
Ok(()) => {
158
#[cfg(feature = "log")]
159
log::debug!(target: "netservices", "Connected to {}", addr);
0 commit comments