automatic cargo CI changes

This commit is contained in:
PlexSheep 2024-01-19 00:01:29 +00:00 committed by github-actions[bot]
parent 78340a23d2
commit 12a60eb189
4 changed files with 6 additions and 10 deletions

View File

@ -0,0 +1 @@

View File

@ -46,7 +46,6 @@ pub(crate) struct Cli {
#[arg(short, long, default_value_t = false)] #[arg(short, long, default_value_t = false)]
pub(crate) server: bool, pub(crate) server: bool,
// how much threads the server should use // how much threads the server should use
#[cfg(feature = "server")] #[cfg(feature = "server")]
#[arg(short, long, default_value_t = 4)] #[arg(short, long, default_value_t = 4)]

View File

@ -40,7 +40,7 @@ impl Display for Mode {
pub struct Config { pub struct Config {
pub addr: std::net::SocketAddr, pub addr: std::net::SocketAddr,
pub mode: Mode, pub mode: Mode,
pub threads: usize pub threads: usize,
} }
impl Config { impl Config {
@ -48,7 +48,7 @@ impl Config {
Config { Config {
addr: cli.addr.clone(), addr: cli.addr.clone(),
mode: cli.mode.clone(), mode: cli.mode.clone(),
threads: cli.threads threads: cli.threads,
} }
} }
} }

View File

@ -2,16 +2,12 @@
use anyhow::Result; use anyhow::Result;
use libpt::log::{error, info}; use libpt::log::{error, info};
use mio::{self, event::Event, net::TcpListener, Events, Interest, Poll, Token}; use mio::{self, event::Event, net::TcpListener, Events, Interest, Poll, Token};
use std::{ use std::time::Duration;
io::{prelude::*, BufReader},
time::Duration,
};
use threadpool::ThreadPool; use threadpool::ThreadPool;
use crate::common::conf::{Config, Mode}; use crate::common::conf::Config;
pub mod listener; pub mod listener;
use listener::*;
const EVENT_CAPACITY: usize = 128; const EVENT_CAPACITY: usize = 128;
const SERVER: Token = Token(0); const SERVER: Token = Token(0);
@ -59,7 +55,7 @@ impl Server {
fn handle_event(&self, event: &Event) -> Result<()> { fn handle_event(&self, event: &Event) -> Result<()> {
dbg!(event); dbg!(event);
let connection = self.server.accept()?; let _connection = self.server.accept()?;
info!("received a connection!"); info!("received a connection!");
Ok(()) Ok(())
} }