mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 10:45:30 +00:00
Upgrade socket2
This commit is contained in:
parent
1028dcc709
commit
d172fc4f8c
9 changed files with 18 additions and 19 deletions
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue