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

Return Truncate error instead of looping forever on udp send. #3804

Merged
merged 2 commits into from
Jan 26, 2025

Conversation

Easyoakland
Copy link
Contributor

@Easyoakland Easyoakland commented Jan 25, 2025

Issue

If the udpsocket send methods are given a buffer larger than the udp payload buffer the methods loop await forever trying to send and getting BufferFull.

Fix

Check and early-return if udp::send methods receive a buffer too large to ever be sent.

Details

smoltcp used to distinguish these but stopped here. I'm not sure why. You can still the the remnant in the now invalid comment for smoltcp::socket::udp::Socket::send mentioning Truncate. I don't know if it would be preferred to update smoltcp or leave the fix here in embassy-net.

@Easyoakland Easyoakland changed the title Truncate instead of looping forever on udp send. Return Truncate error instead of looping forever on udp send. Jan 25, 2025
embassy-net/src/udp.rs Outdated Show resolved Hide resolved
embassy-net/src/udp.rs Outdated Show resolved Hide resolved
- rename to Truncated to `PacketTooLarge`
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!

@Dirbaio Dirbaio added this pull request to the merge queue Jan 26, 2025
Merged via the queue into embassy-rs:main with commit 7ec0b30 Jan 26, 2025
7 checks passed
@Easyoakland
Copy link
Contributor Author

Oh, I forgot to update the comments to match the name change. Should I make a new Pr for that?

@Dirbaio
Copy link
Member

Dirbaio commented Jan 26, 2025

oh, yes please! btw could you also remove the Poll::Ready mention? it's already implied that when an async function returns it has returned Poll::Ready.

@Easyoakland Easyoakland mentioned this pull request Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants