1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-07 22:46:22 +03:00
Commit Graph

143 Commits

Author SHA1 Message Date
Konstantin Tsoy
aa0fd83223 Implement setStreamGroupRtxPolicy()
Summary: Implement setStreamGroupRtxPolicy()

Reviewed By: mjoras

Differential Revision: D39698378

fbshipit-source-id: c6fc5a9a9ab7f322775565f6df629103b36b2a36
2023-02-23 21:31:24 -08:00
Konstantin Tsoy
b0e3bcea9e Stream groups retransmission policy API
Summary: Stream groups retransmission policy API

Reviewed By: mjoras

Differential Revision: D39405281

fbshipit-source-id: 3edafa8f2c815d72340d5d7a8e8f4cb1fd3996be
2023-02-22 15:02:16 -08:00
Crystal Jin
eedc7d505e Propagate stream loss count up stack for logging
Reviewed By: amirlivneh

Differential Revision:
D42394612

Privacy Context Container: L1071327

fbshipit-source-id: 21e778062c74a5b2830d35d7acdaa4fc66fc052b
2023-02-14 16:43:11 -08:00
Brandon Schlinker
bddc599e62 ConnectionStartTime in TransportInfo
Summary:
Expose the time when the connection started in `QuicSocket::TransportInfo`.

This is imperfect for `QuicClientTransport` right now, as it marks the time when the transport was created — not the time when the connection was started. This is due to how the underlying value is being populated. Will address in a follow up diff.

Differential Revision: D42224019

fbshipit-source-id: c75dc2df10c252d18225df8508445e99ed5d788a
2023-01-05 15:20:44 -08:00
Duc Nguyen
f0455996a0 Set default value for usedZeroRtt in TransportInfo struct
Summary: Set default value to `false` for `usedZeroRtt` in `TransportInfo` struct.

Reviewed By: bschlinker, kvtsoy

Differential Revision: D40502292

fbshipit-source-id: 77a3330ac9ec5a2e879d0a6313719ffa70df5b3f
2022-10-20 20:32:53 -07:00
Matt Joras
bc8d656a8c Refactor SmallVec.h -> SmallCollections.h
Summary: This is to facilitate catching various collection optimizations in a single file.

Reviewed By: kvtsoy

Differential Revision: D40440965

fbshipit-source-id: 96681b4dea5a2387d6e28064d1d48e10fe1bbdca
2022-10-19 15:41:41 -07:00
Sharad Jaiswal (Eng)
520239e723 Add CongestionController::State to TransportInfo and BW info
Summary: Add a struct with `CongestionController::State` (if available) into `TransportInfo`, and expand the state structure to include the congestion controller's current bandwidth estimate (if available).

Reviewed By: bschlinker, mjoras

Differential Revision: D39413012

fbshipit-source-id: 3eb79cdf53cc37e2cf5e3729cf44557e8a0a3a45
2022-09-29 03:15:09 -07:00
Brandon Schlinker
82d7ea9972 Support shared_ptr based observers
Summary: As titled, enables `QuicSocket` to support observers that are managed pointers. The underlying support for this was added to `folly::ObserverContainer` in D35455208.

Differential Revision: D36921806

fbshipit-source-id: 0ed710977d08866ae32ed7231101c6de163aecf3
2022-08-16 09:24:21 -07:00
Hani Damlaj
6208eca47f Synchronously Query Socket For Max Writable
Summary: - adding an API to the QuicSocket to enable users to synchronously query the socket for the maximum amount of data that should be written.

Reviewed By: mjoras

Differential Revision: D37390086

fbshipit-source-id: 5dd64e28b7f841ba3e28a4bc2a79c1b1e5a95047
2022-07-13 12:08:47 -07:00
Ashkan Nikravesh
8419469204 Create a PacketProcessor abstract class
Summary: PacketProcessors process the packets that we send and their corresponding ack and loss events. We store a vector of packet processors inside `QuicConnectionStateBase` and we call `onPacketSent` and `onPacketAck` whenever their corresponding functions in `CongestionController` class are called. The plan is to make `CongestionController` class extend `PacketProcessor`.

Reviewed By: bschlinker

Differential Revision: D36404668

fbshipit-source-id: 52d63a6a74bfa2031131d31047da25a5e2be12aa
2022-07-05 11:09:03 -07:00
Konstantin Tsoy
80b9c6274e Stream groups API
Summary: Add stream groups interface

Reviewed By: mjoras

Differential Revision: D36416440

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

This diff:
- Removes `api/Observer.h` and `api/Observer.cpp`

Differential Revision: D35703421

fbshipit-source-id: 9ab543e341b385d6b44d2b82bd56919cd6d01ffd
2022-04-20 03:36:44 -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
f20eb76865 Use folly::ObserverContainer for socket observer [3/x]
Summary:
This diff is part of larger change to switch to using `folly::ObserverContainer` (introduced in D27062840).

This diff:
- Adds methods to `QuicSocket` to support adding and removing `ObserverContainer` observers. By default, `QuicSocket` implementations will not support observers as `QuicSocket::getSocketObserverContainer` returns `nullptr`, and this will cause `QuicSocket::addObserver` and `QuicSocket::removeObserver` to fail gracefully.
- Adds support in `QuicClientTransport` and `QuicServerTransport` for `ObserverContainer` observers by overriding `getSocketObserverContainer`. Each implementation creates an `ObserverContainer` on construction that is destroyed on destruction.
- Adds the `close` event to the new observer interface and adds corresponding support in `QuicTransportBase`. This allows both the old and new observers to receive the close event. The next diff will do a hard cutover of the rest of the events.

Differential Revision: D35000960

fbshipit-source-id: e75807c97f4385532bf36244591a259aa0a2f4cc
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
Richard Barnes
312f328b07 Fix a syntax error for platform010
Summary:
This diff fixes a syntax error for platform010. The errors fixed look like one of the following:
```
buck-out/v2/gen/fbcode/6dbc4bb1b9a32829/manifold/client/__client_request_controller__/headers/manifold/client/ClientRequestController.h:106:11: error: '~ClientRequestController' overrides a destructor but is not marked 'override' [-Werror,-Wsuggest-destructor-override]
  virtual ~ClientRequestController();
          ^

buck-out/v2/gen/fbcode/6dbc4bb1b9a32829/manifold/util/__lrucache__/headers/manifold/util/MfLruCache.h:187:38: error: use of function '__builtin_alloca' is discouraged; there is no way to check for failure but failure may still occur, resulting in a possibly exploitable security vulnerability [-Werror,-Walloca]
    uint32_t *indices = (uint32_t *) alloca(sizeof(uint32_t) * n);
                                     ^
```

Reviewed By: alyssaverkade

Differential Revision: D35689206

fbshipit-source-id: 7a78e2954e7d56799753b2645ff082dc5428632c
2022-04-16 11:48:29 -07:00
Brandon Schlinker
feb8455dc6 Add RTT with ACK delay removed to TransportInfo
Summary: Make `min(minRTT - ACK delay)` obsered so far over the life of the connection available in `TransportInfo`. In addition, expose the last RTT and last RTT's AckDelay value as well.

Reviewed By: mjoras

Differential Revision: D28385923

fbshipit-source-id: a58000ac8bd9fdc63caa0b636bdb83905cd6b448
2022-03-28 23:26:30 -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
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
2a23bdd9ac New onConnectionEnd() callback
Summary: To combine connection close callbacks with or without errors.

Reviewed By: mjoras

Differential Revision: D34176729

fbshipit-source-id: c57d328b7b6a122e82063ef36c2d2de135d65c7c
2022-02-22 14:24:22 -08:00
Luca Niccolini
63ee419d75 Fix includes
Summary:
```
find quic -name \*.h -o -name \*.cpp | xargs sed -i'' -E "s/#include \"(.*)\"/#include <\1>/"
arc lint -a --paths-cmd 'hg files quic/'
```

Reviewed By: mjoras

Differential Revision: D34199869

fbshipit-source-id: 3633cb8429b86c03ab367211d6a46dbe4fdd5ff2
2022-02-14 23:56:30 -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
Luca Niccolini
3898b5a9d3 QUIC/HTTP3: reset idle timeout on ping
Summary:
Adds a transport callback for ping received.
Uses the callback in the HTTP3 session to reset the timeout
Also now invokes the ping callbacks synchronously to avoid issues during connection shutdown

Reviewed By: mjoras

Differential Revision: D33753068

fbshipit-source-id: 99ac14d0e4b9539f3a20c5c55bb5241351bf1c57
2022-01-26 17:29:53 -08:00
Luca Niccolini
60ad67ffff Back out "QUIC/HTTP3: reset idle timeout on ping"
Summary:
Original commit changeset: d6fcecd22cbd

Original Phabricator Diff: D33101180 (15390c732a)

Reviewed By: afrind, kvtsoy

Differential Revision: D33743341

fbshipit-source-id: 3abf82db83125659a447f1c95330c85f21eed9b6
2022-01-24 08:52:37 -08:00
Luca Niccolini
15390c732a QUIC/HTTP3: reset idle timeout on ping
Summary:
Adds a transport callback for ping received.
Uses the callback in the HTTP3 session to reset the timeout

Reviewed By: mjoras

Differential Revision: D33101180

fbshipit-source-id: d6fcecd22cbd5c311674dd9421c0c54eb04728a0
2022-01-21 16:43:27 -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
Brandon Schlinker
b9419f04b9 Make minRTT an optional in TransportInfo
Summary: `mrtt` in `TransportInfo` currently defaults to max val if it has not been measured yet (start of connection, end of connection that never had any ACKs, etc.). Downstream consumers may not realize this, which leads to a mess. Changes it into an optional.

Reviewed By: mjoras

Differential Revision: D28383235

fbshipit-source-id: 0f103dd880e96ba60b08e0834c4ecbab81dc4221
2021-12-12 17:04:46 -08:00
Brandon Schlinker
d89e8d344e Observer stream events
Summary: Provide observers with visibility into stream events triggered by local and peer (e.g., new stream opened locally or by peer).

Reviewed By: mjoras

Differential Revision: D31886978

fbshipit-source-id: 7556fef0f336bd0f190b4474f1a7b0120aae6ef1
2021-12-03 11:17:14 -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
Konstantin Tsoy
41be39b61b Introduce split callbacks
Summary:
This diff introduces split callbacks to QUIC.
Old: callback:
* `ConnectionCallback`
Two new callbacks:
* `ConnectionSetupCallback`
* `ConnectionStreamsCallback`

For now the idea is that both old and new callbacks will live side by side and mvfst will decide which callbacks scheme to use via the `useSplitConnectionCallbacks` flag supplied on both QUIC client and server creation.

Reviewed By: mjoras

Differential Revision: D30407129

fbshipit-source-id: 7b726c2652ebe00b47f44bf291cffb9d9f6c884b
2021-09-11 17:38:51 -07:00
Konstantin Tsoy
3bae4b797d Expose usedZeroRtt to transport info
Summary: Expose usedZeroRtt to transport info

Reviewed By: mjoras

Differential Revision: D29863937

fbshipit-source-id: 9b42e654fda89f5a383023f0c4187cd1457adfea
2021-07-24 14:25:42 -07:00
Joseph Beshay
9d01dd7ef7 Add a new API to set MAX_PACING_RATE on a QuicSocket
Summary:
Add a new QuicSocket API that sets the maximum pacing rate in Bytes per second to be used if pacing is enabled. This setting is passed down to the Pacer which enforces it.

The change also includes:
- Refactoring the setPacingRate function of the Pacer to make it more consistent with the other refreshPacingRate function.
- A new flag for testing the MAX_PACING_RATE using tperf.

Reviewed By: mjoras

Differential Revision: D29276789

fbshipit-source-id: 818d86707084b2697f7417b4a47e62cbbce65c73
2021-06-30 13:46:59 -07:00
Alan Frindell
4afac7446c DeliveryCallback -> ByteEventCallback in all QuicSocket APIs
Summary: DeliveryCallback is a ByteEventCallback, so callers shouldn't need to change.

Reviewed By: bschlinker, mjoras

Differential Revision: D28562237

fbshipit-source-id: d7d41bbc3cbc708f7ecda5086fcba46b6a7847b0
2021-05-24 15:05:49 -07:00
Luca Niccolini
f778cfb945 Quic Socket: Datagram APIs
Summary: quic socket API to send and receive datagrams

Reviewed By: mjoras, yangchi

Differential Revision: D20983884

fbshipit-source-id: 70332c5fb9c37c88150fc2f623521e7b0c991eae
2021-05-11 08:24:03 -07:00
Brandon Schlinker
5590b9f573 Track stream bytes written
Summary:
Track the number of stream bytes written to the wire and expose in `quic::TransportInfo`.

Implemented as two counters:
- `totalStreamBytesSent` is a count of all stream bytes written to the wire; the sum of the lengths of stream frames in all packets sent
- `totalNewStreamBytesSent` is a count of all *new* stream bytes written to the wire -- a stream byte is new if it has not been transmitted before; the sum of the lengths of stream frames that have never been transmitted before in all packets sent

We can derive the total number of stream bytes retransmitted as `totalStreamBytesSent - totalNewStreamBytesSent`. We may want to deprecate the existing `totalBytesRetransmitted` counter because the name of that counter does not make it clear that it is stream bytes, and because only includes some types of retransmissions.

While `totalNewStreamBytesSent` is already captured as `flowControlState.sumCurWriteOffset`, I am not reusing that counter here to avoid having a dependency on the information we track for flow control, and to allow all relevant information to be captured in `LossState` (where other relevant fields already exist).

Reviewed By: yangchi

Differential Revision: D28061085

fbshipit-source-id: 73486a4ba3fc8f12959f68702dc58e61fdc21b65
2021-05-04 23:24:06 -07:00
Yang Chi
aa59f9ef32 QuicSocket::setDSRPacketizationRequestSender API
Summary:
This assigns a DSRPacketizationRequestSender to a QUIC stream, and let
it own it.

Reviewed By: mjoras

Differential Revision: D27668523

fbshipit-source-id: 4beba6ddf247801368c3e1c24a0a4956490d45cd
2021-04-20 20:09:10 -07:00
Jason Jiang
3ea632ee61 Add peekError into PeekCallback
Summary:
This diff adds error callback API during the time PeekCallback() is applied, following D9724616, D988728, D15312250, design doc https://fb.quip.com/8P9WAaF43VOn

The peekError() API implementation is added into unidirectional stream dispatcher, class HQUnidirStreamDispatcher.

Reviewed By: mjoras

Differential Revision: D27514260

fbshipit-source-id: b65cc0e46a5d520f46f9dc218c9a65be99e6df55
2021-04-09 09:46:59 -07:00
Sridhar Srinivasan
ac468ad891 Use ByteEvent as a key in maps and sets
Summary:
This commit demonstrates the use of ByteEvents in maps. Intentionally didn't define the custom comparator and hash function inside the quic library because we want consumers of ByteEvents to define equality of 2 ByteEvents in their own way.
This will help recipients of ByteEventCallback keep track of pending,
received and cancelled ByteEvents easily.

In addition, the behavior of registerByteEventCallback was modified to NOT allow duplicate registrations. A pair of registrations is considered duplicate if they both have the same stream ID, stream offset, ByteEvent type and recipient callback pointer. In such cases, registerByteEventCallback returns an INVALID_OPERATION error.
This is critical to make sure that ByteEvents work well in maps, which may be used by recipients.

Reviewed By: bschlinker

Differential Revision: D27100623

fbshipit-source-id: 084a4765fa6c98fdc1b98414fbd30582cf1e5139
2021-03-30 19:52:19 -07:00
Sridhar Srinivasan
f7a08066ce Track body bytes sent and acked
Summary:
Previously, we maintained state and counters to count both, header and body
bytes together. This commit introduces additional counters and state to keep
track of just the body bytes that were sent and acked etc. Body bytes received
will be implemented later.

Reviewed By: bschlinker

Differential Revision: D27312049

fbshipit-source-id: 33f169c9168dfda625e86de45df7c00d1897ba7e
2021-03-29 16:58:04 -07:00
Sridhar Srinivasan
0ddb6e77b5 add onByteEventRegistered callback
Summary:
Add an onByteEventRegistered callback that will be invoked when the
registration for a ByteEvent callback is successful.
This makes it easy for recipients of the callback to track the successful
registration AND callback recipt in a single place (the recipient class). For
example, if all successfully registered ByteEvents have been received, the
recipient can destroy itself safely, knowing that no more ByteEvents will be
sent to it.

Reviewed By: bschlinker

Differential Revision: D27100624

fbshipit-source-id: dbfeff1f4cf2367587fdb73cbd334165b3b159de
2021-03-18 18:13:42 -07:00
Sridhar Srinivasan
d2f005dc00 Add support for detecting start and stop of app rate limited scenarios
Summary:
Previously, we only had support for notifying observers when a QUIC socket
became application rate limited.

This change adds a similar notification when a socket does not become
application rate limited, i.e when the application *starts* writing data to the
socket - either for the first time on a newly established socket or after a
previous block of writes were written and the app had no more to write.
In addition, we include the number of outstanding packets (only those that are
carrying app data in them) so that observers can use this data to timestamp the
start and end of periods where the socket performs app data writes.

Reviewed By: yangchi

Differential Revision: D26559598

fbshipit-source-id: 0a8df7082b83e2ffad9b5addceca29cc03897243
2021-03-10 13:05:10 -08:00
Yang Chi
adc1e15eff Write a buffer's meta data into QUIC
Summary:
Instead of writing real data into the transport, we want to support a
use case where only its metadata is written to the transport. Sending of the
real data is delegated to another entity in such setup.

Reviewed By: mjoras

Differential Revision: D26131772

fbshipit-source-id: 4fcfa3a1626203f63c61898e6de089a3079d043d
2021-03-03 23:50:02 -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
Yang Chi
0b42e07216 Getter API of Quic stream priority
Summary: as title

Reviewed By: afrind, avasylev

Differential Revision: D26744365

fbshipit-source-id: 5c5d104ca76c77f14371c20d6f791fca8d7cfe38
2021-03-03 07:26:28 -08:00
Andrii Vasylevskyi
ba71671bb2 QuicConnectionStats for client socket
Summary: Adding QuiConnectionStats to client transport. Moving getConnectionsStats() logic from server worker into transport base class.

Reviewed By: lnicco

Differential Revision: D26316635

fbshipit-source-id: a384eee5d1bc7b23d908e0b03fafcc4ee962b0b9
2021-02-19 10:47:02 -08:00
Matt Joras
f29e003ee4 Introduce resetNonControlStreams
Summary: This function is useful for when an application wants to explicitly reset all its non-control streams in one go.

Reviewed By: yangchi

Differential Revision: D26490209

fbshipit-source-id: 747449938e4dcd58bee028835f34776e5314cdf9
2021-02-18 14:07:20 -08:00
Yang Chi
7c23fc75cc remove the unsupported cork param from QUIC writeChain interface
Summary: this param is passed to transport then ignored

Reviewed By: avasylev

Differential Revision: D26133327

fbshipit-source-id: 459dd0132185513215ba034f213d4137d7b56ba1
2021-01-29 10:50:45 -08:00