Comments (4)
from neqo.
When I did this for minhq, the client and server implementation shared some common code (qpack, handling messages, etc...), but the API was very different.
The client establishes a connection and makes requests. It receives pushes associated with requests/responses.
The server establishes a listening port, which results in multiple connections (but you hide the connections from the main API). It handles requests and can push associated with those requests.
minhq has a highly concurrent API, which is fundamentally different to neqo, but the basic ideas should be followed.
from neqo.
Yeah. Currently we have Http3Connection
that can be used as a client or server, (I guess depending on if the transport::Connection
was created with new_client
or new_server
). We also have RequestStreamClient
and RequestStreamServer
classes, so there already is client- or server-specific code, it just is selectively called depending on role checks at runtime.
One way to refactor might be to flip things around and have the role-specific code drive things, since ultimately the APIs will be role-specific. If there's a Http3Client
class then maybe it can directly include much of what was in RequestStreamClient
. The issue then becomes less about handling the differences between the two roles, and more about minimizing the duplication of code around qpack and control streams. Maybe Http3Client
has a Http3CommonStreamHandler
member where all that can go, and be used internally also by Http3Server
?
I think we're in a good position now to do this refactor, because the current code has reached a point where it generally works, and also has tests that will ensure refactored code also mostly works. But in the long run I think we'll be happier if the distinct client and server APIs are different types.
@ddragana what do you think? Does this sound like the right direction? If we agree to proceed with this approach, would you have time in the next week or so to tackle this, or is #10 going to keep you busy? This is a bit of a blocker for me, so I'd like to get somebody going on this relatively soon.
from neqo.
Yeah. Currently we have
Http3Connection
that can be used as a client or server, (I guess depending on if thetransport::Connection
was created withnew_client
ornew_server
). We also haveRequestStreamClient
andRequestStreamServer
classes, so there already is client- or server-specific code, it just is selectively called depending on role checks at runtime.One way to refactor might be to flip things around and have the role-specific code drive things, since ultimately the APIs will be role-specific. If there's a
Http3Client
class then maybe it can directly include much of what was inRequestStreamClient
. The issue then becomes less about handling the differences between the two roles, and more about minimizing the duplication of code around qpack and control streams. MaybeHttp3Client
has aHttp3CommonStreamHandler
member where all that can go, and be used internally also byHttp3Server
?
In my second round of refactoring the http3 code I was planning to do something like this. I do not like it either having 2 roles and always changing behavior in the code depending on the role.
About Http3CommonStreamHandler: There are some parts common to both roles, but a lot of differences are there as well, like handling setting. But that is solvable as well by supplying a hanlde if needed.
I can take a look at this.
I think we're in a good position now to do this refactor, because the current code has reached a point where it generally works, and also has tests that will ensure refactored code also mostly works. But in the long run I think we'll be happier if the distinct client and server APIs are different types.
@ddragana what do you think? Does this sound like the right direction? If we agree to proceed with this approach, would you have time in the next week or so to tackle this, or is #10 going to keep you busy? This is a bit of a blocker for me, so I'd like to get somebody going on this relatively soon.
from neqo.
Related Issues (20)
- Address score card issues HOT 1
- Bump qlog to 0.13
- If we can eliminate .primary(), then we can use that name for this function... Maybe we should do that now anyway. We want to encourage people to use the fallible option anyway.
- The functions in this file seem to be copied from the neqo-transport crate. Maybe you can just move them to the test fixture instead.
- Crashing in nss init test HOT 3
- Fuzzing HOT 1
- Token-Permissions
- CII-Best-Practices
- Pinned-Dependencies
- SAST
- Fix QNS table to be proper GFM
- Mark `amplificationlimit` QNS test as unsupported HOT 2
- Use `indexmap` 2.* instead of 1.* HOT 1
- Show only perf diffs in benchmark PR comment
- Client spews "Setting timeout of" messages HOT 6
- Assertion failure: StateSignaling must be in Idle state but is in Closing HOT 2
- `zerortt` QNS interop failures
- Use a stable version for rustup-init
- Put `qlog` behind a feature
- Address new CPU bottlenecks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neqo.