Summary: The minCwnd should not be overwritten by the initCwnd. This affects Cubic minCwnd only. BBR uses its constants directly.
Reviewed By: mjoras
Differential Revision: D46076172
fbshipit-source-id: 63d0be96334e6ca294cdf89bc7545aaa4b960678
Summary: Classifying loss as `byPto` is confusing because it is not related to Probe Timeouts (PTO). This changes the occurrences of this name in the transport code to `byTimeout`.
Reviewed By: mjoras, kvtsoy
Differential Revision: D45788216
fbshipit-source-id: 9900b928d3f44572a21d6ed7e76be658e21451c7
Summary: This is a dumb shortcut. Just check whether it's happened after reading data and call close that way.
Reviewed By: kvtsoy
Differential Revision: D45205285
fbshipit-source-id: 57edafc50f5e5e9cdaf9ac7e46781b762acd30d8
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
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
Summary: - both `isScheduled()` and `cancelTimeout()` check if wheel_ != nullptr, no need to check twice
Reviewed By: kvtsoy
Differential Revision: D43582809
fbshipit-source-id: aaf535b227ad3c0da97cfc979b5f8a411d891959
Summary: - .reset() is probably fractionally less costly than the assignment operator?
Reviewed By: sharmafb
Differential Revision: D43579041
fbshipit-source-id: 4838b6c21e94197782cf56866950be1dbf65b106
Summary: This change ensures that the stream is not destroyed before onEOM callback so that onEOM can access stream specific data.
Reviewed By: mjoras
Differential Revision: D42784838
fbshipit-source-id: ce619be1a2b6a542a517a7b4f32c2b3d37aa30fd
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
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
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
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
Summary:
Track the total (cumulative) amount of time that the connection has been application limited and store this information in `OutstandingPacketMetadata`. If this value is the same for two `OutstandingPacketMetadata` then we know that the transport did not become application limited between when those two packets were sent (or, less likely, the transport was application limited for less than one microsecond given the microsecond resolution of the timestamp).
We store the amount of time spent application limited instead of a count of the number of application limited events because the implications of being application limited are time dependent.
Tests show that we need to be able to inject a mockable clock. That's been an issue for some time; will work on in a subsequent diff.
Differential Revision: D41714879
fbshipit-source-id: 9fd4fe321d85639dc9fb5c2cd51713c481cbeb22
Summary:
1) unregistering a pending write callback from another callback was unsafe. Follow the paradigm in the rest of this function.
2) Calling closeGracefully() nulls out the connection callback but keeps writing -- need to check that connCb_ is non-null before calling onAppLimited()
Reviewed By: kvtsoy
Differential Revision: D40811191
fbshipit-source-id: fa3512e4aa5ddda3dfc160a044b7d29b7aec8a8a
Summary: - transport settings to enable the following behaviour: invoking stopSending() now drops buffered ingress data and closes the ingress path
Reviewed By: mjoras
Differential Revision: D40678864
fbshipit-source-id: 7dd5c7843909d5ac8cc309292b31d1d87b97a2f5
Summary: - as title, we should just no-op ::StopSending when ingress is already closed
Reviewed By: jbeshay, mjoras
Differential Revision: D40990383
fbshipit-source-id: e0cd64facf78f510eabe8198e93a643c6ebfb89e
Summary:
The normal loss detection only considers the reordering threshold per packet by comparing it with the largest ACKed packet in the ACK. This is largely based on the fact that QUIC packet numbers are monotonically increasing.
However, when using DSR there is a potential for a different host to be writing the packets to the wire. When there are multiple hosts doing this, there is a degree of reordering that is expected to happen.
Thus we can change the loss detection logic to adjust the largest packet ACKed and use the largest packet ACKed for a given DSR stream when the packet is a DSR packet. This allows for the natural reordering while detecting loss within the DSR sender's timeline of sent packets.
Note that this probably doesn't catch all of the nuances that can happen with the reordering, but it is a good start.
Reviewed By: kvtsoy
Differential Revision: D40647572
fbshipit-source-id: d84c6cd8040fb8c044ddd68fb1abc049ccddfc44
Summary: We always use an SRTT/4 ACKing heuristic for the ACK delay. This has generally been a useful heuristic, but when using ACK_FREQUENCY we should defer to using the delay by the peer.
Reviewed By: jbeshay
Differential Revision: D40272530
fbshipit-source-id: c7a44e53233c97d0c96bc6f936a7318cf4676aba
Summary:
This is useful so we can run experiments that turn this feature off while we turn ACK_FREQUENCY policies on.
(Note: this ignores all push blocking failures!)
Reviewed By: yairgott
Differential Revision: D40148536
fbshipit-source-id: 84aa4a0639b43c8721db0db6885b6af6e1701bdd
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
Summary: Often the pointer can be hard to get back because Clang apparently can't produce DWARF symbols.
Reviewed By: kvtsoy
Differential Revision: D39787495
fbshipit-source-id: 81596f35843200e90d4786a70837cdf75cfc9cac
Summary: Ensure stream is not null when the transport is getting it from the StreamManager
Reviewed By: mjoras
Differential Revision: D39753796
fbshipit-source-id: bc2a870a26510267d972bb59758792696c99501d
Summary: This makes the unsetting of the DSR sender explicit. By doing this we can guarantee that a sender, if it has a dependency of the transaction lifetime, will be released before the transaction itself.
Reviewed By: kvtsoy
Differential Revision: D39525914
fbshipit-source-id: 6f0094b1ad1970ed603032469aede9ca1ed9c255
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
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
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
Summary: When there are multiple different DSR senders, there can be a large degree of reordering present. We can partially mitigate this for now by using adaptive reordering thresholds all the time when DSR is on.
Reviewed By: shodoco
Differential Revision: D37400821
fbshipit-source-id: f456e447fd58154d26bd642c22e71457e0d27b7c
Summary: Implement group streams receiver api in transport
Reviewed By: mjoras
Differential Revision: D36419901
fbshipit-source-id: 98bfefa1a4205fde8764f2e4300f51156667e024
Summary: Implement group streams api in transport
Reviewed By: mjoras
Differential Revision: D36417214
fbshipit-source-id: dee93807fe061f2abd9c779da9a2cd1df1865c3e
Summary: Deferring it to the next read causes a bunch of data to go out of cache, which guarantees a cache miss when we try to clear it. Instead, clear it immediately after the callbacks.
Reviewed By: bschlinker
Differential Revision: D36151205
fbshipit-source-id: 467a45e2ef901b5705fb3db38d2648ba97784c8d
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
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