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

193 Commits

Author SHA1 Message Date
Joseph Beshay
c3ea605df1 Store tokens in new token frames as IoBuf and hexlify when including in qlogger
Summary:
As title. This changes the NewTokenFrame (for writing) to hold the toke as an IOBuf instead of a string. This makes it consistent with the read side.

In the same change, the qlogger now hexlifies this buffer when writing the token to the qlog.

Reviewed By: hanidamlaj, mjoras

Differential Revision: D46955172

fbshipit-source-id: 8f5f575ad2f0a4ec3b4c01cb67defa1f4425cd74
2023-06-27 13:12:10 -07:00
Matt Joras
373b9e24ba Only discount full packets from the packet limit.
Summary:
Right now small packets will cause us to subtract from the packet limit during write loops. This is generally okay when using just non-DSR data. For DSR though there is an issue where if we only write a single small packet from the non-DSR path (like an ACK) we will discount it from the amount of packets the DSR path can write.

The existing workaround for this is to only discount the non-DSR path write if the number of bytes written is less than half a packet's worth. This heuristic is incomplete though and doesn't consider the cases like the following:
1. Packet limit is 5
2. Normal path writes 4 packets of size 1232, 1232, 1232, 20.
3. The DSR path only gets one packet.

The reason for this is because the normal path also wrote full packets, but ended with a short packet. The account for this we just have to discount in terms of full packet's written. In the above example, the DSR path would get the chance to write two packets. Thus we would exceed the packet limit by one packet, but it would get us closer to the desired amount of data on the wire.

Reviewed By: kvtsoy

Differential Revision: D46633105

fbshipit-source-id: 00d92499ab73fc746ea5fdb6ff31e10f06b98666
2023-06-13 16:42:05 -07:00
Matt Joras
6ecdb35ade Minimum packets per stream before next() moves forward
Summary:
The idea here is to allow a way to do incremental stream priorities while switching between streams as aggressively.

Achieving this is somewhat tricky. The easiest place to track this is to make it so the iterator in QuicPriorityQueue no-op next() until a counter reaches an increment.

This is especially impacftul for DSR, where round robining per packet is almost pathologically bad both for CPU impact but also spurious losses and low bandwidth estimates.

Thoughts?

(Note: this ignores all push blocking failures!)

Reviewed By: kvtsoy

Differential Revision: D46268308

fbshipit-source-id: cd5b924141365f61f8a3363bc9cb38a62e5c94cf
2023-06-01 14:11:31 -07:00
Matt Joras
96b2c1b37d Control write loop time limit from knob.
Summary:
This has been hardcoded to SRTT/25 for a long time. However, especially when using DSR this might not be the most appropriate since it can start to get close to real world SRTTs.

Control it via a knob, and also add the behavior such that setting it to 0 effectively disables the time limit.

Reviewed By: jbeshay

Differential Revision: D46084438

fbshipit-source-id: 7dc619fdff1bd5c3f8654c4936200e0340ef94f2
2023-05-22 16:15:24 -07:00
Matt Joras
b89882a772 Add TransportSetting and knob for default priority.
Summary: Allows the default stream priority (which also means scheduling policy) to be set via TransportSettings.

Reviewed By: jbeshay, hanidamlaj

Differential Revision: D45881729

fbshipit-source-id: fcb72022cd6eac2f1dafc55173d5a46a72a95dbc
2023-05-18 13:51:53 -07:00
Matt Joras
25e8eb2f4e Randomly write DSR or non DSR first.
Summary:
Due to the fact that store DSR and non DSR streams in separate priority queues, we end up having to make a decision on which to write first.

Longer term we should merge them into a single priority queue, but in the meantime to mitigate potential starvation, randomly flip flop between which we write first in a given write loop.

Reviewed By: jbeshay, shodoco

Differential Revision: D45701230

fbshipit-source-id: 894179e457a4d6f7364767108f9290ff267eb977
2023-05-09 14:27:17 -07:00
Ilango Purushothaman
e1fd9c7880 Create OutstandingPacket wrapper
Summary:
To get reliable packet destruction events, created a `OutstandingPacketWrapper` wrapper that wraps the current `OutstandingPacket` class, so callback functions can be added to the wrapper instead of the underlying object itself.

#### Why do we need this wrapper?

`std::deque::erase` does not guarantee that appropriate object destructors will be called (only that the number of destructions = number of objects erased). This is a real problem as packet destruction events are then no longer reliable (OutstandingPacket object is wrong!). The wrapper class handles this condition by detecting it in the move assignment constructor (called during erase) and calls the appropriate packet destruction callback before packets are moved. If we did the same fix in the old OutstandingPacket, we have to make sure the callback is called before all the fields of OutstandingPacket are moved - this is not scaleable. Hence a wrapper with the underlying object and a destruction callback function.
I also disabled copy construction for OutstandingPacket (otherwise we will get duplicate OnPacketDestroyed callbacks and cannot track packets reliably). Removing packet copies also improves performance. Some code changes (in tests mostly) are mostly in service of this particular change.

Reviewed By: bschlinker

Differential Revision: D43896148

fbshipit-source-id: c295d3c4dba2368aa66f06df5fc82b473a03fb4d
2023-03-15 03:10:18 -07:00
Konstantin Tsoy
377260f704 Remove d6d code
Summary: we're not using it

Reviewed By: mjoras

Differential Revision: D43482344

fbshipit-source-id: 05ac6792848e32e7c1bcf53a2df172852b5def62
2023-02-23 20:11:24 -08:00
Hani Damlaj
d2e3bc36bf peer address changed
Summary: - add stats counter for when we detect peer address has changed

Reviewed By: jbeshay

Differential Revision: D43012530

fbshipit-source-id: 84f026e8094219b62643449002c97cef6e1a59e5
2023-02-06 12:30:13 -08:00
Brandon Schlinker
87d00ece35 Fix dependency loop and improve namings
Summary:
Fixing dependency loop introduced by D37799050 (96abc8160d)

Running `autodeps` yields the following patch:

```
 --- a/xplat/quic/state/TARGETS
+++ b/xplat/quic/state/TARGETS
@@ -43,8 +43,8 @@
     exported_deps = [
         "//folly:random",
         "//quic:constants",
+        "//quic/codec:codec",
         "//quic/codec:types",
-        "//quic/common:circular_deque",
         "//quic/common:interval_set",
     ],
 )
```

If this patch is applied, there is a circular dependency loop between `//quic/codec:codec` and `//quic/state:ack_states` by way of `//quic/codec:types`; this loop was introduced by D37799050 (96abc8160d).

Fixed by separating out headers files and targets. In parallel, renamed structures used for writing ACK frames (which were the reason this loop occurred) to make their role clear.

Differential Revision: D42281359

fbshipit-source-id: 8514c99f3fe72ff1d942d7f303e4a209838c7623
2023-01-05 15:20:44 -08:00
Matt Joras
1275798146 Make the AckState for Initial/Handshake a unique_ptr
Summary:
We don't need to carry these states after the handshake is confirmed, so make them pointers instead. This will facilitate adding a structure to the AckState for tracking duplicate packets.

(Note: this ignores all push blocking failures!)

Reviewed By: hanidamlaj

Differential Revision: D41626895

fbshipit-source-id: d8ac960b3672b9bb9adaaececa53a1203ec801e0
2022-12-20 11:08:43 -08:00
Sharad Jaiswal (Eng)
96abc8160d Codec changes to support ACK_RECEIVE_TIMESTAMPS
Summary: Create a new ACK_RECEIVE_TIMESTAMPS frame, as outlined in https://www.ietf.org/archive/id/draft-smith-quic-receive-ts-00.html#name-ack_receive_timestamps-fram

Reviewed By: mjoras

Differential Revision: D37799050

fbshipit-source-id: 0157c7fa7c4e489bb310f7c9cd6c0c1877e4967f
2022-11-16 13:02:27 -08:00
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
Hani Damlaj
729623ca26 MaxNumMigrationsAllowed Transport Setting
Summary: - add configurable `maxNumMigrationsAllowed` to transport settings

Reviewed By: kvtsoy

Differential Revision: D41137450

fbshipit-source-id: a82c97e0b58c13f5df3c4cd075d3f17702eca009
2022-11-10 16:55:07 -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
Matt Joras
c8f357156e Differentiate ACK_FREQUENCY policy early in connection.
Summary: This changes the experimental behavior of BBR sending ACK_FREQUENCY frames. Now instead of using the static ack eliciting threshold, early in the connection BBR will set the threshold to 2 which has been empirically shown to be a good "initial" value.

Reviewed By: jbeshay

Differential Revision: D40438721

fbshipit-source-id: 184b8025581b6152eea97f9b557b6343d980322d
2022-10-17 17:54:45 -07:00
Hani Damlaj
a3d9e3d650 Enable Skip Ack-Only Initial
Summary: - enable skip ack-only initial feature by default

Reviewed By: mjoras

Differential Revision: D40185260

fbshipit-source-id: 6429c50fe9f6edff9e945f15c0d44cb54aa9e460
2022-10-13 15:48:38 -07:00
Matt Joras
4c2a067ec4 Control ACK_FREQUENCY from BBR
Summary:
This introduces the ability for BBR to control ACK_FREQUENCY. It also introduces a knob which will let us experiment with different policies.

This code makes BBR issue a new ACK_FREQUENCY every round trip. This may be excessive, so BBR will track the last frame sent, and only send a new one if the new value is sufficiently different in terms of milliseconds.

Note that the only dynamic part of the frame currently will be the max ack delay, which is in terms of fractional RTTs. It is not clear yet how we should vary the other parameters dynamically.

Reviewed By: kvtsoy

Differential Revision: D39910417

fbshipit-source-id: 73cfdac40ca52185c33322017a893e5a02ee58e8
2022-09-30 22:42:54 -07:00
Brandon Schlinker
1091aa42f0 QuicServerTransportAfterStartTestBase
Summary:
The `QuicServerTransportTestBase` test fixture accepts the connection before beginning to run any of the test code. However, if a test wants to be able to modify the transport settings, it needs to be able to modify the transport before the connection has been accepted and the transport parameters have been encoded (e.g., before `transportParametersEncoded` is set to true).

This diff adds a `startTransport` function to `QuicServerTransportTestBase` that does the work of accepting the connection, and then adds a new test fixture `QuicServerTransportAfterStartTestBase` — named after similar existing class `QuicClientTransportAfterStartTestBase` — which calls `startTransport` during setup. All tests previously using `QuicServerTransportTestBase` are switched to `QuicServerTransportAfterStartTestBase`.

For clients, we already had `QuicClientTransportAfterStartTestBase`. A `startTransport` function is also added to `QuicClientTransportTestBase` and the same is done. I need to investigate the client side a bit further as we also have a `start` function there, but there are many layers on `QuicClientTransportTestBase` and that will take some time to unwind.

Differential Revision: D39274871

fbshipit-source-id: 6de47d463637d2e93b808de680d52cc8820d9d47
2022-09-07 07:28:49 -07:00
Hani Damlaj
af166b026b Fix updateLargestReceivedPacketNum() For First Packet
Summary:
- change how `updateLargestReceivedPacketNum()` treats first packet from peer
- re-gate skip ack-only initial behind transportSettings for later experimentation

Reviewed By: mjoras

Differential Revision: D38921135

fbshipit-source-id: 1ced6adc2367a696474d0d52ccf46f8a7f4c703d
2022-08-30 20:45:39 -07:00
Hani Damlaj
0ae79027df Issue Conn IDs As Needed
Summary:
- continually issuing new connection ids to peer as old connections ids are retired through RETIRE_CONN_ID frames
- add logic to parse and act on receiving RETIRE_CONN_ID frame

Reviewed By: mjoras

Differential Revision: D38443561

fbshipit-source-id: 82fb679f482fd69c7b3a3385693d2e5575e92703
2022-08-25 17:47:45 -07:00
Joseph Beshay
abee1d8387 Add IMMEDIATE_ACK frame
Summary: Add the new IMMEDIATE_ACK frame from the ack frequency draft.

Reviewed By: mjoras

Differential Revision: D38523438

fbshipit-source-id: 79f4a26160ccf4333fb79897ab4ace2ed262fa01
2022-08-24 11:11:33 -07:00
Hani Damlaj
f14da46a30 Frame Restrictions For 0-RTT Packets
Summary:
From [RFC9000](https://datatracker.ietf.org/doc/html/rfc9000)

```
   Note that it is not possible to send the following frames in 0-RTT
   packets for various reasons: ACK, CRYPTO, HANDSHAKE_DONE, NEW_TOKEN,
   PATH_RESPONSE, and RETIRE_CONNECTION_ID.  A server MAY treat receipt
   of these frames in 0-RTT packets as a connection error of type
   PROTOCOL_VIOLATION.
```

Reviewed By: jbeshay, mjoras

Differential Revision: D38642380

fbshipit-source-id: a1a7167c06fa68037758ce5395c3798479c26b42
2022-08-18 11:20:16 -07:00
Duc Nguyen
efb1923fd0 Handle MAX_PACING_RATE_KNOB_SEQUENCED transport knob
Summary: Handle MAX_PACING_RATE_KNOB_SEQUENCED transport knob with which a client can suggest a limit on the pacing rate used by the server, if it has pacing enabled. This knob also include a sequence number with which the server can use to determine out-of-order frames.

Reviewed By: bschlinker

Differential Revision: D37062350

fbshipit-source-id: 981f0c9df99cf30de6c676784409a43d45f62ff2
2022-06-29 19:01:11 -07:00
Konstantin Tsoy
e67d32b97e Add a test for dropping datagram on the floor after receiving conn close
Summary:
Add a test for dropping datagram on the floor after receiving conn
close

Reviewed By: hanidamlaj

Differential Revision: D37532252

fbshipit-source-id: d98d34a6bf692cf719864fa01120676b63bbbc1d
2022-06-29 14:38:04 -07:00
Duc Nguyen
5831b7d7fe Support both uint64_t and std::string as value in TransportKnobParam
Reviewed By: bschlinker

Differential Revision: D37056877

fbshipit-source-id: de6cee779424d5b4ce7fb741d5a1bedcf3de3736
2022-06-28 12:18:33 -07:00
Duc Nguyen
6902d68265 Handle out-of-order MAX_PACING_RATE_KNOB frames
Reviewed By: bschlinker

Differential Revision: D36956938

fbshipit-source-id: 517b9fa053e8c632fe62580b6cb534dc8e7292e3
2022-06-09 18:24:24 -07:00
Hani Damlaj
22c2dd9a40 NewToken Bypass WritableBytesLimit
Summary: - unit test to verify that the writableBytesLimit is bypassed upon receiving a valid new token

Reviewed By: mjoras

Differential Revision: D36645447

fbshipit-source-id: 2c4163414c1d04f51cd473b07e32fcd78fbe1bda
2022-05-25 10:28:08 -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
747c41c30d Fix Probing Bytes Limit
Summary:
- PTOs should not be subject to congestion control limits
- Quickly recover from PTOs being writableBytesLimited by calling onPTOAlarm() as soon as we become unblocked

Reviewed By: mjoras

Differential Revision: D35480409

fbshipit-source-id: 51500db6fff17a7badefea8bda7f63141e97f746
2022-04-19 00:50:36 -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
Brandon Schlinker
ea056eb960 Use folly::ObserverContainer for socket observer [2/x]
Summary:
This diff is part of larger change to switch to using `folly::ObserverContainer` (introduced in D27062840).

This diff:
- Renames `quic::Observer` to `quic::LegacyObserver`.
- Switches to using `quic::SocketObserverInterface` instead of `quic::Observer` when referencing structures used for the observer interface. For instance, `quic::Observer::WriteEvent` changes to `quic::SocketObserverInterface::WriteEvent`.

Differential Revision: D35000152

fbshipit-source-id: f387231fd58e8e763c3d7ed0a9c6fcec3b2324e2
2022-04-18 04:19:31 -07:00
Hani Damlaj
c8bf098e5d Change Implementation of WritableBytesLimit
Summary: - updating usage of WritableBytesLimit

Reviewed By: mjoras

Differential Revision: D33079816

fbshipit-source-id: 1854f40a7b00526afb2167764aeddf55edb1771f
2022-04-04 16:18:52 -07:00
Hani Damlaj
94cda41d85 FullHandshakeDone Callback
Summary:
```
buck test //quic/server/test:QuicServerTransportTest
```

Reviewed By: mjoras

Differential Revision: D34696930

fbshipit-source-id: df563fc00773df7acb9bea0bb02d26e99c1fb02f
2022-03-11 13:13:00 -08: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
Matt Joras
360c211738 Keepalive timer support
Summary:
This implements a basic keepalive timer at the transport layer.

The basic idea is to leverage the same conditions as the idle timer. The keepalive timer will fire ~15% before the idle timer and trigger a PING frame. This has the effect of keeping the connection open if the PING is acknowledged.

Reviewed By: jbeshay

Differential Revision: D34256174

fbshipit-source-id: a8cee579f5b09bdfa23bcdc7cf4c70de299de3bd
2022-02-24 12:40:01 -08:00
Hani Damlaj
045d1e6e25 Close Transport Upon Receiving Client Initial With Malformed DstCid
Summary: - as title :)

Reviewed By: mjoras

Differential Revision: D34124710

fbshipit-source-id: 3cee590d38abf395a09ca3a1d8632a5c4d8e3b64
2022-02-18 15:24:03 -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
Joseph Beshay
1234cfc6ac Add experimental config for the pacer to use an adjustable burst
Summary:
Add an experimental setting in the TokenlessPacer to use an adjustable burstSize in the to compensate for delays in pacer loop timer with a limit of 5 loop intervals.

This practically restores some concept of tokens in the pacer. This should help with pacer timer delays observed in relatively high BDP links.

To help quantify how often the delays happen, the QuicStats pacer_lagged counter is updated every time the pacer is delayed by more than 10% when the connection is not application limited.

In a test configuration across a 150 Mbps link with 150 ms round-trip delay, the experimental setting achieves ~25% higher bandwidth.

Reviewed By: bschlinker, mjoras

Differential Revision: D33035430

fbshipit-source-id: 4aa02821d609facf6c830647459319d44c6fc3bd
2022-02-11 12:36:54 -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
fec4289d46 Skip Crypto Ack Initial
Summary: - shipping skip crypto ack initial

Reviewed By: mjoras

Differential Revision: D33173043

fbshipit-source-id: 5add8a7355b1e06b8aa28a809fa0f621ff11f027
2022-01-19 17:06:04 -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
Hani Damlaj
58192de447 NewTokenFrame Encoding Fix
Summary:
- Wrap the TokenLength in a QuicInteger
- Validate token written by server equals token parsed by client codec

Reviewed By: mjoras

Differential Revision: D33134186

fbshipit-source-id: fc003979d9bacdb9ab9bb563a300cedd7a99d58a
2022-01-06 11:46:49 -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
Joseph Beshay
cae8a1b705 Add experimental config for CUBIC with better Hystart limits
Summary:
Add experimental CUBIC's hystart delay bounds that ensure CUBIC does exit Hystart too early. Current limits of 2,8 us are too short.

On a 100 Mbps link with 150 ms round-trip delay, this improved CUBIC's throughput from ~14 Mbps to ~80 Mbps.

Reviewed By: mjoras

Differential Revision: D33035403

fbshipit-source-id: bdeb081111f8053bc7fb01002316d991d8bac2e0
2021-12-16 08:42:01 -08:00
Matt Joras
ade5f5f5f8 TransportSetting to enable issuing new tokens.
Summary: As in title.

Reviewed By: hanidamlaj

Differential Revision: D33108786

fbshipit-source-id: 174a4ad9105f8aacc7a58d9a88c6e1979b6e2185
2021-12-14 16:02:16 -08:00
Brandon Schlinker
fa0aa9754e Fix open source build
Summary:
Fixing four issues in open source build.

First, two missing changes to `CMakeLists.cpp` changes
- `handshake/TokenGenerator.cpp`, added in D31673160 (7233c55d29)
- `state/AckEvent.cpp`, added in D31221302 (7a916869ff)

The two two issues are caused by inconsistencies between our build env and open source build env, including gtest versions. We should investigate getting open source gtest on same version.

 ---

**[D31216724 (20c17a882b)] We cannot use lambdas with `testing::ResultOf` for older versions of gtest and/or older compilers.**

```
gmock-matchers.h:2310:29: error: no type named 'result_type' in '(lambda at /data/sandcastle/temp/fbcode_builder_getdeps/shipit/mvfst/quic/api/test/QuicTransportTest.cpp:711:19)'
```

In particular, the `decltype(f(arg))` logic in the following code from gtest is going to fail on the lambda, since a lambda has no type. I believe it would need to be a `declval(decltype(f(arg)))` for the lambda to work.

```
template <typename Functor>
struct CallableTraits {
  typedef Functor StorageType;

  static void CheckIsValid(Functor /* functor */) {}

  template <typename T>
  static auto Invoke(Functor f, const T& arg) -> decltype(f(arg)) {
    return f(arg);
  }
};
```

See this for details: https://stackoverflow.com/questions/4846540/c11-lambda-in-decltype

-----

**[D32772165 (e784fafb10)] `EXPECT_CALL` does not work with the formatting used for older versions of gtest and/or older compilers (again, unclear).**

Specifically
```
EXPECT_CALL(handshakeFinishedCallback, onHandshakeFinished);
```

must instead be

```
EXPECT_CALL(handshakeFinishedCallback, onHandshakeFinished());
```

Reviewed By: kvtsoy

Differential Revision: D33026131

fbshipit-source-id: 886a6165f2e217cadbe479320195abbd4895eb7c
2021-12-12 17:04:46 -08:00