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 {
|
let read_len = match read_len {
|
||||||
Ok(read_len) if read_len > 0 => read_len,
|
Ok(0) => break,
|
||||||
Ok(_) => break,
|
Ok(read_len) => read_len,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
warn!(
|
warn!(
|
||||||
"error while reading incoming bytes from local tx tunnel {}",
|
"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::service::service_fn;
|
||||||
use hyper::{http, Body, Request, Response, StatusCode};
|
use hyper::{http, Body, Request, Response, StatusCode};
|
||||||
use jsonwebtoken::TokenData;
|
use jsonwebtoken::TokenData;
|
||||||
|
|
||||||
use tokio::io::{AsyncRead, AsyncWrite};
|
use tokio::io::{AsyncRead, AsyncWrite};
|
||||||
use tokio::net::{TcpListener, UdpSocket};
|
use tokio::net::{TcpListener, UdpSocket};
|
||||||
use tokio::sync::oneshot;
|
use tokio::sync::oneshot;
|
||||||
|
|
|
@ -150,8 +150,8 @@ pub async fn run_server(
|
||||||
|
|
||||||
let udp_server = UdpServer::new(Arc::new(listener), timeout);
|
let udp_server = UdpServer::new(Arc::new(listener), timeout);
|
||||||
let stream = stream::unfold(udp_server, |mut server| async {
|
let stream = stream::unfold(udp_server, |mut server| async {
|
||||||
loop {
|
|
||||||
server.clean_dead_keys();
|
server.clean_dead_keys();
|
||||||
|
loop {
|
||||||
let peer_addr = match server.listener.peek_sender().await {
|
let peer_addr = match server.listener.peek_sender().await {
|
||||||
Ok(ret) => ret,
|
Ok(ret) => ret,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -183,7 +183,7 @@ pub async fn run_server(
|
||||||
}
|
}
|
||||||
Entry::Vacant(peer) => {
|
Entry::Vacant(peer) => {
|
||||||
let mut buf = BytesMut::with_capacity(DEFAULT_UDP_BUFFER_SIZE);
|
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(_) => {
|
Ok(0) | Err(_) => {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue