automatic cargo CI changes

This commit is contained in:
cscherrNT 2024-01-19 11:58:53 +00:00 committed by github-actions[bot]
parent 13745e96b8
commit 9e492adeb3
3 changed files with 11 additions and 12 deletions

View File

@ -53,7 +53,7 @@ impl Config {
addr: cli.addr.clone(),
mode: cli.mode.clone(),
threads: cli.threads,
timeout: Duration::from_millis(DEFAULT_TIMEOUT_LEN)
timeout: Duration::from_millis(DEFAULT_TIMEOUT_LEN),
}
}
}

View File

@ -25,7 +25,7 @@ async fn main() -> Result<()> {
#[cfg(feature = "server")]
if cli.server {
info!("starting server");
return Server::build(cfg).await?.run().await
return Server::build(cfg).await?.run().await;
}
// implicit else, so we can work without the server feature
info!("starting client");

View File

@ -1,16 +1,15 @@
#![cfg(feature = "server")]
use std::{net::SocketAddr, time::Duration};
use anyhow::{Result, anyhow};
use anyhow::{anyhow, Result};
use libpt::{
bintols::display::humanbytes,
log::{error, info, trace, warn, debug},
log::{debug, error, info, trace},
};
use threadpool::ThreadPool;
use tokio::{
io::{AsyncBufRead, AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader, Interest},
net::{self, TcpListener, TcpSocket, TcpStream},
select,
io::{AsyncReadExt, BufReader},
net::{TcpListener, TcpStream},
time::timeout,
};
@ -44,7 +43,7 @@ impl Server {
}
}
async fn handle_stream(&self, mut stream: (TcpStream, SocketAddr)) -> Result<()> {
async fn handle_stream(&self, stream: (TcpStream, SocketAddr)) -> Result<()> {
info!("start handling stream {:?}", stream.1);
let mut buf = Vec::new();
let mut reader = BufReader::new(stream.0);
@ -81,8 +80,9 @@ impl Server {
trace!("loop");
len = match timeout(self.cfg.timeout, reader.read(buf)).await {
Ok(inner) => {
trace!("Read for len: {inner:?}"); 0
},
trace!("Read for len: {inner:?}");
0
}
Err(err) => {
error!("timeout while reading: {err}");
return Err(err.into());
@ -90,8 +90,7 @@ impl Server {
};
if self.should_end(&buf) {
return Ok(len);
}
else {
} else {
// ?????????
failsafe += 1;
}