From 511e64751c3d10d22cf5ff320dd59cd7ff57a56c Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Sun, 7 Apr 2024 22:15:34 +0400 Subject: [PATCH] Handling MSGID_CANCEL just in case --- crates/peer_binary_protocol/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/peer_binary_protocol/src/lib.rs b/crates/peer_binary_protocol/src/lib.rs index 402bbc1..21cd4be 100644 --- a/crates/peer_binary_protocol/src/lib.rs +++ b/crates/peer_binary_protocol/src/lib.rs @@ -243,7 +243,8 @@ where { pub fn len_prefix_and_msg_id(&self) -> (u32, u8) { 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::Choke => (LEN_PREFIX_CHOKE, MSGID_CHOKE), Message::Unchoke => (LEN_PREFIX_UNCHOKE, MSGID_UNCHOKE),