fn vm_maybe_send_dirty_pages<T>(
        vm: &mut Vm,
        socket: &mut T,
    ) -> result::Result<bool, MigratableError>
    where
        T: Read + Write,
    {
        // Send (dirty) memory table
        let table = vm.dirty_memory_range_table()?;

        // But if there are no regions go straight to pause
        if table.regions().is_empty() {
            return Ok(false);
        }

        Request::memory(table.length()).write_to(socket).unwrap();
        table.write_to(socket)?;
        // And then the memory itself
        vm.send_memory_regions(&table, socket)?;
        let res = Response::read_from(socket)?;
        if res.status() != Status::Ok {
            warn!("Error during dirty memory migration");
            Request::abandon().write_to(socket)?;
            Response::read_from(socket).ok();
            return Err(MigratableError::MigrateSend(anyhow!(
                "Error during dirty memory migration"
            )));
        }

        Ok(true)
    }
// Returns true if there were dirty pages to send
Returns true if there were dirty pages to send
Returns true if there were dirty pages to send
fn vm_maybe_send_dirty_pages<T>(
        vm: &mut Vm,
        socket: &mut T,
    ) -> result::Result<bool, MigratableError>
    where
        T: Read + Write,
    {
        // Send (dirty) memory table
        let table = vm.dirty_memory_range_table()?;
        // But if there are no regions go straight to pause
        if table.regions().is_empty() {
            return Ok(false);
        }
        Request::memory(table.length()).write_to(socket).unwrap();
        table.write_to(socket)?;
        // And then the memory itself
        vm.send_memory_regions(&table, socket)?;
        let res = Response::read_from(socket)?;
        if res.status() != Status::Ok {
            warn!("Error during dirty memory migration");
            Request::abandon().write_to(socket)?;
            Response::read_from(socket).ok();
            return Err(MigratableError::MigrateSend(anyhow!(
                "Error during dirty memory migration"
            )));
        }
        Ok(true)
    }
fn vm_maybe_send_dirty_pages < T > ( vm : & mut Vm , socket : & mut T , ) -> result :: Result < bool , MigratableError > where T : Read + Write , { // Send (dirty) memory table let table = vm . dirty_memory_range_table ( ) ? ; // But if there are no regions go straight to pause if table . regions ( ) . is_empty ( ) { return Ok ( false ) ; } Request :: memory ( table . length ( ) ) . write_to ( socket ) . unwrap ( ) ; table . write_to ( socket ) ? ; // And then the memory itself vm . send_memory_regions ( & table , socket ) ? ; let res = Response :: read_from ( socket ) ? ; if res . status ( ) != Status :: Ok { warn ! ( " " ) ; Request :: abandon ( ) . write_to ( socket ) ? ; Response :: read_from ( socket ) . ok ( ) ; return Err ( MigratableError :: MigrateSend ( anyhow ! ( " " ) ) ) ; } Ok ( true ) }
Returns true if there were dirty pages to send
Returns true if there were dirty pages to send
vm
&mut Vm
socket
&mut T
vm
&mut Vm
socket
&mut T