diff --git a/Cargo.lock b/Cargo.lock index eb72a0b..fd025fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1530,11 +1530,10 @@ dependencies = [ [[package]] name = "socket2" -version = "0.3.19" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad" dependencies = [ - "cfg-if", "libc", "winapi", ] diff --git a/aquatic_http/Cargo.toml b/aquatic_http/Cargo.toml index 238ca0d..f604413 100644 --- a/aquatic_http/Cargo.toml +++ b/aquatic_http/Cargo.toml @@ -36,7 +36,7 @@ privdrop = "0.5" rand = { version = "0.8", features = ["small_rng"] } serde = { version = "1", features = ["derive"] } smartstring = "0.2" -socket2 = { version = "0.3", features = ["reuseport"] } +socket2 = { version = "0.4.1", features = ["all"] } [dev-dependencies] quickcheck = "1.0" diff --git a/aquatic_http/src/lib/network/utils.rs b/aquatic_http/src/lib/network/utils.rs index 015a3b4..9349f98 100644 --- a/aquatic_http/src/lib/network/utils.rs +++ b/aquatic_http/src/lib/network/utils.rs @@ -34,9 +34,9 @@ pub fn create_listener( ipv6_only: bool, ) -> ::anyhow::Result<::std::net::TcpListener> { let builder = if address.is_ipv4() { - Socket::new(Domain::ipv4(), Type::stream(), Some(Protocol::tcp())) + Socket::new(Domain::IPV4, Type::STREAM, Some(Protocol::TCP)) } else { - Socket::new(Domain::ipv6(), Type::stream(), Some(Protocol::tcp())) + Socket::new(Domain::IPV6, Type::STREAM, Some(Protocol::TCP)) } .context("Couldn't create socket2::Socket")?; @@ -59,5 +59,5 @@ pub fn create_listener( .listen(128) .context("Couldn't listen for connections on socket")?; - Ok(builder.into_tcp_listener()) + Ok(builder.into()) } diff --git a/aquatic_udp/Cargo.toml b/aquatic_udp/Cargo.toml index d05c3b7..265b707 100644 --- a/aquatic_udp/Cargo.toml +++ b/aquatic_udp/Cargo.toml @@ -30,7 +30,7 @@ parking_lot = "0.11" privdrop = "0.5" rand = { version = "0.8", features = ["small_rng"] } serde = { version = "1", features = ["derive"] } -socket2 = { version = "0.3", features = ["reuseport"] } +socket2 = { version = "0.4.1", features = ["all"] } [dev-dependencies] quickcheck = "1.0" diff --git a/aquatic_udp/src/lib/network.rs b/aquatic_udp/src/lib/network.rs index 76ec455..6f64885 100644 --- a/aquatic_udp/src/lib/network.rs +++ b/aquatic_udp/src/lib/network.rs @@ -88,9 +88,9 @@ pub fn run_socket_worker( fn create_socket(config: &Config) -> ::std::net::UdpSocket { let socket = if config.network.address.is_ipv4() { - Socket::new(Domain::ipv4(), Type::dgram(), Some(Protocol::udp())) + Socket::new(Domain::IPV4, Type::DGRAM, Some(Protocol::UDP)) } else { - Socket::new(Domain::ipv6(), Type::dgram(), Some(Protocol::udp())) + Socket::new(Domain::IPV6, Type::DGRAM, Some(Protocol::UDP)) } .expect("create socket"); @@ -116,7 +116,7 @@ fn create_socket(config: &Config) -> ::std::net::UdpSocket { } } - socket.into_udp_socket() + socket.into() } #[inline] diff --git a/aquatic_udp_load_test/Cargo.toml b/aquatic_udp_load_test/Cargo.toml index 61067b0..e6bc0ea 100644 --- a/aquatic_udp_load_test/Cargo.toml +++ b/aquatic_udp_load_test/Cargo.toml @@ -21,7 +21,7 @@ parking_lot = "0.11" rand = { version = "0.8", features = ["small_rng"] } rand_distr = "0.4" serde = { version = "1", features = ["derive"] } -socket2 = { version = "0.3", features = ["reuseport"] } +socket2 = { version = "0.4.1", features = ["all"] } [dev-dependencies] quickcheck = "1.0" diff --git a/aquatic_udp_load_test/src/network.rs b/aquatic_udp_load_test/src/network.rs index dcd1d32..0f0269f 100644 --- a/aquatic_udp_load_test/src/network.rs +++ b/aquatic_udp_load_test/src/network.rs @@ -15,9 +15,9 @@ const MAX_PACKET_SIZE: usize = 4096; pub fn create_socket(config: &Config, addr: SocketAddr) -> ::std::net::UdpSocket { let socket = if addr.is_ipv4() { - Socket::new(Domain::ipv4(), Type::dgram(), Some(Protocol::udp())) + Socket::new(Domain::IPV4, Type::DGRAM, Some(Protocol::UDP)) } else { - Socket::new(Domain::ipv6(), Type::dgram(), Some(Protocol::udp())) + Socket::new(Domain::IPV6, Type::DGRAM, Some(Protocol::UDP)) } .expect("create socket"); @@ -42,7 +42,7 @@ pub fn create_socket(config: &Config, addr: SocketAddr) -> ::std::net::UdpSocket .connect(&config.server_address.into()) .expect("socket: connect to server"); - socket.into_udp_socket() + socket.into() } pub fn run_socket_thread( diff --git a/aquatic_ws/Cargo.toml b/aquatic_ws/Cargo.toml index 7f677c8..b5597e8 100644 --- a/aquatic_ws/Cargo.toml +++ b/aquatic_ws/Cargo.toml @@ -33,7 +33,7 @@ parking_lot = "0.11" privdrop = "0.5" rand = { version = "0.8", features = ["small_rng"] } serde = { version = "1", features = ["derive"] } -socket2 = { version = "0.3", features = ["reuseport"] } +socket2 = { version = "0.4.1", features = ["all"] } tungstenite = "0.13" [dev-dependencies] diff --git a/aquatic_ws/src/lib/network/utils.rs b/aquatic_ws/src/lib/network/utils.rs index 5c0e618..2568c97 100644 --- a/aquatic_ws/src/lib/network/utils.rs +++ b/aquatic_ws/src/lib/network/utils.rs @@ -10,9 +10,9 @@ use super::connection::*; pub fn create_listener(config: &Config) -> ::anyhow::Result<::std::net::TcpListener> { let builder = if config.network.address.is_ipv4() { - Socket::new(Domain::ipv4(), Type::stream(), Some(Protocol::tcp())) + Socket::new(Domain::IPV4, Type::STREAM, Some(Protocol::TCP)) } else { - Socket::new(Domain::ipv6(), Type::stream(), Some(Protocol::tcp())) + Socket::new(Domain::IPV6, Type::STREAM, Some(Protocol::TCP)) } .context("Couldn't create socket2::Socket")?; @@ -35,7 +35,7 @@ pub fn create_listener(config: &Config) -> ::anyhow::Result<::std::net::TcpListe .listen(128) .context("Couldn't listen for connections on socket")?; - Ok(builder.into_tcp_listener()) + Ok(builder.into()) } pub fn remove_connection_if_exists(poll: &mut Poll, connections: &mut ConnectionMap, token: Token) {