diff --git a/TODO.md b/TODO.md index 60f317a..5fdd68b 100644 --- a/TODO.md +++ b/TODO.md @@ -10,7 +10,6 @@ * test tls * current serialized byte strings valid * scrape: does it work with multiple hashes? -* StreamEnded isn't really an error and should really only be debug-logged * non-compact peers for ipv6 generally: use ResponsePeerList enum * on ipv6, compact=1 should result in error response * on ipv4, compact=0 should result in error response diff --git a/aquatic_http/src/lib/network/mod.rs b/aquatic_http/src/lib/network/mod.rs index 74d4072..e531d70 100644 --- a/aquatic_http/src/lib/network/mod.rs +++ b/aquatic_http/src/lib/network/mod.rs @@ -240,13 +240,23 @@ pub fn handle_connection_read_event( break; }, - Err(err) => { - info!("error reading request: {:?}", err); + Err(RequestReadError::StreamEnded) => { + ::log::debug!("stream ended"); + + connections.remove(&poll_token); + + break + }, + Err(RequestReadError::Parse(err)) => { + ::log::info!("request httparse error: {}", err); + + break + }, + Err(RequestReadError::Io(err)) => { + ::log::info!("error reading request (io): {}", err); connections.remove(&poll_token); - // Stop reading data. Later events don't matter since - // connection was just removed. break; }, }