From eafa9305051a0d97bee4f62cde8ad90f868dda03 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 16 May 2021 20:44:04 +0100 Subject: [PATCH] cmdlistener: Use a concrete type for the read stream The write stream is still Box Signed-off-by: Ian Jackson --- daemon/cmdlistener.rs | 15 ++++++++------- src/packetframe.rs | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/daemon/cmdlistener.rs b/daemon/cmdlistener.rs index 64ad89d1..1fcd812e 100644 --- a/daemon/cmdlistener.rs +++ b/daemon/cmdlistener.rs @@ -74,11 +74,11 @@ pub const TP_ACCESS_BUNDLES: &[TP] = &[ // ---------- management command implementations //#[throws(CSE)] -fn execute_and_respond(cs: &mut CommandStreamData, cmd: MgmtCommand, - bulk_upload: ReadFrame, - for_response: &mut FrameWriter) - -> Result<(), CSE> - where R: Read, W: Write +fn execute_and_respond(cs: &mut CommandStreamData, cmd: MgmtCommand, + bulk_upload: &mut ReadFrame, + for_response: &mut FrameWriter) + -> Result<(), CSE> + where W: Write { let mut bulk_download: Option> = None; let mut for_response = for_response @@ -1351,8 +1351,9 @@ impl CommandStream<'_> { loop { use MgmtChannelReadError::*; match self.chan.read.read_withbulk::() { - Ok((cmd, rbulk)) => { - execute_and_respond(&mut self.d, cmd, rbulk, &mut self.chan.write)?; + Ok((cmd, mut rbulk)) => { + execute_and_respond(&mut self.d, cmd, &mut rbulk, + &mut self.chan.write)?; }, Err(EOF) => break, Err(IO(e)) => Err(e).context("read command stream")?, diff --git a/src/packetframe.rs b/src/packetframe.rs index 5effbfd7..745568bf 100644 --- a/src/packetframe.rs +++ b/src/packetframe.rs @@ -291,7 +291,7 @@ impl FrameReader { } #[throws(MgmtChannelReadError)] - pub fn read_withbulk<'c,T>(&'c mut self) -> (T, ReadFrame) + pub fn read_withbulk<'c,T>(&'c mut self) -> (T, ReadFrame<'c,R>) where T: DeserializeOwned + Debug { let mut f = self.new_frame()?.ok_or(MgmtChannelReadError::EOF)?; -- 2.30.2