Skip to content

How should UDP handle partial packets? #9238

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

Closed
brson opened this issue Sep 16, 2013 · 3 comments
Closed

How should UDP handle partial packets? #9238

brson opened this issue Sep 16, 2013 · 3 comments

Comments

@brson
Copy link
Contributor

brson commented Sep 16, 2013

Our UDP reader silently truncates partial packets. Possibly we should raise a condition when this happens.

@MaikKlein
Copy link
Contributor

From the LibUV book:

Since UDP sockets are not connected to a particular peer, the read callback receives an extra parameter about the >sender of the packet. The flags parameter may be UV_UDP_PARTIAL if the buffer provided by your allocator was not >large enough to hold the data. In this case the OS will discard the data that could not fit (That’s UDP for you!).

So it seems to behave correctly. The problem is the user will never now that there was a partial read.

@Gankra
Copy link
Contributor

Gankra commented Jan 23, 2015

CC @aturon

@alexcrichton
Copy link
Member

This was addressed in the I/O reform by having write return the number of bytes written.

flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 28, 2022
Fix ICE in `miri_to_const`

fixes rust-lang#9238
changelog: Fix ICE when using `#![feature(generic_const_exprs)]` in various lints
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

No branches or pull requests

5 participants