From b55ddd5947943007e538c3e3bc3f5dc014620a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=A3rebe=20-=20Romain=20GERARD?= Date: Thu, 9 Nov 2023 17:09:47 +0100 Subject: [PATCH] chore(udp): Use SocketRef --- src/udp.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/udp.rs b/src/udp.rs index afa526e..e3cc4d3 100644 --- a/src/udp.rs +++ b/src/udp.rs @@ -36,7 +36,7 @@ struct UdpServer { impl UdpServer { pub fn new(listener: UdpSocket, timeout: Option) -> Self { - let socket = socket2::Socket::from(listener.into_std().unwrap()); + let socket = socket2::SockRef::from(&listener); // Increase receive buffer if let Err(err) = socket.set_recv_buffer_size(64 * 1024 * 1024) { @@ -48,7 +48,7 @@ impl UdpServer { } Self { - listener: Arc::new(UdpSocket::from_std(socket.into()).unwrap()), + listener: Arc::new(listener), peers: HashMap::with_hasher(ahash::RandomState::new()), keys_to_delete: Default::default(), cnx_timeout: timeout,