mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-20 19:11:08 +03:00
Captute "type" byte for unknow message type (#3146)
Found it useful for debugging
This commit is contained in:
parent
82b1ff905d
commit
3f528a8e66
2 changed files with 8 additions and 4 deletions
|
@ -293,7 +293,11 @@ where
|
|||
try_break!(conn_handle.send(resp_msg));
|
||||
}
|
||||
}
|
||||
Some(MsgHeaderWrapper::Unknown(msg_len)) => {
|
||||
Some(MsgHeaderWrapper::Unknown(msg_len, type_byte)) => {
|
||||
debug!(
|
||||
"Received unknown message header, type {:?}, len {}.",
|
||||
type_byte, msg_len
|
||||
);
|
||||
// Increase received bytes counter
|
||||
reader_tracker.inc_received(MsgHeader::LEN as u64 + msg_len);
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ pub fn read_message<T: Readable>(
|
|||
Err(Error::BadMessage)
|
||||
}
|
||||
}
|
||||
MsgHeaderWrapper::Unknown(msg_len) => {
|
||||
MsgHeaderWrapper::Unknown(msg_len, _) => {
|
||||
read_discard(msg_len, stream)?;
|
||||
Err(Error::BadMessage)
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ pub enum MsgHeaderWrapper {
|
|||
/// A "known" msg type with deserialized msg header.
|
||||
Known(MsgHeader),
|
||||
/// An unknown msg type with corresponding msg size in bytes.
|
||||
Unknown(u64),
|
||||
Unknown(u64, u8),
|
||||
}
|
||||
|
||||
/// Header of any protocol message, used to identify incoming messages.
|
||||
|
@ -331,7 +331,7 @@ impl Readable for MsgHeaderWrapper {
|
|||
return Err(ser::Error::TooLargeReadErr);
|
||||
}
|
||||
|
||||
Ok(MsgHeaderWrapper::Unknown(msg_len))
|
||||
Ok(MsgHeaderWrapper::Unknown(msg_len, t))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue