chore(udp): Use SocketRef
This commit is contained in:
parent
4f58e42634
commit
b55ddd5947
1 changed files with 2 additions and 2 deletions
|
@ -36,7 +36,7 @@ struct UdpServer {
|
||||||
|
|
||||||
impl UdpServer {
|
impl UdpServer {
|
||||||
pub fn new(listener: UdpSocket, timeout: Option<Duration>) -> Self {
|
pub fn new(listener: UdpSocket, timeout: Option<Duration>) -> Self {
|
||||||
let socket = socket2::Socket::from(listener.into_std().unwrap());
|
let socket = socket2::SockRef::from(&listener);
|
||||||
|
|
||||||
// Increase receive buffer
|
// Increase receive buffer
|
||||||
if let Err(err) = socket.set_recv_buffer_size(64 * 1024 * 1024) {
|
if let Err(err) = socket.set_recv_buffer_size(64 * 1024 * 1024) {
|
||||||
|
@ -48,7 +48,7 @@ impl UdpServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
listener: Arc::new(UdpSocket::from_std(socket.into()).unwrap()),
|
listener: Arc::new(listener),
|
||||||
peers: HashMap::with_hasher(ahash::RandomState::new()),
|
peers: HashMap::with_hasher(ahash::RandomState::new()),
|
||||||
keys_to_delete: Default::default(),
|
keys_to_delete: Default::default(),
|
||||||
cnx_timeout: timeout,
|
cnx_timeout: timeout,
|
||||||
|
|
Loading…
Reference in a new issue