Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rustdesk committed Feb 29, 2024
1 parent c6cdf77 commit 0f3db29
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/rendezvous_mediator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl RendezvousMediator {

pub async fn start_udp(server: ServerPtr, host: String) -> ResultType<()> {
let host = check_port(&host, RENDEZVOUS_PORT);
let (mut socket, addr) = socket_client::new_udp_for(&host, CONNECT_TIMEOUT).await?;
let (mut socket, mut addr) = socket_client::new_udp_for(&host, CONNECT_TIMEOUT).await?;
let mut rz = Self {
addr: addr.clone(),
host: host.clone(),
Expand Down Expand Up @@ -232,9 +232,10 @@ impl RendezvousMediator {
if last_dns_check.elapsed().as_millis() as i64 > DNS_INTERVAL {
// in some case of network reconnect (dial IP network),
// old UDP socket not work any more after network recover
if let Some((s, addr)) = socket_client::rebind_udp_for(&rz.host).await? {
if let Some((s, new_addr)) = socket_client::rebind_udp_for(&rz.host).await? {
socket = s;
rz.addr = addr;
rz.addr = new_addr.clone();
addr = new_addr;
}
last_dns_check = Instant::now();
}
Expand Down

0 comments on commit 0f3db29

Please sign in to comment.