MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / ok_or_abandon

Method ok_or_abandon

vm-migration/src/protocol.rs:258–272  ·  view source on GitHub ↗
(
        self,
        fd: &mut T,
        error: MigratableError,
    )

Source from the content-addressed store, hash-verified

256 }
257
258 pub fn ok_or_abandon<T>(
259 self,
260 fd: &mut T,
261 error: MigratableError,
262 ) -> Result<Response, MigratableError>
263 where
264 T: Read + Write,
265 {
266 if self.status != Status::Ok {
267 Request::abandon().write_to(fd)?;
268 Response::read_from(fd)?;
269 return Err(error);
270 }
271 Ok(self)
272 }
273
274 pub fn write_to(&self, fd: &mut dyn Write) -> Result<(), MigratableError> {
275 fd.write_all(Self::as_slice(self))

Callers 2

send_memory_fdsMethod · 0.80
expect_ok_responseFunction · 0.80

Calls 1

write_toMethod · 0.45

Tested by

no test coverage detected