Skip to content

Commit

Permalink
Changed behavior of phy::RawSocket TxToken::consume to be more simila…
Browse files Browse the repository at this point in the history
…r to RawSocket::receive
  • Loading branch information
witchof0x20 committed Feb 9, 2022
1 parent 32bf949 commit 32974f8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/phy/raw_socket.rs
Expand Up @@ -111,12 +111,10 @@ impl phy::TxToken for TxToken {
let mut lower = self.lower.borrow_mut();
let mut buffer = vec![0; len];
let result = f(&mut buffer);
if let Err(err) = lower.send(&buffer[..]) {
return match err.kind() {
io::ErrorKind::WouldBlock => Err(crate::Error::Exhausted),
_ => Err(crate::Error::Illegal),
};
match lower.send(&buffer[..]) {
Ok(_) => result,
Err(err) if err.kind() == io::ErrorKind::WouldBlock => Err(crate::Error::Exhausted),
Err(err) => panic!("{}", err),
}
result
}
}

0 comments on commit 32974f8

Please sign in to comment.