From 190e85ccbfea9e8d8402d75b47c55c925615ac5e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 22 Aug 2021 16:04:08 +0100 Subject: [PATCH] rename [Frame]QueueBuf Signed-off-by: Ian Jackson --- client/client.rs | 2 +- server/suser.rs | 3 ++- src/queue.rs | 18 +++++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/client/client.rs b/client/client.rs index e3548d4..cd87c8a 100644 --- a/client/client.rs +++ b/client/client.rs @@ -192,7 +192,7 @@ async fn run_client( let mut reqs: Vec = Vec::with_capacity(ic.max_requests_outstanding.sat()); - let mut rx_queue: FrameQueue = default(); + let mut rx_queue: FrameQueueBuf = default(); let trouble = async { loop { diff --git a/server/suser.rs b/server/suser.rs index b4e3e52..28929d9 100644 --- a/server/suser.rs +++ b/server/suser.rs @@ -28,7 +28,7 @@ pub async fn run(global: Arc, target_requests_outstanding: u32, } let mut outstanding: VecDeque = default(); - let downbound: VecDeque<(/*xxx*/)> = default(); + let mut downbound: VecDeque = default(); let try_send_response = | reply_to: oneshot::Sender, @@ -61,6 +61,7 @@ pub async fn run(global: Arc, select!{ biased; + // xxx something something routed something req = web.recv() => diff --git a/src/queue.rs b/src/queue.rs index ba1d4ff..c87e1d7 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -5,18 +5,18 @@ use crate::prelude::*; #[derive(Default,Clone)] -pub struct Queue { +pub struct QueueBuf { content: usize, eaten1: usize, // 0 <= eaten1 < queue.front()...len() queue: VecDeque, } #[derive(Default,Debug,Clone)] -pub struct FrameQueue { - queue: Queue, [u8]>>, +pub struct FrameQueueBuf { + queue: QueueBuf, [u8]>>, } -impl Debug for Queue where E: AsRef<[u8]> { +impl Debug for QueueBuf where E: AsRef<[u8]> { #[throws(fmt::Error)] fn fmt(&self, f: &mut fmt::Formatter) { write!(f, "Queue{{content={},eaten1={},queue=[", @@ -26,7 +26,7 @@ impl Debug for Queue where E: AsRef<[u8]> { } } -impl Queue where E: AsRef<[u8]> { +impl QueueBuf where E: AsRef<[u8]> { pub fn push>(&mut self, b: B) { self.push_(b.into()); } @@ -38,7 +38,7 @@ impl Queue where E: AsRef<[u8]> { pub fn is_empty(&self) -> bool { self.content == 0 } } -impl FrameQueue { +impl FrameQueueBuf { pub fn push>>(&mut self, b: B) { self.push_(b.into()); } @@ -49,7 +49,7 @@ impl FrameQueue { pub fn is_empty(&self) -> bool { self.queue.is_empty() } } -impl Extend for FrameQueue where E: Into> { +impl Extend for FrameQueueBuf where E: Into> { fn extend(&mut self, it: I) where I: IntoIterator { @@ -57,7 +57,7 @@ impl Extend for FrameQueue where E: Into> { } } -impl hyper::body::Buf for Queue where E: AsRef<[u8]> { +impl hyper::body::Buf for QueueBuf where E: AsRef<[u8]> { fn remaining(&self) -> usize { self.content } fn chunk(&self) -> &[u8] { let front = if let Some(f) = self.queue.front() { f } else { return &[] }; @@ -76,7 +76,7 @@ impl hyper::body::Buf for Queue where E: AsRef<[u8]> { } } -impl hyper::body::Buf for FrameQueue { +impl hyper::body::Buf for FrameQueueBuf { fn remaining(&self) -> usize { self.queue.remaining() } fn chunk(&self) -> &[u8] { self.queue.chunk() } fn advance(&mut self, cnt: usize) { self.queue.advance(cnt) } -- 2.30.2