Skip to content

quic: continued refactoring of quic APIs - #34351

Closed
jasnell wants to merge 8 commits into
nodejs:masterfrom
jasnell:quic-cleanups-7
Closed

quic: continued refactoring of quic APIs#34351
jasnell wants to merge 8 commits into
nodejs:masterfrom
jasnell:quic-cleanups-7

Conversation

@jasnell

@jasnelljasnell commented Jul 14, 2020

Copy link
Copy Markdown
Member

@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-botnodejs-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 teamJuly 16, 2020 00:21
@nodejs-github-bot

nodejs-github-bot commented Jul 16, 2020

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@jasnell
jasnell marked this pull request as draft July 16, 2020 04:58
@jasnell

Copy link
Copy Markdown
MemberAuthor

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

Comment threadlib/internal/quic/core.js Outdated
Comment threadlib/internal/quic/core.js Outdated
@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

nodejs-github-bot commented Jul 17, 2020

Copy link
Copy Markdown
Collaborator

@jasnell
jasnell marked this pull request as draft July 17, 2020 23:51
@jasnell

Copy link
Copy Markdown
MemberAuthor

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

@jasnell

Copy link
Copy Markdown
MemberAuthor

@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...

conststream=awaitsession.openStream();console.log(stream.unidirectional);

We end up having to do...

conststream=session.openStream();awaitonce(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
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

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
jasnellforce-pushed the quic-cleanups-7 branch 2 times, most recently from fcad493 to 529a5c1CompareJuly 22, 2020 16:17
@jasnell
jasnell marked this pull request as ready for review July 22, 2020 16:17
@jasnell

Copy link
Copy Markdown
MemberAuthor

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

Comment threadlib/internal/quic/core.js Outdated
Comment threadlib/internal/quic/core.js Outdated
Comment threadlib/internal/quic/core.js Outdated
Comment threadsrc/quic/node_quic_session.cc Outdated
Comment threadlib/internal/quic/core.js Outdated
@nodejs-github-bot

nodejs-github-bot commented Jul 22, 2020

Copy link
Copy Markdown
Collaborator

@jasnelljasnell 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 <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
jasnell added a commit that referenced this pull request Jul 23, 2020
PR-URL: #34351
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
jasnell added a commit that referenced this pull request Jul 23, 2020
Removing no longer needed code
PR-URL: #34351
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
jasnell added a commit that referenced this pull request Jul 23, 2020
PR-URL: #34351
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
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 <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
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 <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
jasnell added a commit that referenced this pull request Jul 23, 2020
PR-URL: #34351
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
jasnell added a commit that referenced this pull request Jul 23, 2020
PR-URL: #34351
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@jasnell

Copy link
Copy Markdown
MemberAuthor

Landed in 69c78be...b06fe33

@jasnelljasnell closed this Jul 23, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs 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 / srcIssues and PRs related to general changes in the lib or src directory.quicIssues and PRs related to the QUIC implementation / HTTP/3.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@jasnell@nodejs-github-bot@ronag@addaleax