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: additional quic refactors/cleanups #34160

Open
wants to merge 11 commits into
base: master
from

Conversation

@jasnell
Copy link
Member

jasnell commented Jul 1, 2020

This is ready for review...

  • quic: continued refactoring for quic_stream/quic_session
  • quic: refactor native object flags for better readability
  • quic: additional cleanups on the c++ side

The first three commits are general improvements to improve maintainability, readability, and quality of the c++ code...

  • quic: refactor QuicSession close/destroy flow

This commit refactors the QuicSession close/destroy flow to (a) make it more correct and (b) make it far easier to reason about.

  • quic: refactor QuicSession shared state to use AliasedStruct

The shared state between the C++ side and the JavaScript side was using an AliasedArray where everything was uint64_t, which is wasteful given that most of the state fields are simple booleans. Using an AliasedStruct allows it to be more compact but does make reading it a bit more complicated on the JS side. Overall, this should be easier to maintain.

  • quic: remove onSessionDestroy callback

The onSessionDestroy callback was calling out to JavaScript during the QuicSession C++ object deconstruction, which could happen during garbage collection, so that's a no-no. This eliminates that callback.

  • quic: refactor qlog handling

What it says on the tin.

  • quic: fixup lint issues

Also self-explanatory

  • quic: cleanup timers if they haven't been already

When the QuicSession is GC'd without a proper destroy, the timers weren't being freed properly. Make
sure they are stopped.

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
@jasnell jasnell added the quic label Jul 1, 2020
@jasnell jasnell added this to Backlog in QUIC via automation Jul 1, 2020
@jasnell jasnell moved this from Backlog to In Progress in QUIC Jul 1, 2020
@jasnell jasnell force-pushed the jasnell:quic-cleanups-3 branch 2 times, most recently from 092153e to 244b88e Jul 1, 2020
@zbot473

This comment was marked as outdated.

@jasnell jasnell force-pushed the jasnell:quic-cleanups-3 branch 3 times, most recently from 0071050 to bab96a7 Jul 2, 2020
@jasnell jasnell marked this pull request as ready for review Jul 2, 2020
@jasnell jasnell requested a review from nodejs/quic as a code owner Jul 2, 2020
@jasnell

This comment was marked as outdated.

@zbot473

This comment was marked as outdated.

@jasnell

This comment was marked as outdated.

@zbot473

This comment was marked as outdated.

@gengjiawen

This comment was marked as outdated.

@zbot473

This comment was marked as outdated.

@zbot473

This comment was marked as outdated.

@jasnell

This comment was marked as outdated.

@jasnell
Copy link
Member Author

jasnell commented Jul 3, 2020

src/quic/node_quic_session.h Outdated Show resolved Hide resolved
src/quic/node_quic_session.cc Outdated Show resolved Hide resolved
src/quic/node_quic_session.h Outdated Show resolved Hide resolved
jasnell added 2 commits Jul 1, 2020
The QuicSession can be destroyed during garbage collection and
the onSessionDestroy callback was happening in the destructor.
jasnell added 3 commits Jul 2, 2020
Because of the timing of qlog events emitted by ngtcp2, it
becomes difficult to handle those as events on the QuicSession
object because the final qlog entry is not emitted until the
ngtcp2_conn is freed, which can occur when the object is being
garbage collected (meaning, we a: can't call out to javascript
and b: don't have an object we can use to emit the event).

This refactors it into a QLogStream object that allows the
qlog data to be piped out using a separate Readable stream.
@jasnell jasnell force-pushed the jasnell:quic-cleanups-3 branch from 3d5ac78 to 5ee492e Jul 3, 2020
@jasnell
Copy link
Member Author

jasnell commented Jul 3, 2020

@addaleax... updated, PTAL

@jasnell jasnell requested a review from addaleax Jul 3, 2020
@jasnell
Copy link
Member Author

jasnell commented Jul 3, 2020

@zbot473
Copy link

zbot473 commented Jul 3, 2020

What's the difference between a vanilla QUIC implementation with the proper ALPN and QuicTransport?

I know this probably isn't the best place to talk about this, but I am going to hold off on making a new issue until this PR is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
QUIC
  
In Progress
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.