aboutsummaryrefslogtreecommitdiff
path: root/src/proto.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/proto.rs')
-rw-r--r--src/proto.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/proto.rs b/src/proto.rs
index 5b71ba5..3811e3f 100644
--- a/src/proto.rs
+++ b/src/proto.rs
@@ -38,11 +38,19 @@ pub const PRIO_PRIMARY: RequestPriority = 0x00;
/// Priority: secondary among given class (ex: `PRIO_HIGH | PRIO_SECONDARY`)
pub const PRIO_SECONDARY: RequestPriority = 0x01;
+// Messages are sent by chunks
+// Chunk format:
+// - u32 BE: request id (same for request and response)
+// - u16 BE: chunk length, possibly with CHUNK_HAS_CONTINUATION flag
+// when this is not the last chunk of the message
+// - [u8; chunk_length] chunk data
+
pub(crate) type RequestID = u32;
type ChunkLength = u16;
const MAX_CHUNK_LENGTH: ChunkLength = 0x4000;
const CHUNK_HAS_CONTINUATION: ChunkLength = 0x8000;
+
struct SendQueueItem {
id: RequestID,
prio: RequestPriority,
@@ -86,12 +94,6 @@ impl SendQueue {
}
}
-// Messages are sent by chunks
-// Chunk format:
-// - u32 BE: request id (same for request and response)
-// - u16 BE: chunk length
-// - [u8; chunk_length] chunk data
-
#[async_trait]
pub(crate) trait SendLoop: Sync {
async fn send_loop<W>(