mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-02-09 01:59:16 +08:00
Keep server running if failed to create UdpAssociation
- Log error if UdpSocket::connect failed ref #293
This commit is contained in:
@@ -203,10 +203,26 @@ impl ProxyAssociation {
|
||||
async fn connect_remote(context: &Context, svr_cfg: &ServerConfig, remote_udp: &UdpSocket) -> io::Result<()> {
|
||||
match svr_cfg.addr() {
|
||||
ServerAddr::SocketAddr(ref remote_addr) => {
|
||||
remote_udp.connect(remote_addr).await?;
|
||||
let res = remote_udp.connect(remote_addr).await;
|
||||
if let Err(ref err) = res {
|
||||
error!(
|
||||
"UDP association UdpSocket::connect failed, addr: {}, err: {}",
|
||||
remote_addr, err
|
||||
);
|
||||
}
|
||||
res?;
|
||||
}
|
||||
ServerAddr::DomainName(ref dname, port) => {
|
||||
lookup_then!(context, dname, *port, |addr| { remote_udp.connect(&addr).await })?;
|
||||
lookup_then!(context, dname, *port, |addr| {
|
||||
let res = remote_udp.connect(&addr).await;
|
||||
if let Err(ref err) = res {
|
||||
error!(
|
||||
"UDP association UdpSocket::connect failed, addr: {}:{} (resolved: {}), err: {}",
|
||||
dname, port, addr, err
|
||||
);
|
||||
}
|
||||
res
|
||||
})?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,6 @@ pub async fn run(context: SharedContext) -> io::Result<()> {
|
||||
|
||||
if let Err(err) = res {
|
||||
error!("failed to create UDP association, {}", err);
|
||||
return Err(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,6 @@ async fn listen(context: SharedContext, flow_stat: SharedServerFlowStatistic, sv
|
||||
|
||||
if let Err(err) = res {
|
||||
error!("failed to create UDP association, {}", err);
|
||||
return Err(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,6 @@ pub async fn run(context: SharedContext) -> io::Result<()> {
|
||||
|
||||
if let Err(err) = res {
|
||||
error!("failed to create UDP association, {}", err);
|
||||
return Err(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,6 @@ pub async fn run(context: SharedContext) -> io::Result<()> {
|
||||
|
||||
if let Err(err) = res {
|
||||
error!("failed to create UDP association, {}", err);
|
||||
return Err(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user