Upgrade socket2

This commit is contained in:
Joakim Frostegård 2021-08-15 23:32:59 +02:00
parent 1028dcc709
commit d172fc4f8c
9 changed files with 18 additions and 19 deletions

View file

@ -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"

View file

@ -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(