ignore io errors on server

This commit is contained in:
griffi-gh 2023-02-12 21:31:21 +01:00
parent 8758938e7e
commit e0872b331f
4 changed files with 14 additions and 4 deletions

View file

@ -20,6 +20,9 @@ pub fn init() {
_ => Color::Blue _ => Color::Blue
}).set_bold(true); }).set_bold(true);
let mut bold_style = buf.style();
bold_style.set_bold(true);
let mut location_style = buf.style(); let mut location_style = buf.style();
location_style.set_bold(true); location_style.set_bold(true);
location_style.set_dimmed(true); location_style.set_dimmed(true);
@ -27,9 +30,11 @@ pub fn init() {
let mut location_line_style = buf.style(); let mut location_line_style = buf.style();
location_line_style.set_dimmed(true); location_line_style.set_dimmed(true);
let text = format!("{}", record.args());
writeln!( writeln!(
buf, buf,
"{} {:<50}\t{}{}{}", "{} {:<50}\t{}{}{}{}",
level_style.value(match record.level() { level_style.value(match record.level() {
Level::Error => "[e]", Level::Error => "[e]",
Level::Warn => "[w]", Level::Warn => "[w]",
@ -37,7 +42,8 @@ pub fn init() {
Level::Debug => "[d]", Level::Debug => "[d]",
Level::Trace => "[t]", Level::Trace => "[t]",
}), }),
format!("{}", record.args()), text,
bold_style.value((text.len() > 50).then_some("\n ╰─ ").unwrap_or_default()),
location_style.value(record.target()), location_style.value(record.target()),
location_line_style.value(" :"), location_line_style.value(" :"),
location_line_style.value(record.line().unwrap_or(0)) location_line_style.value(record.line().unwrap_or(0))

View file

@ -189,7 +189,8 @@ impl<S, R> Server<S, R> where S: Encode + Decode, R: Encode + Decode {
} }
}, },
Err(error) if error.kind() != ErrorKind::WouldBlock => { Err(error) if error.kind() != ErrorKind::WouldBlock => {
return Err(error.into()); log::warn!("IO error {}", error);
// return Err(error.into());
}, },
_ => break, _ => break,
} }

View file

@ -153,6 +153,9 @@ fn main() {
//Attach console on release builds on windows //Attach console on release builds on windows
#[cfg(all(windows, not(debug_assertions)))] attach_console(); #[cfg(all(windows, not(debug_assertions)))] attach_console();
//Print version
println!("{:─^54}", format!("[ ▄▀ Kubi client v. {} ]", env!("CARGO_PKG_VERSION")));
//Init env_logger //Init env_logger
kubi_logging::init(); kubi_logging::init();

View file

@ -66,7 +66,7 @@ pub fn update_networking() -> Workload {
connect_client.run_if(client_needs_connect_call), connect_client.run_if(client_needs_connect_call),
update_client, update_client,
insert_client_events, insert_client_events,
).into_workload().run_if(is_multiplayer) ).into_workload()
} }
fn client_needs_connect_call( fn client_needs_connect_call(