Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

quic: ensure callbacks of QuicSocket.connect() get called #198

Open
wants to merge 119 commits into
base: master
Choose a base branch
from

Conversation

oyyd
Copy link
Contributor

@oyyd oyyd commented Nov 19, 2019

The callbacks of QuicSocket.connect() won't get called after
QuicSocket binding. This PR calls QuicSession[kReady]() directly
when QuicSocket bound to fix this issue.

This PR also modify SocketAddress::Hash and SocketAddress::Compare
to accept values instead of pointers because SocketAddress might
get freed firstly which would cause that the values aren't safe.
For example, the test added is likely to abort before this PR.

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

addaleax and others added 30 commits October 2, 2019 16:18
Referring to `BaseObject` instances using standard C++ smart pointers
can interfere with BaseObject’s own cleanup mechanisms
(explicit delete, delete-on-GC and delete-on-cleanup).

Introducing custom smart pointers allows referring to `BaseObject`s
safely while keeping those mechanisms intact.

PR-URL: nodejs#141
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#141
Reviewed-By: James M Snell <jasnell@gmail.com>
Co-authored-by: Anna Henningsen <anna@addaleax.net>
Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
Co-authored-by: gengjiawen <technicalcute@gmail.com>
Co-authored-by: James M Snell <jasnell@gmail.com>
Co-authored-by: Lucas Pardue <lucaspardue.24.7@gmail.com>
Co-authored-by: oyyd <oyydoibh@gmail.com
The extensive testing done on http2 makes it easier to make sure
the implementation is correct (and doesn’t diverge unnecessarily).

PR-URL: nodejs#126
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Ported from
tatsuhiro-t/openssl@920a331

PR-URL: nodejs#6
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Ported from
tatsuhiro-t/openssl@920a331

PR-URL: nodejs#6
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
PR-URL: nodejs#145
Reviewed-By: James M Snell <jasnell@gmail.com>
Fixes: nodejs#59
PR-URL: nodejs#145
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#147
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This fixes a crash in test/sequential/test-performance-eventloopdelay.js.
This should be squashed into

> src: introduce custom smart pointers for `BaseObject`s

PR-URL: nodejs#149
Reviewed-By: James M Snell <jasnell@gmail.com>
Introduced in aa99a6a.

PR-URL: nodejs#149
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#149
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#154
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
PR-URL: nodejs#153
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
PR-URL: nodejs#152
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Previously, if the expiry timestamp was in the future by less
than 1ms, the retransmission timer would not have been scheduled.

(This also removes an unused line from the test that this
problem made flaky.)

PR-URL: nodejs#157
Reviewed-By: James M Snell <jasnell@gmail.com>
If we set `preferredAddressPolicy` to `accept` on `QuicClientSession`
but receives an invalid preferred address, e.g. we don't define
`preferredAddress` on the server, the `QuicClientSession` should still
work. Before this PR, the included test will cause segmetation fault.

PR-URL: nodejs#155
Reviewed-By: James M Snell <jasnell@gmail.com>
It would be better to add a test to ensure that the timeout is
greater than the triple PTO if we can get the PTO.

PR-URL: nodejs#160
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#159
Reviewed-By: James M Snell <jasnell@gmail.com>
Update this code to be more in line with the Windows version.

Previously, callers (such as nodejs) might assume it was always safe to de-reference this parameter:
https://github.com/nodejs/node/blob/d2634be56258e2b957c1061c5f4d86792975bfa9/src/tcp_wrap.cc#L349 called from https://github.com/nodejs/node/blob/d2634be56258e2b957c1061c5f4d86792975bfa9/src/udp_wrap.cc#L567

I suspect this may have been unreachable, and that it was guaranteed by the kernel to be `>= sizeof(struct sockaddr)`, so this should be a NFC simplification.

PR-URL: libuv/libuv#2330
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
FreeBSD defines `sin_len` and `sin6_len` inside `sockaddr_in` and
`sockaddr_in6`. `sockaddr`s come from `getsockname` and `uv_ip4_addr`
will differ in the first byte if libuv doesn't set `sin_len` correctly.

PR-URL: libuv/libuv#2492
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
This reverts commit 170c5d0.

PR-URL: nodejs#138
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This reverts commit ecda77c.

PR-URL: nodejs#138
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: nodejs#138
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: nodejs#138
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: nodejs#138
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit will need to be submitted upstream then backed out
once it lands and we can update

PR-URL: nodejs#138
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: nodejs#138
Reviewed-By: Anna Henningsen <anna@addaleax.net>
The recent commits have broken the build, tests, and linting.

One cctest is not fixed but rather disabled here.

PR-URL: nodejs#162
After ngtcp2 being updated, `ngtcp2_conn_get_idle_timeout` is renamed as
`ngtcp2_conn_get_idle_expiry` which returns `ngtcp2_tstamp` instead of
`ngtcp2_duration`.

Refs: https://github.com/ngtcp2/ngtcp2/blob/6f40668cdce7db7c043d3a80c07f379841d8c51e/lib/ngtcp2_conn.c#L8604
PR-URL: nodejs#166
Reviewed-By: Anna Henningsen <anna@addaleax.net>
jasnell and others added 8 commits December 4, 2019 11:05
PR-URL: nodejs#213
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: nodejs#216
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: nodejs#216
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Generate stateless reset token cryptographically

Fixes: nodejs#62
PR-URL: nodejs#215
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: nodejs#217
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: nodejs#217
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: nodejs#217
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Currently the doc target fails and this commit attempts for fix these
errors.

PR-URL: nodejs#221
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@oyyd oyyd force-pushed the connect-ready branch 2 times, most recently from 21377c1 to be8cf91 Compare December 9, 2019 07:45
1. The callbacks of QuicSocket.connect() won't get called after
QuicSocket binding. To fix this issue, This PR calls
QuicSession[kReady]() directly when QuicSocket bound.

2. This PR also modify SocketAddress::Hash and SocketAddress::Compare
to accept struct values instead of pointers because SocketAddress might
get freed firstly which would cause the values aren't safe to use.
For example, the test added in this PR is likely to abort before this PR.
@oyyd oyyd changed the title WIP quic: ensure callbacks of QuicSocket.connect() get called quic: ensure callbacks of QuicSocket.connect() get called Dec 9, 2019
@oyyd
Copy link
Contributor Author

oyyd commented Dec 9, 2019

Also cc @jasnell @danbev for more reviews.

@jasnell
Copy link
Member

jasnell commented Dec 13, 2019

Heads up, this will need to be rebased

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants