This commit is contained in:
Σrebe - Romain GERARD 2023-10-29 01:33:22 +02:00
parent 1f78c6d5a7
commit bab2c36f8a
No known key found for this signature in database
GPG key ID: 7A42B4B97E0332F4
3 changed files with 5 additions and 4 deletions

View file

@ -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 {}",

View file

@ -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;

View file

@ -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;
}