mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-29 08:01:03 +03:00
refactor socket_client to prepare for nat64
This commit is contained in:
@@ -49,7 +49,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()?.filter(|x| x.is_ipv4()) {
|
||||
for addr in addr.to_socket_addrs()? {
|
||||
let socket = new_socket(addr, true, 0)?.into_udp_socket();
|
||||
return Ok(Self::Direct(UdpFramed::new(
|
||||
UdpSocket::from_std(socket)?,
|
||||
@@ -63,7 +63,7 @@ impl FramedSocket {
|
||||
addr: T,
|
||||
buf_size: usize,
|
||||
) -> ResultType<Self> {
|
||||
for addr in addr.to_socket_addrs()?.filter(|x| x.is_ipv4()) {
|
||||
for addr in addr.to_socket_addrs()? {
|
||||
return Ok(Self::Direct(UdpFramed::new(
|
||||
UdpSocket::from_std(new_socket(addr, false, buf_size)?.into_udp_socket())?,
|
||||
BytesCodec::new(),
|
||||
|
||||
Reference in New Issue
Block a user