mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-19 21:39:09 +00:00
UDP read time out case
This commit is contained in:
parent
7bee2e0968
commit
2df59ae596
1 changed files with 8 additions and 1 deletions
|
@ -329,7 +329,14 @@ where
|
|||
async fn handle_virtual_dns_session(mut udp: IpStackUdpStream, dns: Arc<Mutex<VirtualDns>>) -> crate::Result<()> {
|
||||
let mut buf = [0_u8; 4096];
|
||||
loop {
|
||||
let len = udp.read(&mut buf).await?;
|
||||
let len = match udp.read(&mut buf).await {
|
||||
Err(e) => {
|
||||
// indicate UDP read fails not an error.
|
||||
log::debug!("Virtual DNS session error: {}", e);
|
||||
break;
|
||||
}
|
||||
Ok(len) => len,
|
||||
};
|
||||
if len == 0 {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue