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

167 Commits

Author SHA1 Message Date
Ilango Purushothaman
189d63ad2c Disable Ack Receive Timestamps based on hostname
Summary:
Added the capability to disable Ack receive timestamps based on hostname.
We want to disable timestamps on dynamic content (graph.facebook.com, i.instagram.com etc) to reduce network and resource overhead (thereby saving uplink BW). The hostnames can be specified via a MC. Timestamps should still be enabled for hostnames serving static content (like video, fbcdn...)

We have observed upto 40% more duplicate timestamps being sent on ACKs and ACK packet size has increased by more than 30% on average for such cases. This is a first step in reducing ACK wastage.

(Note: this ignores all push blocking failures!)

Reviewed By: jbeshay

Differential Revision: D48812624

fbshipit-source-id: aa72ec2dcc41ebe9d982364d8d45739e062daddb
2023-09-12 07:47:19 -07:00
Ashkan Nikravesh
4862982004 throttling-detector: create an interface to provide throttling signals to CCAs
Summary: An interface which will be extended by throttling detectors and will provide throttling signal to CCAs. This interface can be set through `QuicSocket` and can be accessed via `QuicConnectionStateBase`.

Reviewed By: silver23arrow, jbeshay

Differential Revision: D47027498

fbshipit-source-id: 6a2b9ee51ca54395e10500dd7c9787968cc281d4
2023-08-30 17:01:06 -07:00
Konstantin Tsoy
9823ea87e2 Add bufAccessor to the client
Summary: Add bufAccessor to the client

Reviewed By: jbeshay, mjoras

Differential Revision: D47649494

fbshipit-source-id: e14049d3556c01a3c61b9264d43e1304d781232d
2023-07-27 17:00:41 -07:00
Christian Clauss
b8396fc119 Fix typos discovered by codespell
Summary:
`codespell --ignore-words-list=arithmetics,atleast,crate,crated,deriver,ect,hel,onl,startin,whats --skip="*.lock"`
* https://pypi.org/project/codespell

X-link: https://github.com/facebookincubator/mvfst/pull/307

Reviewed By: hanidamlaj, lnicco

Differential Revision: D47809078

Pulled By: kvtsoy

fbshipit-source-id: 566557f2389746db541ff265a5dec8d6404b3701
2023-07-26 17:10:41 -07:00
Konstantin Tsoy
73edee8252 Back out "Fix typos discovered by codespell"
Summary:
Original commit changeset: 337824bc37bc

Original Phabricator Diff: D47722462

Reviewed By: jbeshay, terrelln, lnicco

Differential Revision: D47801753

fbshipit-source-id: 795ffcccbc2223608e2a707ec2e5bcc7dd974eb3
2023-07-26 12:49:13 -07:00
Facebook Community Bot
9d89b66485 Re-sync with internal repository 2023-07-25 09:45:22 -07:00
Konstantin Tsoy
49533e4780 Clean up timers interface
Summary: This allows both mvfst mobile/non-mobile to build

Reviewed By: jbeshay

Differential Revision: D47475985

fbshipit-source-id: c341c7e673fe911c29bba3127904b52ff2ba7080
2023-07-19 17:24:38 -07:00
Konstantin Tsoy
08aba67f8b Rename a few headers
Summary:
And add comments to the new events classes.

Old naming:
```
Events.h/cpp
  -> EventsMobile.h/cpp
```

New naming:
```
QuicEventBase.h/cpp
  -> QuicLibevEventBase.h/cpp
```

Reviewed By: hanidamlaj, mjoras

Differential Revision: D47140799

fbshipit-source-id: 6a25e76c454b0f8468d830feb4dfd99c1576c8b8
2023-07-13 18:39:45 -07:00
Konstantin Tsoy
401f72867a Use QuicBackingEventBase instead of folly::EventBase
Summary: Use QuicBackingEventBase instead of folly::EventBase

Reviewed By: mjoras

Differential Revision: D47135548

fbshipit-source-id: c779d66a044bddb61586e2603a7d4bb4e96ac1a0
2023-07-13 18:39:45 -07:00
Konstantin Tsoy
fe12ab7241 Hide direct timer invocations on the event base into the wrapper
Summary: Needed for future libev-based event base impl.

Reviewed By: hanidamlaj

Differential Revision: D46670916

fbshipit-source-id: 55740ed05da9c1f54cc8639ece89d1f21aaff0d3
2023-07-12 17:26:15 -07:00
Konstantin Tsoy
4a0dd1e2a4 QuicAsyncUDPSocketWrapper
Reviewed By: jbeshay

Differential Revision: D46379200

fbshipit-source-id: f6a7c1cf68108872e05e6fd8adb7f00aae22b2ed
2023-07-11 15:21:15 -07:00
Konstantin Tsoy
dccfc706b5 QuicEventBase wrapper
Summary:
Create and use an actual wrapper around folly::EventBase.
Later an interface will be added that the wrapper will be implementing.

Reviewed By: jbeshay

Differential Revision: D45822401

fbshipit-source-id: 3b33f796c31043ec2881b753a9b60943bdf91f1d
2023-06-15 17:12:24 -07:00
Konstantin Tsoy
fdedffa855 QuicEventBase
Summary:
A wrapper for `folly::EventBase` to be used throughout mvfst library.
Right now it's simply a `using QuicEventBase = folly::EventBase` in the new `quic/common/Events.h`, so no functional changes.

The change to the wrapper usage is constrained to QuicTransportBase and the code around for now - basically excluding top level client and server code that is still using `folly::EventBase` directly.

Subsequent changes will introduce a proper wrapper implementation getting rid of `using QuicEventBase = folly::EventBase` in the new class.

Reviewed By: mjoras

Differential Revision: D44757549

fbshipit-source-id: 5a0dd120ec319a474452eaec64a27f660144acdf
2023-05-23 14:16:15 -07:00
Paul Farcasanu
e56d4bd7f6 refactor setStreamPriority to accept Priority struct
Summary:
## Context
Context: see summary for D43854603.

## In this diff
In this diff, make way for easily adding new elements to Priority struct.

Reviewed By: afrind

Differential Revision: D43882907

fbshipit-source-id: f74f6ec41162a970dcd666bfa5192676f968d740
2023-03-28 16:00:38 -07:00
Joseph Beshay
24f00aad4a Allow Packet Processors to specify prewrite requests that apply to each write loop
Summary:
Adds a prewrite function in packet processors that can be used to set PreWrite Reuqests that will apply apply to the next write loop in the QuicSocket.

Currently, the PrewriteRequest only contains a list of cmsgs but it can be expanded when needed.

This replaces the setAdditionalCmsgs callback that was previously passed down directly to AsyncUDPSocket, allowing multiple processors to affect the additionalCmsgs sent to the AsyncUDPSocket.

Reviewed By: bschlinker

Differential Revision: D44233700

fbshipit-source-id: 799357ee5df89b2a526611bd83d0b4a9a13b71d5
2023-03-24 16:14:59 -07:00
Hani Damlaj
01b439f2f2 remove QuicConnectionStateBase::logger references
Summary: - purging references to unused variable

Reviewed By: kvtsoy

Differential Revision: D43857376

fbshipit-source-id: bfd721efb21ba966496c0131fb12d2357f620ed4
2023-03-15 15:58:02 -07:00
Joseph Beshay
58393be7e4 Expose per-write dynamic Cmsgs in QuicTransportBase
Summary: Allow setting the additionalCmsgsFunc in the underlying AsyncUDPSocket

Reviewed By: mjoras, kvtsoy

Differential Revision: D43681325

fbshipit-source-id: 5ebe6c7b81ea2f5f4aa9715deb590736ebd20544
2023-03-07 15:40:46 -08:00
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
b4cb994fd8 Add enableCustomRetransmissionPolicies()
Summary: Add enableCustomRetransmissionPolicies()

Reviewed By: mjoras

Differential Revision: D39658775

fbshipit-source-id: 1413e6a3112e406222df4ce54e6036f518432a82
2023-02-23 21:31:24 -08: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
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
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
Konstantin Tsoy
424ab5c8c1 Remove useless func argument
Summary: Remove useless func argument

Reviewed By: jbeshay

Differential Revision: D42647239

fbshipit-source-id: d27b26391971ca31f8bf727e3648d1a0dbf124be
2023-01-24 14:53:27 -08:00
Brandon Schlinker
5b8e0de5bd Improve transport close handling and observability
Summary:
The current `close` observer event marks when `closeImpl` is called. However, the actual close of the socket may be delayed for some time while the socket drains. I've changed the existing event to `closeStarted` and added a new event `closing` that marks the close of the underlying `AsyncUDPSocket`.

Adding the `closeStarted` event required two other changes which are difficult to separate from this diff:
- When a transport is destroyed, `QuicTransportBase` was calling `closeImpl` and also closing the UDP socket. However, because the `folly::ObserverContainer` used to store observers is maintained in classes that derive from `QuicTransportBase`, the observers are gone by the time the UDP socket is closed in the base class destructor. Thus, the UDP socket should be closed by the derived classes in their respective destructors. This requirement is inline with the existing code: `closeImpl` is called by all derived classes in their destructors. Made this change and added `DCHECK` statements in the `QuicTransportBase` destructor to ensure that derived classes cleanup after themselves.
- Writing tests with draining enabled and disabled required being able to set the transport settings. However, all of the existing `QuicTypedTransportTest` test cases were designed to operate after the connection was accepted (for the server impls) or established (for client impls), and transport settings cannot be updated at this state. Resolving this required adding new test classes in which the accept/connect operation is delayed until requested by the test.

Reviewed By: mjoras

Differential Revision: D39249604

fbshipit-source-id: 0ebf8b719c4d3b01d4f9509cf2b9a4fc72c2e737
2022-09-10 10:39:11 -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
e208ceffdd Implement group streams receiver api in transport
Summary: Implement group streams receiver api in transport

Reviewed By: mjoras

Differential Revision: D36419901

fbshipit-source-id: 98bfefa1a4205fde8764f2e4300f51156667e024
2022-06-06 17:11:39 -07:00
Konstantin Tsoy
ad6a0e9cbb Implement group streams sender api in transport
Summary: Implement group streams api in transport

Reviewed By: mjoras

Differential Revision: D36417214

fbshipit-source-id: dee93807fe061f2abd9c779da9a2cd1df1865c3e
2022-06-03 15:47:17 -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
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
Brandon Schlinker
b243d2bdd8 Number bytes written in packets written event
Summary: Report all bytes written in observer packets written events.

Reviewed By: jbeshay

Differential Revision: D33086404

fbshipit-source-id: 1456cf23a420abd025f047f190cb2b8a9868826e
2022-03-23 08:50:12 -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
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
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
bd6e117a56 Add a helper function to set default error code for close() and
Summary:
Add a helper function to set default error code for close() and
closeNow()

Reviewed By: mjoras

Differential Revision: D34191863

fbshipit-source-id: 8f818f471307ea64ed046ec5e93852566247faa3
2022-02-22 14:24:23 -08:00
Konstantin Tsoy
2e468b5e5d Add new connection end cb option to client/server transport
Summary: Add new connection end cb option to client/server transport

Reviewed By: mjoras

Differential Revision: D34190871

fbshipit-source-id: 375cf95bc8dbe4ab759140cfb4b33b732869953f
2022-02-22 14:24:23 -08:00
Konstantin Tsoy
3b6f2cf2c0 Simplify callback invocation on connection end/error
Summary: Simplify callback invocation on connection end/error

Reviewed By: mjoras

Differential Revision: D34190297

fbshipit-source-id: d0a124d392a96cc7596bf7feb45ec35a7e27dbbf
2022-02-16 09:49:35 -08:00
Konstantin Tsoy
54ce32396c get rid of callbacks indirection layer
Summary: get rid of callbacks indirection layer

Reviewed By: mjoras

Differential Revision: D34189595

fbshipit-source-id: e4a0aba768b17054f06091c12ef66f1a8019885f
2022-02-15 11:45:09 -08:00
Konstantin Tsoy
3872f0dd89 Remove unused function
Summary: Remove unused function

Reviewed By: mjoras

Differential Revision: D34184684

fbshipit-source-id: cd254c64790ad8024484bf91e68db6a47e054ce2
2022-02-15 11:45:09 -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
c051ff1299 AcksProcessedEvent observer event
Summary:
Providers observers with insight into ACKs received. Works for both client and server transport.

Attempts to prevent wasted memory by removing any allocated memory for ACK events if no packets in flight. In tandem, reduces allocs by _not_ removing allocated memory when packets are in flight (as this means more ACK events will occur soon...).

Reviewed By: jbeshay

Differential Revision: D31221280

fbshipit-source-id: 64b73aa74c757ebbfc27bb9c2a047d08dc7a77ca
2021-12-08 08:16:28 -08:00