From c00676feba3819883b2888799d5f743c4ca9bca0 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 13 Sep 2022 12:25:37 +0200 Subject: Uniformize flag naming --- src/send.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/send.rs') diff --git a/src/send.rs b/src/send.rs index 0ca62fd..af5f00c 100644 --- a/src/send.rs +++ b/src/send.rs @@ -19,8 +19,8 @@ use crate::stream::*; // Chunk format: // - u32 BE: request id (same for request and response) // - u16 BE: chunk length + flags: -// CHUNK_HAS_CONTINUATION when this is not the last chunk of the stream -// ERROR_MARKER if this chunk denotes an error +// CHUNK_FLAG_HAS_CONTINUATION when this is not the last chunk of the stream +// CHUNK_FLAG_ERROR if this chunk denotes an error // (these two flags are exclusive, an error denotes the end of the stream) // **special value** 0xFFFF indicates a CANCEL message // - [u8; chunk_length], either @@ -28,14 +28,14 @@ use crate::stream::*; // - if error: // - u8: error kind, encoded using error::io_errorkind_to_u8 // - rest: error message -// - absent for cancel message +// - absent for cancel messag pub(crate) type RequestID = u32; pub(crate) type ChunkLength = u16; pub(crate) const MAX_CHUNK_LENGTH: ChunkLength = 0x3FF0; -pub(crate) const ERROR_MARKER: ChunkLength = 0x4000; -pub(crate) const CHUNK_HAS_CONTINUATION: ChunkLength = 0x8000; +pub(crate) const CHUNK_FLAG_ERROR: ChunkLength = 0x4000; +pub(crate) const CHUNK_FLAG_HAS_CONTINUATION: ChunkLength = 0x8000; pub(crate) const CHUNK_LENGTH_MASK: ChunkLength = 0x3FFF; pub(crate) const CANCEL_REQUEST: ChunkLength = 0xFFFF; @@ -237,8 +237,8 @@ impl DataFrame { fn header(&self) -> [u8; 2] { let header_u16 = match self { DataFrame::Data(data, false) => data.len() as u16, - DataFrame::Data(data, true) => data.len() as u16 | CHUNK_HAS_CONTINUATION, - DataFrame::Error(msg) => msg.len() as u16 | ERROR_MARKER, + DataFrame::Data(data, true) => data.len() as u16 | CHUNK_FLAG_HAS_CONTINUATION, + DataFrame::Error(msg) => msg.len() as u16 | CHUNK_FLAG_ERROR, }; ChunkLength::to_be_bytes(header_u16) } -- cgit v1.2.3