Handling MSGID_CANCEL just in case

This commit is contained in:
Igor Katson 2024-04-07 22:15:34 +04:00
parent cdbd91b13b
commit 511e64751c

View file

@ -243,7 +243,8 @@ where
{ {
pub fn len_prefix_and_msg_id(&self) -> (u32, u8) { pub fn len_prefix_and_msg_id(&self) -> (u32, u8) {
match self { match self {
Message::Request(_) | Message::Cancel(_) => (LEN_PREFIX_REQUEST, MSGID_REQUEST), Message::Request(_) => (LEN_PREFIX_REQUEST, MSGID_REQUEST),
Message::Cancel(_) => (LEN_PREFIX_REQUEST, MSGID_CANCEL),
Message::Bitfield(b) => (1 + b.as_ref().len() as u32, MSGID_BITFIELD), Message::Bitfield(b) => (1 + b.as_ref().len() as u32, MSGID_BITFIELD),
Message::Choke => (LEN_PREFIX_CHOKE, MSGID_CHOKE), Message::Choke => (LEN_PREFIX_CHOKE, MSGID_CHOKE),
Message::Unchoke => (LEN_PREFIX_UNCHOKE, MSGID_UNCHOKE), Message::Unchoke => (LEN_PREFIX_UNCHOKE, MSGID_UNCHOKE),