1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-08-09 20:42:44 +03:00
Commit Graph

19 Commits

Author SHA1 Message Date
Hani Damlaj
6cd4f47735 elide malloc calls
Summary: - optimizing `setSupportedExtensionTransportParameters()` to elide invocations to malloc()

Reviewed By: mjoras

Differential Revision: D43844018

fbshipit-source-id: 38da5c62786f795a3a79e7592d06d4da1d7487ba
2023-03-15 15:58:02 -07:00
Joseph Beshay
4097c5c4c3 Decide whether to send knob frames based upon the transport parameter only and cache it for 0-rtt connections
Summary:
This removes the older method of deciding whether knob frames should be sent using the QuicVersion. With this change, the client can only send knobs when the server has signaled support using the `knob_frames_supported` transport parameter.

To make sure that knobs can be sent in 0-rtt connections, the transport parameter is now included in the client's cache of server transport parameters.

Reviewed By: mjoras

Differential Revision: D43014893

fbshipit-source-id: 204dd43b4551cd1c943153a3716e882fc80e6136
2023-02-07 18:06:27 -08:00
Brandon Schlinker
925472bdfc Store weak_ptr to SocketObserverContainer in ConnectionStateBase
Summary:
This diff changes `QuicConnectionStateBase` so that it stores a `std::weak_ptr<SocketObserverContainer>` instead of a `std::shared_ptr<SocketObserverContainer>`.

- `QuicConnectionStateBase` needs a pointer to the `SocketObserverContainer` so that loss / ACK / other processing logic can access the observer container and send the observers notifications. There may not be a `SocketObserverContainer` if the `QuicTransportBase` implementation does not support it.
- A `SocketObserverContainer` must not outlive the instance of the `QuicTransportBase` implementation that it is associated with. This is because observers are notified that the object being observed has been destroyed when the container is destroyed, and thus if the container outlives the lifetime of the transport, then the observers will think the transport is still alive when it is in fact dead.
- By storing a weak pointer to the `SocketObserverContainer` in the `QuicConnectionStateBase`, we provide access to the observer container without extending its lifetime. In parallel, because it is a managed pointer, we avoid the possibility of dereferencing a stale pointer (e.g., a pointer pointing to an object that has since been destroyed).

Reviewed By: mjoras

Differential Revision: D42856161

fbshipit-source-id: f35558a21fea91ba794adcf9b573dd48a626ea1f
2023-01-30 22:45:59 -08:00
Joseph Beshay
239f2b5b55 Add transport parameter for knob frame support
Summary: Decide if knob frames are supported based upon a transport parameter instead of relying on the QUIC version. This is a cleaner approach, at the cost of an additional transport parameter.

Reviewed By: mjoras

Differential Revision: D42465442

fbshipit-source-id: bfd1d177bdbe198e5eb47e63113410b5738dcede
2023-01-26 12:22:38 -08:00
Joseph Beshay
b801d9b61d Update naming of maxStreamGroupsAdvertized to match that of similar variables
Summary: This is a cosmetic change to make the naming consistent for all the advertised* variables in the transport settings.

Reviewed By: sharmafb

Differential Revision: D42465443

fbshipit-source-id: d570cbb1a2ca017105ac335b8efc404cb73f3c57
2023-01-26 12:22:38 -08:00
Joseph Beshay
a0a319d58b Consolidate stream groups enabled transport parameter into the TransportParameterId enum
Summary: Use TransportParameterId enum as the source of truth for all the parameter ids. This basically moved the stream groups enabled parameter to the enum.

Reviewed By: kvtsoy

Differential Revision: D42465425

fbshipit-source-id: 94f9968326ac61f92587ef380a7288dd8ab38eef
2023-01-17 21:10:12 -08:00
Konstantin Tsoy
9e016a0ec3 Pass max stream group parameter on handshake
Summary:
Pass max stream group parameter on handshake

The parameter conveys max number of stream groups a peer wishes to support. Note that the number/param is exchanged during handshake and currently there is now way to bump it later in connection. We can add something like MAX_STREAM_GROUP frame later.

Reviewed By: mjoras

Differential Revision: D36415454

fbshipit-source-id: 9d1c8fca7efa4adfb67fdeef859c47a3f50a67ef
2022-06-03 15:47:17 -07:00
Brandon Schlinker
744ae1f78e Use folly::ObserverContainer for socket observer [4/x]
Summary:
This diff is part of larger change to switch to using `folly::ObserverContainer` (introduced in D27062840).

This diff:
- Changes `LegacyObserver` to inherit from the new `Observer` class by adding a compatibility layer. This compatibility layer enables existing observers to continue to be supported.
- Changes generation of observer events so that they are routed through `ObserverContainer::invokeInterfaceMethod`
- Temporarily removes some of the reentrancy protection that previously existed, as it was not being applied consistently — some events had reentrancy protection, some did not. This will be reintroduced in the next diff.
- Improves some unit tests for observers during the transition process.

Differential Revision: D35268271

fbshipit-source-id: 5731c8a9aa8da8a2da1dd23d093e5f2e1a692653
2022-04-18 04:19:31 -07:00
Hani Damlaj
00e67c1bf9 mvfst License Header Update
Reviewed By: lnicco

Differential Revision: D33587012

fbshipit-source-id: 972eb440f0156c9c04aa6e8787561b18295c1a97
2022-01-18 13:56:12 -08:00
Luca Niccolini
9d3883e341 do not barf if the peer advertises max_datagram_frame_size=0
Summary: ^

Reviewed By: jbeshay

Differential Revision: D29698252

fbshipit-source-id: 8bf20fb749ba76155bd71899dafc095d9e864bc2
2021-07-14 10:30:37 -07:00
Luca Niccolini
99110ccf83 consider max packet header and datagram frame payload
Summary:
make getDatagramSizeLimit return the maximum datagram payload size that the
peer can accept.
This is currently the most conservative length, considering the maximum length
of a QUIC short header packet and a datagram frame header

Reviewed By: mjoras

Differential Revision: D28784866

fbshipit-source-id: cce8944a77f6f7b2d3535758c3c29ad88382710f
2021-06-13 21:13:19 -07:00
Yang Chi
cc4f57811d Custom crypto factory
Summary:
as title. This also moves a FizzCryptoTestFactory from FizzCryptoFactoryTest to TestUtils so that it can be used in other test code

This change has an unfortunate side-effect that cryptoFactory_ in both client and server will be moved from stack to heap.

Reviewed By: mjoras

Differential Revision: D27264488

fbshipit-source-id: febc307fb02cb136d58fe70bee648d35431acff0
2021-04-27 13:57:51 -07:00
Andres Suarez
05d07cbfd0 Apply clang-format update fixes
Reviewed By: igorsugak

Differential Revision: D25849213

fbshipit-source-id: a2a538230e769b2c328ae3dd0a19dfbfd693fe3b
2021-01-09 15:39:52 -08:00
Yang Chi
72eeeb8a4f QUIC Retry + HappyEyeballs fix on client transport
Summary:
(1) Receiving a valid retry packet is a HappyEyeballs signal. We should
use that to update the happy eyeballs state.

(2) HappyEyeballs state should also be preserved when we undo client connection
state for retry.

Reviewed By: mjoras

Differential Revision: D25728713

fbshipit-source-id: 4ff06879f5a05e6fb4faeb1e9f330e251d3dbcb6
2021-01-04 15:28:19 -08:00
Matt Joras
43a0b7e02d Always update max packet size after 0-rtt.
Summary: This is a temporary hack until we properly implement 0-rtt transport parameter updating. Now after 0-rtt we will use the packet size from the peer as the max packet size, if the can ignore setting is set.

Reviewed By: xttjsn

Differential Revision: D23690019

fbshipit-source-id: b4dbf5702e81e52ccd437e0fa68f4d156c7123be
2020-09-15 08:36:59 -07:00
Matt Joras
b86f136376 Back out "Don't use old max packet size for 0rtt."
Summary: This was in the right spirit, but doesn't work because we don't actually update the transport parameters if 0-rtt was accepted, so this ends up being the packet size in perpetuity.

Reviewed By: lnicco, xttjsn

Differential Revision: D23689185

fbshipit-source-id: c45eca1e388534f07eeafbb2c075e133bac071f8
2020-09-14 15:17:06 -07:00
Matt Joras
36bef91503 Don't use old max packet size for 0rtt.
Summary:
This is a bug, for 0rtt, even if the can ignore flag is set, we shouldn't trust the old max packet size. If it has changed then the peer will fail to decrypt anything.

There are open questions here around the PMTU we use for the handshake/0rtt, but let's just punt on those for now.

Reviewed By: udippant, xttjsn

Differential Revision: D23641082

fbshipit-source-id: aba93713091805e9498ab2c14b24bccf18192c02
2020-09-11 08:14:56 -07:00
Luca Niccolini
be36a04dfe cleanup dead code
Reviewed By: mjoras

Differential Revision: D23413683

fbshipit-source-id: d332ae4f9cba51bf9a27efa856fb1ff1a7ffddea
2020-09-10 22:55:10 -07:00
Xiaoting Tang
2690a07389 Add basic client state machine unit tests
Summary: This adds the Mocks for ClientHandshake and ClientHandshakeFactory. I added a simple test for `updateTransportParamsFromCachedEarlyParams`.

Reviewed By: mjoras

Differential Revision: D23308946

fbshipit-source-id: 6c22412efc6708ad13cd64ade3e9bccc7c80305d
2020-08-25 15:02:06 -07:00