cleanup
This commit is contained in:
parent
1f78c6d5a7
commit
bab2c36f8a
3 changed files with 5 additions and 4 deletions
|
@ -38,8 +38,8 @@ pub(super) async fn propagate_read(
|
|||
};
|
||||
|
||||
let read_len = match read_len {
|
||||
Ok(read_len) if read_len > 0 => read_len,
|
||||
Ok(_) => break,
|
||||
Ok(0) => break,
|
||||
Ok(read_len) => read_len,
|
||||
Err(err) => {
|
||||
warn!(
|
||||
"error while reading incoming bytes from local tx tunnel {}",
|
||||
|
|
|
@ -11,6 +11,7 @@ use hyper::server::conn::Http;
|
|||
use hyper::service::service_fn;
|
||||
use hyper::{http, Body, Request, Response, StatusCode};
|
||||
use jsonwebtoken::TokenData;
|
||||
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
use tokio::net::{TcpListener, UdpSocket};
|
||||
use tokio::sync::oneshot;
|
||||
|
|
|
@ -150,8 +150,8 @@ pub async fn run_server(
|
|||
|
||||
let udp_server = UdpServer::new(Arc::new(listener), timeout);
|
||||
let stream = stream::unfold(udp_server, |mut server| async {
|
||||
server.clean_dead_keys();
|
||||
loop {
|
||||
server.clean_dead_keys();
|
||||
let peer_addr = match server.listener.peek_sender().await {
|
||||
Ok(ret) => ret,
|
||||
Err(err) => {
|
||||
|
@ -183,7 +183,7 @@ pub async fn run_server(
|
|||
}
|
||||
Entry::Vacant(peer) => {
|
||||
let mut buf = BytesMut::with_capacity(DEFAULT_UDP_BUFFER_SIZE);
|
||||
let len = match server.listener.recv_buf(&mut buf).await {
|
||||
let len = match server.listener.try_recv_buf(&mut buf) {
|
||||
Ok(0) | Err(_) => {
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue