fix ID_EXISTS not sent out due to ipv6 change

This commit is contained in:
rustdesk 2023-02-18 13:41:45 +08:00
parent 49f10a288d
commit ec202209f3

View File

@ -789,7 +789,7 @@ impl RendezvousServer {
#[inline] #[inline]
async fn send_to_tcp(&mut self, msg: RendezvousMessage, addr: SocketAddr) { async fn send_to_tcp(&mut self, msg: RendezvousMessage, addr: SocketAddr) {
let mut tcp = self.tcp_punch.lock().await.remove(&addr); let mut tcp = self.tcp_punch.lock().await.remove(&try_into_v4(addr));
tokio::spawn(async move { tokio::spawn(async move {
Self::send_to_sink(&mut tcp, msg).await; Self::send_to_sink(&mut tcp, msg).await;
}); });
@ -817,7 +817,7 @@ impl RendezvousServer {
msg: RendezvousMessage, msg: RendezvousMessage,
addr: SocketAddr, addr: SocketAddr,
) -> ResultType<()> { ) -> ResultType<()> {
let mut sink = self.tcp_punch.lock().await.remove(&addr); let mut sink = self.tcp_punch.lock().await.remove(&try_into_v4(addr));
Self::send_to_sink(&mut sink, msg).await; Self::send_to_sink(&mut sink, msg).await;
Ok(()) Ok(())
} }
@ -1126,7 +1126,7 @@ impl RendezvousServer {
} }
} }
if sink.is_none() { if sink.is_none() {
self.tcp_punch.lock().await.remove(&addr); self.tcp_punch.lock().await.remove(&try_into_v4(addr));
} }
log::debug!("Tcp connection from {:?} closed", addr); log::debug!("Tcp connection from {:?} closed", addr);
Ok(()) Ok(())