This commit is contained in:
Σrebe - Romain GERARD 2024-01-07 16:54:02 +01:00
parent bdf88d0e89
commit f97bdc7c84
No known key found for this signature in database
GPG key ID: 7A42B4B97E0332F4
2 changed files with 3 additions and 3 deletions

View file

@ -773,7 +773,7 @@ async fn main() {
.map_ok(move |stream| {
// In TProxy mode local destination is the final ip:port destination
let (host, port) = to_host_port(stream.local_addr().unwrap());
(tokio::io::split(stream), (LocalProtocol::Udp { timeout: timeout }, host, port))
(tokio::io::split(stream), (LocalProtocol::Udp { timeout }, host, port))
});
tokio::spawn(async move {
@ -789,7 +789,7 @@ async fn main() {
LocalProtocol::Udp { timeout } => {
let (host, port) = tunnel.remote.clone();
let timeout = *timeout;
let server = udp::run_server(tunnel.local, timeout.clone(), |_| Ok(()), |s| Ok(s.clone()))
let server = udp::run_server(tunnel.local, timeout, |_| Ok(()), |s| Ok(s.clone()))
.await
.unwrap_or_else(|err| panic!("Cannot start UDP server on {}: {}", tunnel.local, err))
.map_err(anyhow::Error::new)

View file

@ -241,7 +241,7 @@ pub async fn run_server(
match server.peers.get(&destination_addr) {
Some(io) => {
if let Err(_) = io.sender.send(data).await {
if io.sender.send(data).await.is_err() {
server.peers.remove(&destination_addr);
}
}