Merge branch 'main' into feat/rootless-capture

This commit is contained in:
Cain 2024-01-18 01:56:14 +00:00 committed by GitHub
commit 36d957ceb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 1483 additions and 457 deletions

View file

@ -75,11 +75,10 @@ pub struct TcpSocketImpl {
impl Socket for TcpSocketImpl {
fn new(address: &SocketAddr, timeout_settings: &Option<TimeoutSettings>) -> GDResult<Self> {
let socket = if let Some(timeout) = TimeoutSettings::get_connect_or_default(timeout_settings) {
net::TcpStream::connect_timeout(address, timeout)
} else {
net::TcpStream::connect(address)
};
let socket = TimeoutSettings::get_connect_or_default(timeout_settings).map_or_else(
|| net::TcpStream::connect(address),
|timeout| net::TcpStream::connect_timeout(address, timeout),
);
let socket = Self {
socket: socket.map_err(|e| SocketConnect.context(e))?,