Skip to content

Commit

Permalink
Fix excess warnings with message decoding length for Open/Close messa…
Browse files Browse the repository at this point in the history
…ges.
  • Loading branch information
ttiurani committed Nov 19, 2023
1 parent 9effc74 commit 54d4d91
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ impl Frame {
)?;
if length != body_len as usize {
tracing::warn!(
"Did not know what to do with all the bytes, got {} but decoded {}",
"Did not know what to do with all the bytes, got {} but decoded {}. \
This may be because the peer implements a newer protocol version \
that has extra fields.",
body_len,
length
);
Expand Down Expand Up @@ -202,11 +204,11 @@ impl Frame {
} else if buf[1] == 0x01 {
// Open message
let (channel_message, length) = ChannelMessage::decode_open_message(&buf[2..])?;
Ok((Frame::MessageBatch(vec![channel_message]), length))
Ok((Frame::MessageBatch(vec![channel_message]), length + 2))
} else if buf[1] == 0x03 {
// Close message
let (channel_message, length) = ChannelMessage::decode_close_message(&buf[2..])?;
Ok((Frame::MessageBatch(vec![channel_message]), length))
Ok((Frame::MessageBatch(vec![channel_message]), length + 2))
} else {
Err(io::Error::new(
io::ErrorKind::InvalidData,
Expand Down

0 comments on commit 54d4d91

Please sign in to comment.