-
Notifications
You must be signed in to change notification settings - Fork 124
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(client): de-duplicate process & run and split into h3 & h09 #1727
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1727 +/- ##
==========================================
+ Coverage 89.41% 89.48% +0.07%
==========================================
Files 124 126 +2
Lines 38897 38866 -31
==========================================
Hits 34780 34780
+ Misses 4117 4086 -31 ☔ View full report in Codecov by Sentry. |
6f4b243
to
a0236db
Compare
As a preparation to introducing sub-modules to `client`. Done in a separate commit for git to recognize the move as a move, not as a remove and add.
The Neqo Client binary supports both http3 and http09 (prev. "old"). Before this commit both the http3 and the http09 implementation had their own `run` and `process` `fn`, orchestrating the interaction between handler, client and I/O. While similar, they had subtle differences e.g. when to terminate. This commit splits the http3 and http09 specific logic into two separate modules, but extracts duplicate logic (e.g. `run` and `process`) into the shared root module.
a0236db
to
721f3e1
Compare
neqo-bin/src/bin/client.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reviewers: I suggest reviewing the two commits individually. The first simply moves bin/client.rs to bin/client/main.rs. It is done in a separate commit in order for git to recognize the move as a move and not as a remove and an add, thus showing a proper diff.
} | ||
|
||
impl<'a, H: Handler> Runner<'a, H> { | ||
async fn run(mut self) -> Res<Option<ResumptionToken>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this commit, the Neqo client implementation has a single run
function, not one for http3
and one for http09
.
token = if args.shared.use_old_http { | ||
let client = | ||
http09::create_client(&args, real_local, remote_addr, &hostname, token) | ||
.expect("failed to create client"); | ||
|
||
let handler = http09::Handler::new(to_request, &args, key_update); | ||
|
||
Runner { | ||
args: &args, | ||
client, | ||
handler, | ||
local_addr: real_local, | ||
socket: &mut socket, | ||
timeout: None, | ||
} | ||
.run() | ||
.await? | ||
} else { | ||
let client = http3::create_client(&args, real_local, remote_addr, &hostname, token) | ||
.expect("failed to create client"); | ||
|
||
let handler = http3::Handler::new(to_request, &args, key_update); | ||
|
||
Runner { | ||
args: &args, | ||
client, | ||
handler, | ||
local_addr: real_local, | ||
socket: &mut socket, | ||
timeout: None, | ||
} | ||
.run() | ||
.await? | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http3
and http09
expose the same methods (create_client
and Handler::new
) and can be run with the same Runner
.
Friendly ping. Any objections? If not, @larseggert would you mind adding this pull request to the merge queue? |
Benchmark results
|
The QUIC Interop Runner requires an http3 and http09 implementation for both client and server. The client code is already structured into an http3 and an http09 implementation since mozilla#1727. This commit does the same for the server side, i.e. splits the http3 and http09 implementation into separate Rust modules.
The QUIC Interop Runner requires an http3 and http09 implementation for both client and server. The client code is already structured into an http3 and an http09 implementation since mozilla#1727. This commit does the same for the server side, i.e. splits the http3 and http09 implementation into separate Rust modules.
There are two server implementations based on neqo: 1. https://github.com/mozilla/neqo/tree/main/neqo-bin/src/server - http3 and http09 implementation - used for manual testing and QUIC Interop 2. https://searchfox.org/mozilla-central/source/netwerk/test/http3server/src/main.rs - used to test Firefox I assume one was once an exact copy of the other. Both implement their own I/O, event loop, ... Since then, the two implementations diverged significantly. Especially (1) saw a lot of improvements in recent months: - mozilla#1564 - mozilla#1569 - mozilla#1578 - mozilla#1581 - mozilla#1604 - mozilla#1612 - mozilla#1676 - mozilla#1692 - mozilla#1707 - mozilla#1708 - mozilla#1727 - mozilla#1753 - mozilla#1756 - mozilla#1766 - mozilla#1772 - mozilla#1786 - mozilla#1787 - mozilla#1788 - mozilla#1794 - mozilla#1806 - mozilla#1808 - mozilla#1848 - mozilla#1866 At this point, bugs in (2) are hard to fix, see e.g. mozilla#1801. This commit merges (2) into (1), thus removing all duplicate logic and having (2) benefit from all the recent improvements to (1).
The QUIC Interop Runner requires an http3 and http09 implementation for both client and server. The client code is already structured into an http3 and an http09 implementation since mozilla#1727. This commit does the same for the server side, i.e. splits the http3 and http09 implementation into separate Rust modules.
There are two server implementations based on neqo: 1. https://github.com/mozilla/neqo/tree/main/neqo-bin/src/server - http3 and http09 implementation - used for manual testing and QUIC Interop 2. https://searchfox.org/mozilla-central/source/netwerk/test/http3server/src/main.rs - used to test Firefox I assume one was once an exact copy of the other. Both implement their own I/O, event loop, ... Since then, the two implementations diverged significantly. Especially (1) saw a lot of improvements in recent months: - mozilla#1564 - mozilla#1569 - mozilla#1578 - mozilla#1581 - mozilla#1604 - mozilla#1612 - mozilla#1676 - mozilla#1692 - mozilla#1707 - mozilla#1708 - mozilla#1727 - mozilla#1753 - mozilla#1756 - mozilla#1766 - mozilla#1772 - mozilla#1786 - mozilla#1787 - mozilla#1788 - mozilla#1794 - mozilla#1806 - mozilla#1808 - mozilla#1848 - mozilla#1866 At this point, bugs in (2) are hard to fix, see e.g. mozilla#1801. This commit merges (2) into (1), thus removing all duplicate logic and having (2) benefit from all the recent improvements to (1).
The QUIC Interop Runner requires an http3 and http09 implementation for both client and server. The client code is already structured into an http3 and an http09 implementation since #1727. This commit does the same for the server side, i.e. splits the http3 and http09 implementation into separate Rust modules.
* refactor(bin): introduce server/http3.rs and server/http09.rs The QUIC Interop Runner requires an http3 and http09 implementation for both client and server. The client code is already structured into an http3 and an http09 implementation since #1727. This commit does the same for the server side, i.e. splits the http3 and http09 implementation into separate Rust modules. * refactor: merge mozilla-central http3 server into neqo-bin There are two server implementations based on neqo: 1. https://github.com/mozilla/neqo/tree/main/neqo-bin/src/server - http3 and http09 implementation - used for manual testing and QUIC Interop 2. https://searchfox.org/mozilla-central/source/netwerk/test/http3server/src/main.rs - used to test Firefox I assume one was once an exact copy of the other. Both implement their own I/O, event loop, ... Since then, the two implementations diverged significantly. Especially (1) saw a lot of improvements in recent months: - #1564 - #1569 - #1578 - #1581 - #1604 - #1612 - #1676 - #1692 - #1707 - #1708 - #1727 - #1753 - #1756 - #1766 - #1772 - #1786 - #1787 - #1788 - #1794 - #1806 - #1808 - #1848 - #1866 At this point, bugs in (2) are hard to fix, see e.g. #1801. This commit merges (2) into (1), thus removing all duplicate logic and having (2) benefit from all the recent improvements to (1). * Move firefox.rs to mozilla-central * Reduce HttpServer trait functions * Extract constructor * Remove unused deps * Remove clap color feature Nice to have. Adds multiple dependencies. Hard to justify for mozilla-central.
The Neqo Client binary supports both http3 and http09 (prev. "old").
Before this commit both the http3 and the http09 implementation had their own
run
andprocess
fn
, orchestrating the interaction between handler, client and I/O. While similar, they had subtle differences e.g. when to terminate.This commit splits the http3 and http09 specific logic into two separate modules, but extracts duplicate logic (e.g.
run
andprocess
) into the shared root module.For reviewers: I suggest reviewing the two commits individually. The first simply moves
bin/client.rs
tobin/client/main.rs
. It is done in a separate commit in order for git to recognize the move as a move and not as a remove and an add, thus showing a proper diff.Part of #1696.
Simplifying
process
andrun
will make #1693 easier to implement.