rustdesk
2022-06-12 15:39:58 +08:00
parent b83b296234
commit 933578e660
2 changed files with 7 additions and 3 deletions

View File

@@ -47,7 +47,7 @@ impl FramedSocket {
#[allow(clippy::never_loop)]
pub async fn new_reuse<T: std::net::ToSocketAddrs>(addr: T) -> ResultType<Self> {
for addr in addr.to_socket_addrs()? {
for addr in addr.to_socket_addrs()?.filter(|x| x.is_ipv4()) {
let socket = new_socket(addr, true, 0)?.into_udp_socket();
return Ok(Self::Direct(UdpFramed::new(
UdpSocket::from_std(socket)?,
@@ -61,7 +61,7 @@ impl FramedSocket {
addr: T,
buf_size: usize,
) -> ResultType<Self> {
for addr in addr.to_socket_addrs()? {
for addr in addr.to_socket_addrs()?.filter(|x| x.is_ipv4()) {
return Ok(Self::Direct(UdpFramed::new(
UdpSocket::from_std(new_socket(addr, false, buf_size)?.into_udp_socket())?,
BytesCodec::new(),