Avoiding busy loop in sending packet and optimize device caps

This commit is contained in:
jiangjianfeng
2024-09-25 11:15:58 +00:00
committed by Tate, Hongliang Tian
parent e0106f1f18
commit f793259512
9 changed files with 198 additions and 97 deletions

View File

@ -12,7 +12,7 @@ impl device::Device for dyn AnyNetworkDevice {
type TxToken<'a> = TxToken<'a>;
fn receive(&mut self, _timestamp: Instant) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
if self.can_receive() {
if self.can_receive() && self.can_send() {
let rx_buffer = self.receive().unwrap();
Some((RxToken(rx_buffer), TxToken(self)))
} else {