forked from mozilla/neqo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(udp): ignore empty datagram (mozilla#2044)
* test(udp): assert ignoring of empty datagram * fix(udp): ignore empty datagram When receiving an emtpy datagram `meta.len` and `meta.stride` would be `0`. Chunking the receive buffer via `.chunks(0)` would panic with: ``` chunk size must be non-zero ``` See also panic docs on `slice::chunks`: https://doc.rust-lang.org/std/primitive.slice.html#method.chunks With this commit `recv_inner` ignores the empty datagram. In addition, under the assumption that an empty datagram is not a faulty event, `recv_inner` attempts another receive call on the socket. This ensures that the socket eventually returns `WouldBlock` and is thus registered for the next wake-up with the corresponding event loop (e.g. tokio`).
- Loading branch information
Showing
2 changed files
with
54 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters