Skip to content

Commit

Permalink
Implement can_recv in terms of poll_receive.
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Nov 14, 2023
1 parent b1fdc11 commit ceb6ee1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/device/net/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl<H: Hal, T: Transport, const QUEUE_SIZE: usize> VirtIONet<H, T, QUEUE_SIZE>

/// Whether can receive packet.
pub fn can_recv(&self) -> bool {
self.inner.can_recv()
self.inner.poll_receive().is_some()
}

/// Receives a [`RxBuffer`] from network. If currently no data, returns an
Expand Down
2 changes: 1 addition & 1 deletion src/device/net/dev_raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl<H: Hal, T: Transport, const QUEUE_SIZE: usize> VirtIONetRaw<H, T, QUEUE_SIZ
/// Fetches the token of the next completed reception request from the
/// used ring and returns it, without removing it from the used ring. If
/// there are no pending completed requests it returns [`None`].
pub fn poll_receive(&mut self) -> Option<u16> {
pub fn poll_receive(&self) -> Option<u16> {
self.recv_queue.peek_used()
}

Expand Down

0 comments on commit ceb6ee1

Please sign in to comment.