Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate phy::RawSocket send error to caller #588

Merged
merged 2 commits into from Feb 9, 2022
Merged

Propagate phy::RawSocket send error to caller #588

merged 2 commits into from Feb 9, 2022

Conversation

witchof0x20
Copy link
Contributor

For #587

@Dirbaio
Copy link
Member

Dirbaio commented Feb 8, 2022

Thanks for the PR!

Now that I look at it again (sorry!) in receive, WouldBlock errors are propagated and everything else panics (instead of returning Illegal):

Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => None,
Err(err) => panic!("{}", err),

send and receive should probably be consistent, either both panic or both returning an error. I don't know in which cases can a RawSocket send/recv fail, I think they should be fairly rare since it's a "virtual" network thingy instead of actually talking to a peer, so maybe panicking is better?

@witchof0x20
Copy link
Contributor Author

witchof0x20 commented Feb 9, 2022

Updated with consistent behavior. I generally lean towards propagating any error, but in the name of consistency, it makes sense to have the same behavior on both. If I run into other errors, I can file a separate issue!

Copy link
Member

@Dirbaio Dirbaio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

bors r+

@bors
Copy link
Contributor

bors bot commented Feb 9, 2022

Build succeeded:

@bors bors bot merged commit cb9b467 into smoltcp-rs:master Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants