diff --git a/problem_06/bin/client.rs b/problem_06/bin/client.rs index 361f360..29961c0 100644 --- a/problem_06/bin/client.rs +++ b/problem_06/bin/client.rs @@ -13,7 +13,8 @@ async fn main() -> Result<(), Box> { let (mut read, mut write) = stream.split(); // test_all_different_messages(&mut write).await?; - test_camera_connection(&mut write).await?; + // test_camera_connection(&mut write).await?; + test_dipatcher_connection(&mut write).await?; let mut buf: [u8; 4] = [0; 4]; diff --git a/problem_06/src/frame.rs b/problem_06/src/frame.rs index 4679e55..580375f 100644 --- a/problem_06/src/frame.rs +++ b/problem_06/src/frame.rs @@ -1,7 +1,7 @@ use std::{fmt, io::Cursor, num::TryFromIntError, string::FromUtf8Error}; use bytes::{Buf, BufMut, BytesMut}; -use tracing::{debug, error}; +use tracing::{debug, error, info}; #[derive(Clone, Debug)] pub enum ClientFrames { @@ -77,8 +77,10 @@ impl ClientFrames { } // IAmDispatcher: numroads: u8, roads: [u16] 0x81 => { + info!("Checking IAmDispatcher message: {src:?}"); // numroads let amount = get_u8(src)? * 2; + info!("amount of roads: {amount:?}"); // roads skip(src, amount as usize)?; Ok(()) @@ -221,6 +223,7 @@ fn get_u16_vec<'a>(src: &mut Cursor<&'a [u8]>, len: usize) -> Result, E } fn skip(src: &mut Cursor<&[u8]>, n: usize) -> Result<(), Error> { + info!("Check if message is long enouhg: {src:?}, {n:?}"); if src.remaining() < n { return Err(Error::Incomplete); }