1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-09 10:00:57 +03:00
Commit Graph

91 Commits

Author SHA1 Message Date
Sharad Jaiswal (Eng)
328c78d0e2 Add received packets timestamps to AckState
Summary:
Store timestamps/packet numbers of recently received packets in AckState.

 - The maximum number of packets stored is controlled by kMaxReceivedPktsTimestampsStored.
- The packet number of entries in the deque is guarenteed to increase
   monotonically because an entry is only added for a received packet
  if the packet number is greater than the packet number of the last
  element in the deque (e.g., entries are not added for packets that
  arrive out of order relative to previously received packets).

Reviewed By: bschlinker

Differential Revision: D37799023

fbshipit-source-id: 3b6bf2ba8ea15219a87bbdc2724fe23eebe66b70
2022-11-15 20:14:57 -08:00
Mitch Campbell
1335937f74 converted PacketDropReason to better_enum and moved into QuicConstants.h
Summary: PacketDropReason was converted to a Better_Enum

Reviewed By: jbeshay

Differential Revision: D40350056

fbshipit-source-id: a6af9ccf0fc7c4358a0481de5cca6f69d1beb438
2022-10-18 11:51:44 -07:00
Joseph Beshay
7881351ed1 Perform opportunistic early retransmit of 0-rtt packets on the first PTO rather than on 0-rtt being accepted
Summary: Retransmitting 0-rtt packets when 0-rtt is accepted can retransmit more packets than necessary when ACKs from the peer are delayed.

Reviewed By: mjoras

Differential Revision: D40274224

fbshipit-source-id: f43337c56341cdaa8504eab6d2b9b81d39f66a1f
2022-10-13 07:50:07 -07:00
Joseph Beshay
227236ef85 Differentiate PacketDropReasons
Summary: The existing PacketDropReason values cover many branches in the code making it impossible to isolate the reason for a PARSE_ERROR, INVALID_PACKET, CONNECTION_NOT_FOUND. This change breaks them down into more values that are each used in a single branch.

Reviewed By: mjoras

Differential Revision: D39149490

fbshipit-source-id: 28cbe1ea6c4a06cf55960058edaa48c28ed4d2ef
2022-09-01 15:11:52 -07:00
Matt Joras
e0698a3aaf Fix ackedIntervals accounting.
Summary:
This is a longstanding off by one. When a stream frame is ACKed the largest ACKed offset contained is the stream frame offset + len - 1, unless there's an fin.

(Note: this ignores all push blocking failures!)

Reviewed By: kvtsoy

Differential Revision: D39085665

fbshipit-source-id: cf353c7e72466085a27537d2c95748781f70f79a
2022-09-01 10:53:22 -07:00
Junqi Wang
1a82cd8325 Add experimental QUIC V1 alias version
Reviewed By: kvtsoy

Differential Revision: D34421598

fbshipit-source-id: b0cc2e77e3186be1e9390cd6e8bd30b9f32dc797
2022-08-03 17:26:56 -07:00
Konstantin Tsoy
003c12fb22 Move setCustomTransportParameter() to free functions
Summary: Move setCustomTransportParameter() to free functions

Reviewed By: mjoras

Differential Revision: D36204576

fbshipit-source-id: 513c11852a339d441af9f3fc948679814da98900
2022-05-19 20:01:28 -07:00
Konstantin Tsoy
5656e382e5 Create a reset() util function for outstandings
Summary: Create a reset() util function for outstandings

Reviewed By: jbeshay

Differential Revision: D36148759

fbshipit-source-id: 04473b959ec9024c27afac67aca9937b12d7edd0
2022-05-06 12:59:45 -07:00
Hani Damlaj
fcdcd538a8 Split NewToken and RetryToken Fields
Summary: - usage of these new tokens should not overlap

Reviewed By: mjoras

Differential Revision: D35323558

fbshipit-source-id: c9152cbb7029f64396661ea9091567ef5a75f4dc
2022-04-05 13:11:49 -07:00
Joachim Reiersen
4ce8537ea1 use gmock 1.10 instead of 1.8
Reviewed By: mjoras

Differential Revision: D34688124

fbshipit-source-id: cb5305d58662a3aacf0a06e496dc5a3914a7f436
2022-03-16 13:34:44 -07:00
Luca Niccolini
7127a107fb fix OSS build
Reviewed By: jbeshay

Differential Revision: D34739371

fbshipit-source-id: 9e60ee1c0b664785751b2da1f3b9d9d67386c436
2022-03-08 22:17:19 -08:00
Gilson Takaasi Gil
7f2f302f96 Revert D34351084: Migrate from googletest 1.8 to googletest 1.10
Differential Revision:
D34351084 (715dec85be)

Original commit changeset: 939b3985ab63

Original Phabricator Diff: D34351084 (715dec85be)

fbshipit-source-id: 2fd17e0ccd9d1f1d643f4a372d84cb95f5add1f8
2022-03-03 04:41:46 -08:00
Dimitri Bouche
715dec85be Migrate from googletest 1.8 to googletest 1.10 (#67)
Summary:
X-link: https://github.com/facebookincubator/hsthrift/pull/67

Updating `googletest` from `1.8.0` to `1.10.0`

Reviewed By: mzlee, igorsugak, luciang, meyering, r-barnes

Differential Revision: D34351084

fbshipit-source-id: 939b3985ab63a06b6d511ec8711c2d5863bdfea8
2022-03-03 03:46:03 -08:00
Luca Niccolini
8d3bdbda25 Fix connection close stats callback
Reviewed By: afrind

Differential Revision: D34489976

fbshipit-source-id: ccf2645da524b36ab0fdea2b4bc4d23136838081
2022-02-25 18:43:46 -08:00
Konstantin Tsoy
a70ffbeb29 Rename ConnectionCallbackNew back to ConnectionCallback
Summary: Rename ConnectionCallbackNew back to ConnectionCallback

Reviewed By: mjoras

Differential Revision: D33979956

fbshipit-source-id: 6c133a406c4bf6799838ffc36701267a938cb4a3
2022-02-23 12:57:31 -08:00
Konstantin Tsoy
cecc1ba279 Introduce QuicError struct
Summary: Instead of using std::pair everywhere

Reviewed By: mjoras

Differential Revision: D34146686

fbshipit-source-id: dfe48f43775de868aba06a5b9b5a004e5793bdbb
2022-02-14 16:00:21 -08:00
Elijah Staple
b57802721e Add ReadDatagram struct and update readDatagrams callback
Summary: In order to provide more information about datagrams when we receive them, I'm adding a wrapper around the BufQueue that we currently hold so we can include receiveTimePoint and any other metadata we might want to expose for the Datagram API.

Reviewed By: mjoras

Differential Revision: D33994358

fbshipit-source-id: 805f182cd350908320639bc07eb6f3b7349bbc05
2022-02-10 16:47:06 -08:00
Konstantin Tsoy
dc79176a56 Deprecate old connection callback
Summary: Deprecate old connection callback

Reviewed By: jbeshay, lnicco

Differential Revision: D33695440

fbshipit-source-id: 043baa53b71453b5e2b9f60d890f1adcda7c65b5
2022-02-02 19:03:57 -08:00
Konstantin Tsoy
1ca4c4e66c Move tests to split callbacks
Summary:
Maine change is `MockConnectionCallback` -> `MockConnectionSetupCallback` + `MockConnectionCallbackNew`.
Everything else is changing tests to use the two new classes.

Differential Revision: D33076321

fbshipit-source-id: a938b63ce59f07f549b3e725caad8785348db7ed
2022-02-02 14:03:23 -08: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
Hani Damlaj
2660a288b3 Update Company Name
Summary: - as title

Reviewed By: lnicco

Differential Revision: D33513410

fbshipit-source-id: 282b6f512cf83b9abb7990402661135b658f7bd1
2022-01-13 12:07:48 -08:00
Luca Niccolini
95ff9198dd Fix Datagram Write in case there is no space in the QUIC packet
Summary: When there is not enough space in the QUIC packet to write a datagram frame, we should not dequeue the datagram

Reviewed By: mjoras

Differential Revision: D33109603

fbshipit-source-id: 937a5a0ffe55c7f88e39faf224e7ad06ca599708
2021-12-16 11:45:07 -08:00
Brandon Schlinker
489c0175da Store stream details in AckEvent
Summary:
Adds stream specific details to `AckEvent` for each ACKed packet, including:
- the number of stream frame bytes newly ACKed
- the number of stream frame bytes newly ACKed by a packet containing a retransmission of said frames (meaning that the original packet was lost, or that the packet with the retransmission arrived at the receiver and corresponding ACK arrived at the sender faster (unlikely), or that the receiver ACK including the original packet was lost, and the ACK interval was pruned too quickly)
- the change in the stream delivery offset for each stream triggered by ACK arrival (if any)
- the stream intervals (and more specifically, the stream frames) that were "dupacked" by the ACK of this packet, meaning that ACK of some other packet had already marked those frames / stream bytes as delivered

Information about "dupacked" packets will not be available until processing of ACKs for packets spuriously marked as lost is enabled; this will come in a follow up diff.

Reviewed By: mjoras

Differential Revision: D31915844

fbshipit-source-id: b8056ea1b5f6093b61e5463c6b4c11cd83bd2916
2021-12-12 17:04:46 -08:00
Brandon Schlinker
ef741fe425 QuicTypedTransportTest with initial observer tests
Summary:
Introduces `QuicTypedTransportTest`, a `TYPED_TEST` that will enable us to test various implementations of `QuicTransportBase` with only one set of tests.

Today, we write separate tests in `QuicClientTransportTest` and `QuicServerTransportTest` for the same functionality. Due to this overhead, I've noticed that in some cases we don't have proper test coverage, and this leads to bugs (see the off by one issue with ACK byte events).

`QuicTypedTransportTest` is an effort to fix this by making it easier to write tests that all transports should be able to support. `QuicTypedTransportTestBase`  serves as a shim layer between the test and the specific test transport implementation. In following diffs, I extend the functionality of `QuicTypedTransportTest` further to make it easier to test cases where packets arrive from the remote (peer), including stream and reset packets.

Reviewed By: mjoras

Differential Revision: D32560835

fbshipit-source-id: e08387364f614c37ed2126dbfb91b30230d116a0
2021-12-08 08:16:28 -08:00
Brandon Schlinker
7b40794598 Make QuicClientTransportTest components reusable
Summary: Making it possible to reuse the foundation of `QuicClientTransportTest` elsewhere. Will be building a test that uses `TYPED_TEST` to test against both transports.

Reviewed By: jbeshay

Differential Revision: D31886977

fbshipit-source-id: a9d9a335aaa0c5f5ea6cd2249fe23b35d926b5c9
2021-12-03 11:17:14 -08:00
Luca Niccolini
324d819795 add stats for quic datagram
Summary: Add stats for quic datagrams

Reviewed By: afrind

Differential Revision: D32600300

fbshipit-source-id: 79ebcec5bd090dad16f81237b6b2c0fe4c0f2af6
2021-12-01 00:13:03 -08:00
Konstantin Tsoy
a5fca068ab Remove default implementation of onConnectionSetupError()
Summary: Remove default implementation of onConnectionSetupError()

Reviewed By: mjoras

Differential Revision: D31635751

fbshipit-source-id: 9d286689b75efbf2144c325a808e363c249c0e11
2021-10-15 09:51:45 -07:00
Hani Damlaj
a38a1c7977 QUIC Client 0-RTT With Retry Token Fix
Summary:
## Issue
When we enabled the JK to set QUIC server's rate limit to zero (D30703498), causing it to send retry packets to all incoming client hellos, we found that android clients were crashing (T99705615).

We were able to reproduce the bug with LigerIntegrationTest and HQClient backed by HQServer, causing the clients to hang.

## Fix
- When receiving a retry packet from the server, migrate the outstandings, stream manager, among other required fields to the new connection state.

- QuicStreamManager & QuicStreamState constructors to facilitate migrating to a new connection state.

Reviewed By: kvtsoy

Differential Revision: D31006905

fbshipit-source-id: 0490ceee1bef52b94c91019426d791e212820508
2021-09-23 12:34:37 -07:00
Konstantin Tsoy
21ea1990ab Add a useSplitConnectionCallbacks to mvfst
Summary:
This change just adds a (currently no-op) flag that will be used in diffs up the stack.

The idea here is that I'll add split QUIC connection callback interfaces that will live side by side with existing single monolithic callback for now. We will experiment with split callbacks on small scale to see that there is no regressions and then will phase out the old callback gradually.

This flag is to control which callback(s) to use.

Reviewed By: mjoras

Differential Revision: D30399667

fbshipit-source-id: 8fc4e4a005e93cf6d48a987f49edee33b90dbbf1
2021-08-31 18:27:40 -07:00
Joseph Beshay
719af99fc5 Upgrade QUIC to V1 and HTTP/3 to h3
Summary:
Update QUIC to V1 and HTTP/3 to h3. In order to support interop, hq-interop ALPN has been added too.

This change maintains support for draft-27 and draft-29 implementations.

Reviewed By: mjoras

Differential Revision: D29714556

fbshipit-source-id: 0685928ef4bede0b5511e59572e9c86ccc867320
2021-08-25 10:22:46 -07:00
Jiangnan Cheng
6323677069 create TestClientUtils for TestCertificateVerifier
Summary: Separate `TestCertificateVerifier` from `TestUtils`.

Reviewed By: mjoras

Differential Revision: D29769297

fbshipit-source-id: 531d277c09a5d16d17afdd18cdac5f8bf27e6766
2021-07-22 14:23:49 -07:00
Matt Joras
4c89a07474 Try to fix macOS build.
Summary:
This is Linux specific stuff.

(Note: this ignores all push blocking failures!)

Reviewed By: lnicco

Differential Revision: D29188261

fbshipit-source-id: 711fcf79c1eb2ef78a02945f395c39880f4fa61e
2021-06-17 19:57:43 -07:00
Matt Joras
6c6b8f6980 Optionally early retransmit 0RTT stream data.
Summary:
If some 0RTT packets are lost we will not detect the loss until we get a short header ACK from the server or the loss timeout expires. This could potentially take a long time.

This adds an option which will optionally retransmit any 0RTT data as soon as the handshake is complete.

Reviewed By: lnicco

Differential Revision: D29111647

fbshipit-source-id: 3c1924ce178a01eaa20a94561df82a59733b8b71
2021-06-15 18:22:06 -07:00
Luca Niccolini
4acc7dc355 Implement one Datagram Frame per packet, and discard policy on rx/tx paths
Reviewed By: mjoras

Differential Revision: D28167755

fbshipit-source-id: b589376800742dfe167f1efe193f0fe059b18ab4
2021-06-13 21:13:19 -07:00
Matt Joras
9fedc51857 Don't ignore error message queue for happy eyeballs
Summary: Prior to this any socket level error message would kill the connection. This doesn't make sense when happy eyeballs is ongoing.

Reviewed By: jbeshay

Differential Revision: D28979505

fbshipit-source-id: 29d1a3b3f0db56a073433a04b888241fe7b91767
2021-06-08 17:36:24 -07:00
Matt Joras
6a833aeee2 Trigger happy eyeballs timeout instead of canceling when write to first socket errors.
Summary: Without this we won't actually retransmit the 0RTT data on the second socket until they are declared lost after the handshake is done.

Reviewed By: JunqiWang

Differential Revision: D28942340

fbshipit-source-id: 192c9ca0544bfde9610720ca1b02322709f0e61e
2021-06-08 17:36:24 -07:00
Luca Niccolini
ec9c10f635 handle receiving datagram
Summary:
receive datagrams.
And add some tests

Reviewed By: mjoras

Differential Revision: D26244066

fbshipit-source-id: f794dfce9feb08040afbda84b1c2adf3994a0993
2021-05-04 10:53:00 -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
Matt Joras
dabb1a1bf1 Always set stateless reset token.
Summary:
This is another bandaid around our incorrect not updating of 0-RTT transport parameters on the client. The long term fix requires us to update all the parameters based on the final ones from the server. This will require a bit of a refactor to this area of the code as well.

Until we do that, manually set the stateless reset token so that 0-RTT clients can actually parse server stateless resets.

Reviewed By: yangchi

Differential Revision: D27875279

fbshipit-source-id: 1d08a53f2a9d876635dcd884b6bba316224543dd
2021-04-20 11:03:56 -07:00
Luca Niccolini
37edeba10e never fragment, always turn off PMTU
Reviewed By: mjoras

Differential Revision: D27848618

fbshipit-source-id: 52b207d610703cdae629dc5ccc8e90261fb112e4
2021-04-19 11:13:36 -07:00
Matt Joras
fc4e7a7405 Remove MVFST_D24 from client.
Summary: Keep on server for now but disallow it in code for the client.

Reviewed By: yangchi

Differential Revision: D27726584

fbshipit-source-id: c567d9db82c36b6e60d438d839709f0330b8db50
2021-04-13 10:11:47 -07:00
Matt Joras
d9d2d29af6 Buffer packets on the client when we don't have ciphers.
Summary:
This can happen when we don't get the server handshake data in time, but it is especially bad with 0RTT when it is potentially a full flight of 1RTT data that is dropped while we wait for the handshake PTO.

Note this leverages the existing CipherUnavailable mechanism, but processes them in a much more simple way than the server side. Additionally, only 1-RTT packets need to be buffered.

Reviewed By: yangchi, lnicco

Differential Revision: D27634184

fbshipit-source-id: db5ba0b9f07176d106f709c7a11d83d0fc8281b7
2021-04-08 16:38:53 -07:00
Joseph Beshay
9300daea87 End the connection on receiving packets without frames and report a protocol violation.
Summary:
On receiving a QUIC packet, if the packet has no frames we should end the connection with PROTOCOL_VIOLATION.

This fixes the error reported by h3spec test `/QUIC servers/MUST send PROTOCOL_VIOLATION on no frames [Transport 12.4]/`

This change adds the check right after a packet is successfully parsed for both the client and server.

Reviewed By: mjoras

Differential Revision: D27483874

fbshipit-source-id: 9b648709e6985f151ba0ffc973aa05c28683fbe9
2021-04-06 18:59:01 -07:00
Matt Joras
55e0fa070e Send probes on all spaces take 2.
Summary:
As before we will now aggressively send probes on all spaces with probes available when the PTO timer fires.

This time with more unit tests and some bug fixes.

Reviewed By: yangchi

Differential Revision: D27338523

fbshipit-source-id: 8a9ccb90ed691e996fab4afa2f132c0f99044fbc
2021-04-02 14:59:57 -07:00
Matt Joras
a92a24bdd5 Back out "Send probes for all spaces."
Summary: As in title. There's a bug here somewhere with empty write loops we need to find.

Reviewed By: yangchi

Differential Revision: D27279100

fbshipit-source-id: e1d26fbf8d6df1590d464a6504a8b940b46794e0
2021-03-23 16:10:12 -07:00
Matt Joras
bceb00346b Send probes for all spaces.
Summary:
Previously we would only send probes for the first space which had one available, i.e. Initial before Handshake before AppData. Since we only have one PTO timer this can lead to situations where we perpetually probe with only Initials, which can significantly delay the handshake if we should have probed with Handshakes.

With this diff we will keep the single PTO timer but aggressively write more probes from all spaces if they are available.

Additionally this refactors some counters into EnumArrays

Reviewed By: yangchi

Differential Revision: D27235199

fbshipit-source-id: ef3614a833bf0f02f5806846a1335fa7ac2a4dc8
2021-03-23 12:51:36 -07:00
Frank Cangialosi
b801447eb8 move setTransportStats before setTransportSettings
Summary: This change is needed so that `conn.transportStats` is defined when a new congestion controller is created (so we can update cc_type counters).

Reviewed By: lnicco

Differential Revision: D27156542

fbshipit-source-id: 8dd7613c4ea1f0e70aefc4a135a8c7f1d102fee2
2021-03-22 20:55:08 -07:00
Yang Chi
6594defc7c Merge QUIC new data and loss data scheduler
Summary: they need to be prioritized together

Reviewed By: mjoras

Differential Revision: D26918282

fbshipit-source-id: 061a6135fd7d31280dc4897b00a17371044cee60
2021-03-10 09:37:04 -08:00
Yang Chi
9f066bb6ce Wait QUIC client reset test timeout for another 10s
Summary: 20s sometimes breaks it

Reviewed By: avasylev

Differential Revision: D26819528

fbshipit-source-id: a07067329564c86743bb2e7b8308baf79243dc54
2021-03-05 10:46:18 -08:00
Matt Joras
382c1cdcc6 Remove partial reliability from mvfst.
Summary: As in title.

Reviewed By: yangchi

Differential Revision: D26701886

fbshipit-source-id: c7b36c616200b17fbf697eff4ba0d18695effb45
2021-03-03 15:30:21 -08:00