pub fn process_rx(&mut self) -> bool {
        debug!("vsock: process_rx()");
        let mem = match self.device_state {
            DeviceState::Activated(ref mem) => mem,
            // This should never happen, it's been already validated in the event handler.
            DeviceState::Inactive => unreachable!(),
        };

        let mut have_used = false;

        while let Some(head) = self.queues[RXQ_INDEX].pop(mem) {
            let used_len = match VsockPacket::from_rx_virtq_head(&head) {
                Ok(mut pkt) => {
                    if self.backend.recv_pkt(&mut pkt).is_ok() {
                        pkt.hdr().len() as u32 + pkt.len()
                    } else {
                        // We are using a consuming iterator over the virtio buffers, so, if we can't
                        // fill in this buffer, we'll need to undo the last iterator step.
                        self.queues[RXQ_INDEX].undo_pop();
                        break;
                    }
                }
                Err(e) => {
                    warn!("vsock: RX queue error: {:?}", e);
                    0
                }
            };

            have_used = true;
            self.queues[RXQ_INDEX].add_used(mem, head.index, used_len);
        }

        have_used
    }
/// Walk the driver-provided RX queue buffers and attempt to fill them up with any data that we
/// have pending. Return `true` if descriptors have been added to the used ring, and `false`
/// otherwise.
Walk the driver-provided RX queue buffers and attempt to fill them up with any data that we
have pending. Return `true` if descriptors have been added to the used ring, and `false`
otherwise.
Walk the driver - provided RX queue buffers and attempt to fill them up with any data that we have pending . Return ` true ` if descriptors have been added to the used ring and ` false ` otherwise .
pub fn process_rx(&mut self) -> bool {
        debug!("vsock: process_rx()");
        let mem = match self.device_state {
            DeviceState::Activated(ref mem) => mem,
            // This should never happen, it's been already validated in the event handler.
            DeviceState::Inactive => unreachable!(),
        };
        let mut have_used = false;
        while let Some(head) = self.queues[RXQ_INDEX].pop(mem) {
            let used_len = match VsockPacket::from_rx_virtq_head(&head) {
                Ok(mut pkt) => {
                    if self.backend.recv_pkt(&mut pkt).is_ok() {
                        pkt.hdr().len() as u32 + pkt.len()
                    } else {
                        // We are using a consuming iterator over the virtio buffers, so, if we can't
                        // fill in this buffer, we'll need to undo the last iterator step.
                        self.queues[RXQ_INDEX].undo_pop();
                        break;
                    }
                }
                Err(e) => {
                    warn!("vsock: RX queue error: {:?}", e);
                    0
                }
            };
            have_used = true;
            self.queues[RXQ_INDEX].add_used(mem, head.index, used_len);
        }
        have_used
    }
pub fn process_rx ( & mut self ) -> bool { debug ! ( " " ) ; let mem = match self . device_state { DeviceState :: Activated ( ref mem ) => mem , // This should never happen, it's been already validated in the event handler. DeviceState :: Inactive => unreachable ! ( ) , } ; let mut have_used = false ; while let Some ( head ) = self . queues [ RXQ_INDEX ] . pop ( mem ) { let used_len = match VsockPacket :: from_rx_virtq_head ( & head ) { Ok ( mut pkt ) => { if self . backend . recv_pkt ( & mut pkt ) . is_ok ( ) { pkt . hdr ( ) . len ( ) as u32 + pkt . len ( ) } else { // We are using a consuming iterator over the virtio buffers, so, if we can't // fill in this buffer, we'll need to undo the last iterator step. self . queues [ RXQ_INDEX ] . undo_pop ( ) ; break ; } } Err ( e ) => { warn ! ( " " e ) ; 0 } } ; have_used = true ; self . queues [ RXQ_INDEX ] . add_used ( mem , head . index , used_len ) ; } have_used }
Walk the driver-provided RX queue buffers and attempt to fill them up with any data that we
have pending.
Walk the driver - provided RX queue buffers and attempt to fill them up with any data that we have pending .
&mut self