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

quic: continued refactoring of quic APIs #34351

Closed
wants to merge 8 commits into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Jul 14, 2020

@nodejs/quic ... this one includes a fairly extensive reworking of the QuicStream lifecycle, including being able to enable autoDestroy, eliminating the 'abort' event and the aborted property, fixing up a number of bugs and internal timing issues. There's still a lot to do to validate protocol, timing, and error handling, but this is a major step in the right direction.

/cc @ronag

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Jul 14, 2020
@jasnell jasnell marked this pull request as ready for review July 16, 2020 00:21
@jasnell jasnell requested a review from a team July 16, 2020 00:21
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jul 16, 2020

@nodejs-github-bot
Copy link
Collaborator

@jasnell jasnell marked this pull request as draft July 16, 2020 04:58
@jasnell
Copy link
Member Author

jasnell commented Jul 16, 2020

Moving back to a draft, several failures on POSIX systems...

lib/internal/quic/core.js Outdated Show resolved Hide resolved
lib/internal/quic/core.js Outdated Show resolved Hide resolved
@jasnell jasnell marked this pull request as ready for review July 16, 2020 23:34
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jul 17, 2020

@jasnell jasnell marked this pull request as draft July 17, 2020 23:51
@jasnell
Copy link
Member Author

jasnell commented Jul 17, 2020

Moving back to draft to work on the changes @ronag suggested for using an async _construct

@jasnell
Copy link
Member Author

jasnell commented Jul 21, 2020

@ronag... so just to follow up on this. I've gone ahead and made the change to use async _construct(), however, it really does not improve the ergonomics of the API at all because there are a number of properties and methods that are only meaningful/useful after the internal handle is created. What we end up with is, instead of...

const stream = await session.openStream();
console.log(stream.unidirectional);

We end up having to do...

const stream = session.openStream();
await once(stream, 'ready');
console.log(stream.unidirectional);

The additional methods for sending headers, getting the id and directionality of the stream, etc, all end up having to wait until after the ready event anyway. We could buffer the method calls and make those wait on 'ready' internally but it just adds complexity.

I'm really preferring the const stream = await session.openStream() variation that this PR implemented originally.

@ronag
Copy link
Member

ronag commented Jul 22, 2020

I'm really preferring the const stream = await session.openStream() variation that this PR implemented originally.

Yea that does seem simpler. Just feels a little different than the rest of our API's (maybe calling it connect would make it more familiar). Being able to start writing to the stream without having to await is kind of nice but not that important I guess.

@jasnell
Copy link
Member Author

jasnell commented Jul 22, 2020

Yea that does seem simpler. Just feels a little different than the rest of our API's (maybe calling it connect would make it more familiar). Being able to start writing to the stream without having to await is kind of nice but not that important I guess.

connect is already used on the QuicSocket to create the client-side QuicSession instance. In this case, openStream() is exactly descriptive of what it does.

The move to the async _construct() is definitely good to do, but I will make it so that openStream() returns Promise that resolves when the async _construct() resolves.

@jasnell jasnell force-pushed the quic-cleanups-7 branch 2 times, most recently from fcad493 to 529a5c1 Compare July 22, 2020 16:17
@jasnell jasnell marked this pull request as ready for review July 22, 2020 16:17
@jasnell
Copy link
Member Author

jasnell commented Jul 22, 2020

Ok, @nodejs/quic .. this should finally be ready for review

src/quic/node_quic_session.cc Outdated Show resolved Hide resolved
lib/internal/quic/core.js Outdated Show resolved Hide resolved
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jul 22, 2020

@jasnell jasnell added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. dont-land-on-v14.x quic Issues and PRs related to the QUIC implementation / HTTP/3. labels Jul 22, 2020
Although most of the time openStream will be able to create the stream
immediately, when a stream is opened before the handshake is complete
we have to wait for the handshake to be complete before continuing.
Removing no longer needed code
qlog files are diagnostic files that are being used to verify
the quic implementation. Make sure they don't get checked in.
This one was a bit of a rabbit hole... but, with this set of
changes, `QuicStream` should now work with autoDestroy, supports
a promisified `close()`, and fixes a number of other internal
bugs that were spotted trying to get it to work.
jasnell added a commit that referenced this pull request Jul 23, 2020
Although most of the time openStream will be able to create the stream
immediately, when a stream is opened before the handshake is complete
we have to wait for the handshake to be complete before continuing.

PR-URL: #34351
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
jasnell added a commit that referenced this pull request Jul 23, 2020
PR-URL: #34351
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
jasnell added a commit that referenced this pull request Jul 23, 2020
Removing no longer needed code

PR-URL: #34351
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
jasnell added a commit that referenced this pull request Jul 23, 2020
PR-URL: #34351
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
jasnell added a commit that referenced this pull request Jul 23, 2020
qlog files are diagnostic files that are being used to verify
the quic implementation. Make sure they don't get checked in.

PR-URL: #34351
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
jasnell added a commit that referenced this pull request Jul 23, 2020
This one was a bit of a rabbit hole... but, with this set of
changes, `QuicStream` should now work with autoDestroy, supports
a promisified `close()`, and fixes a number of other internal
bugs that were spotted trying to get it to work.

PR-URL: #34351
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
jasnell added a commit that referenced this pull request Jul 23, 2020
PR-URL: #34351
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
jasnell added a commit that referenced this pull request Jul 23, 2020
PR-URL: #34351
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@jasnell
Copy link
Member Author

jasnell commented Jul 23, 2020

Landed in 69c78be...b06fe33

@jasnell jasnell closed this Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. quic Issues and PRs related to the QUIC implementation / HTTP/3.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants