diff --git a/telnet/src/main.rs b/telnet/src/main.rs index ab94b4f..2b6838d 100644 --- a/telnet/src/main.rs +++ b/telnet/src/main.rs @@ -49,6 +49,10 @@ async fn read_input ( } } + if ! buffer.contains (&b'\n') { + anyhow::bail! ("No newline. User might be spamming us or something."); + } + let buffer = String::from_utf8 (buffer)?; // I don't know why I need the type annotation here, but I do. @@ -101,13 +105,16 @@ async fn process_socket (socket: TcpStream, id: &str) } }, Response::Sleep (x) => sleep (x).await, - Response::PlayerVictory => tracing::info! ("Connection {} beat the game", id), + Response::PlayerVictory => tracing::info! ("Connection {} PlayerVictory", id), + Response::JokeEnding => tracing::info! ("Connection {} JokeEnding", id), Response::Quit => break 'main_loop, _ => (), } } } + tracing::info! ("Connection {} ending gracefully", id); + Ok (()) }