Skip to content

Commit 77da3b1

Browse files
committed
pldm-file: remove Responder::init_read
Since we have FileTransferContext::new(), this doesn't do much, and is infallible. So, just call FileTransferContext::new() directly. Signed-off-by: Jeremy Kerr <[email protected]>
1 parent 7bb3e3d commit 77da3b1

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

pldm-file/src/host.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,11 @@ impl<const N: usize> Responder<N> {
369369
// a repeated FIRST_PART is valid, and restarts the transfer
370370
ctx.reset();
371371
} else {
372-
let new_ctx = Self::init_read(&cmd)?;
373-
file_ctx.xfer_ctx.replace(new_ctx);
372+
let ctx = FileTransferContext::new(
373+
cmd.req_offset as usize,
374+
cmd.req_length as usize,
375+
);
376+
file_ctx.xfer_ctx.replace(ctx);
374377
};
375378
}
376379

@@ -432,15 +435,6 @@ impl<const N: usize> Responder<N> {
432435

433436
Ok(resp)
434437
}
435-
436-
fn init_read(
437-
req: &pldm::control::MultipartReceiveReq,
438-
) -> Result<FileTransferContext> {
439-
trace!("init_read {req:?}");
440-
let start = req.req_offset as usize;
441-
let len = req.req_length as usize;
442-
Ok(FileTransferContext::new(start, len))
443-
}
444438
}
445439

446440
impl<const N: usize> Default for Responder<N> {

0 commit comments

Comments
 (0)