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

refactor(endpoint): use array::from_fn instead of unsafe MaybeUninit #1806

Merged
merged 3 commits into from
Apr 4, 2024

Conversation

mxinden
Copy link
Contributor

@mxinden mxinden commented Apr 4, 2024

With Rust 1.63.0 one can initialize a std::array via std::array::from_fn.

https://doc.rust-lang.org/std/array/fn.from_fn.html

Thus there is no need to start with an uninitialized array via MaybeUninit, initialize it and then use unsafe to assume_init. Instead one can initialize the array with the concrete elements right away.


Meta: quinn-udp has been very helpful in mozilla/neqo#1741. Thanks!

With Rust 1.63.0 one can initialize a `std::array` via `std::array::from_fn`.

https://doc.rust-lang.org/std/array/fn.from_fn.html

Thus there is no need to start with an uninitialized array via `MaybeUninit`,
initialize it and then use `unsafe` to `assume_init`. Instead one can initialize
the array with the concrete elements right away.
@mxinden mxinden changed the title refactor(endpoint): use array:from_fn instead of unsafe MaybeUninit refactor(endpoint): use array::from_fn instead of unsafe MaybeUninit Apr 4, 2024
@djc
Copy link
Member

djc commented Apr 4, 2024

Meta: quinn-udp has been very helpful in mozilla/neqo#1741. Thanks!

What happened to the plan to use quinn-udp directly for neqo?

@mxinden
Copy link
Contributor Author

mxinden commented Apr 4, 2024

Meta: quinn-udp has been very helpful in mozilla/neqo#1741. Thanks!

What happened to the plan to use quinn-udp directly for neqo?

For others, some context: #1749.

For now, I am refactoring neqo-client and neqo-server, two wrappers around the Neqo state machine, to use quinn-udp and thereby be able to test ECN (mozilla/neqo#1678) and multi-packet I/O (mozilla/neqo#1693). Note neither neqo-client nor neqo-server are used in Firefox.

Whether long term quinn-udp will be used in Firefox, or whether this work will only inform a decision on future next steps for Firefox' UDP I/O layer, is beyond my powers, but up to the folks at Mozilla. (Note I am not affiliated with Mozilla. Just an external contributor.)

@djc
Copy link
Member

djc commented Apr 4, 2024

For now, I am refactoring neqo-client and neqo-server, two wrappers around the Neqo state machine, to use quinn-udp and thereby be able to test ECN (mozilla/neqo#1678) and multi-packet I/O (mozilla/neqo#1693). Note neither neqo-client nor neqo-server are used in Firefox.

Whether long term quinn-udp will be used in Firefox, or whether this work will only inform a decision on future next steps for Firefox' UDP I/O layer, is beyond my powers, but up to the folks at Mozilla. (Note I am not affiliated with Mozilla. Just an external contributor.)

I'm still curious -- does Firefox still use neqo, if it doesn't use neqo-client or neqo-server? If you're not at Mozilla, what is your goal in contributing to Neqo?

@mxinden
Copy link
Contributor Author

mxinden commented Apr 4, 2024

does Firefox still use neqo

Yes https://searchfox.org/mozilla-central/source/netwerk/socket/neqo_glue/Cargo.toml#12-15

if it doesn't use neqo-client or neqo-server

Sorry for the confusion. Firefox uses neqo-http3, neqo-transport, neqo-common and neqo-qpack. These are the equivalent to quinn-proto. For I/O, Firefox uses https://github.com/nss-dev/nspr (simplified) the equivalent to quinn-udp.

In order to test the above neqo-* crates only without having to build all of Firefox, one can instead use the small non-production binary crates neqo-client and neqo-server. Instead of NSPR, neqo-client and neqo-server use quinn-udp (since mozilla/neqo#1604).

Does that help @djc?

If you're not at Mozilla, what is your goal in contributing to Neqo?

I have left rust-libp2p in December https://max-inden.de/post/2024-02-29-stepping-down/. Assuming that is where you know me from. While looking for a new job, Neqo is a great way to spend my free time.

@djc
Copy link
Member

djc commented Apr 4, 2024

I have left rust-libp2p in December https://max-inden.de/post/2024-02-29-stepping-down/. Assuming that is where you know me from. While looking for a new job, Neqo is a great way to spend my free time.

Yeah, that is where I knew you from -- was just wondering if someone was paying you to work on Neqo. Enjoy the time off!

Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

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

Thanks!

@Ralith Ralith merged commit 65bddc9 into quinn-rs:main Apr 4, 2024
8 checks passed
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.

3 participants