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

201 Commits

Author SHA1 Message Date
Joseph Beshay
a73eade468 Add more fields to Qlog Transport Summary to track spurious retransmissions
Summary:
Add three new fields to the qlog transport summary to help analyze spurious transmissions and how they are affected by using adaptive loss thresholds.

Sample transport summary with added fields:
```
          "transport_summary",
          {
            "current_conn_flow_control": 1068498609,
            "current_writable_bytes": 106330,
            "dsr_packet_count": 0,
            "final_packet_loss_reordering_threshold": 77,
            "final_packet_loss_time_reordering_threshold_dividend": 29,
            "quic_version": 4207849474,
            "sum_cur_stream_buffer_len": 0,
            "sum_cur_write_offset": 5243215,
            "sum_max_observed_offset": 67,
            "total_bytes_cloned": 0,
            "total_bytes_recvd": 38157,
            "total_bytes_retransmitted": 244982,
            "total_bytes_sent": 5605121,
            "total_crypto_data_recvd": 342,
            "total_crypto_data_written": 1548,
            "total_packets_spuriously_marked_lost": 203,
            "total_stream_bytes_cloned": 0,
            "used_zero_rtt": false
          }
```

Reviewed By: afrind, mjoras

Differential Revision: D33354583

fbshipit-source-id: 55d9880ef02f6914b74c1b6508863bea7807950b
2022-01-07 18:42:12 -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
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
Brandon Schlinker
20c17a882b PacketsWrittenEvent observer event
Summary:
Currently the `packetsWritten` observer event is only triggered when ACK-eliciting packets are written to the network. This change makes it so that the event is triggered even when non ACK-eliciting packets are written. In addition, this change increases the information provided in the observer event to reduce the processing that must be performed by observers.

More specifically, this diff makes the following changes:
- It creates two new structs — `WriteEvent` and `PacketsWrittenEvent` — and makes `PacketsWrittenEvent` and `AppLimitedEvent` inherit from `WriteEvent`, which contains the base set of fields that appear in both derived events. The base set of fields includes `writeCount` and the reference to the list of `OutstandingPackets`.
- A `PacketsWrittenEvent` is generated after each write loop during which packets are written.
  - The `PacketsWrittenEvent` records the total number of packets written (the sum of ACK-eliciting and non ACK-eliciting packets written) and the total number of ACK-eliciting packets written during the last loop. By exposing this information, observers can determine whether there is value in inspecting the list of `OutstandingPackets` before doing so.
  - In the future, I'll extend this event to also report the number of stream bytes written.
- It adopts a new builder pattern for observer events to make it easier to create instances of these structures:
  - We use this approach instead of aggregate initialization (specifically designated initializers via aggregate initialization), because designated initializers (C++20 feature, although supported by some compilers long before) is not yet supported on all platforms for which we need this code to compile.
  - I intend to change the other observer events to use this pattern as the number of arguments in some of their constructors makes them increasingly difficult to deal with.

Reviewed By: mjoras

Differential Revision: D31216724

fbshipit-source-id: 42ceb922d46ab0e0dc356f8726c2d0467a219587
2021-12-03 11:17:14 -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
Brandon Schlinker
523d193944 Only call close() once for QuicSocket::Observers
Summary: As titled. We currently allow `QuicSocket::Observer::close` to be called multiple times. Only call it once.

Reviewed By: lnicco

Differential Revision: D31886995

fbshipit-source-id: 61d959e8575b08c34ef896b87da0cf8ada482144
2021-12-03 11:17:13 -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
Joseph Beshay
fdd43602a4 Fix field order in VLOG message
Summary: Fix wrong order of fields in a VLOG message.

Reviewed By: lnicco

Differential Revision: D32106255

fbshipit-source-id: 50367a5000cb2033ecafaa6ef389971bc88a9a60
2021-11-02 13:37:14 -07:00
Joseph Beshay
ea2af0fe10 Control a connections bandwidth utilization factor in QuicTransportBase (background mode)
Summary:
The StreamManager monitors can now have a reference to a new observer interface QuicStreamPrioritiesObserver. If the reference is set, the observer is notified whenever streams are created, removed, or change priorities

QuicTransportBase implements this observer interface. It uses the event notifications to control a connection's background mode based upon the new background mode parameters: priority level threshold, and target utilization factor. When these parameters are set, and all active streams have a priority lower than the threshold, the connection's congestion controller is set to use only the defined utilization factor of the available bandwidth.

Reviewed By: bschlinker

Differential Revision: D31562505

fbshipit-source-id: 9c74fa834301f745d97e851741b911795f756023
2021-10-22 14:52:29 -07:00
Nikhil Dixit Limaye
e403564b28 Add detailed quic RST_STREAM and CONNECTION_CLOSE ods counters
Summary: Add global counters for QUIC stream reset and connection close

Reviewed By: lnicco

Differential Revision: D30877776

fbshipit-source-id: 4ee7c3f7c3c1cf190f464e74d616e0b5f1539d3a
2021-10-18 17:16:26 -07:00
Alan Frindell
3d19c7a512 Add split connection callbacks to MockQuicSocket
Summary: As in title

Reviewed By: kvtsoy, lnicco

Differential Revision: D31669761

fbshipit-source-id: 412dc3b47f4ceacbb5719295a95e6d3fd8f2cff9
2021-10-18 11:57:36 -07:00
Luca Niccolini
fbae03019c make datagram read and write buf limits configurable
Summary: make datagram read/write bufs configurable via transport settings

Reviewed By: mjoras

Differential Revision: D31562545

fbshipit-source-id: c80c54f1ca412b464d08dd05c7580511f9b6fafc
2021-10-13 12:01:25 -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
4f35477729 Do not call onAppRateLimited() before connection is ready
Summary: Do not call onAppRateLimited() before connection is ready

Reviewed By: bschlinker

Differential Revision: D30563194

fbshipit-source-id: dd8c2da656041f9219a645935b6c4c3c85b27816
2021-08-31 18:27:40 -07:00
Konstantin Tsoy
29e560813b Connection callback indirection object
Summary:
This is another diff preparing mvfst for the new split callbacks.
This change introduces a callback dispatcher. Right now, it simply calls the existing monolithic callback everywhere. In future diffs, this dispatcher will be using the `useSplitCallbacks` flag to decide which callback object to call.

Reviewed By: mjoras

Differential Revision: D30404458

fbshipit-source-id: 5bb919185b845acc3e8ce7c596c0769b541ff69d
2021-08-31 18:27:40 -07:00
Konstantin Tsoy
72ca64176e processConnectionEndError() util func
Summary:
For the split QUIC callbacks, onConnectionError() will be present in both connection setup and normal connection callbacks.

This diff has no functional changes rather just separates the code that will change (in diffs higher up the stack) into a few functions for easiness.

Reviewed By: mjoras, lnicco

Differential Revision: D30400469

fbshipit-source-id: df259f201b74c51704e4284cbf94ad485f80a1ab
2021-08-31 18:27:40 -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
Matt Joras
40cc0ca93e Add DSR packet count to state and qlog.
Summary: It's useful at the end of a connection to know if we tried DSR.

Reviewed By: jbeshay

Differential Revision: D30545282

fbshipit-source-id: bbb2f3408f7a2d5666676c9e2583bf8fd9f18911
2021-08-26 14:06:57 -07:00
Konstantin Tsoy
ee59ae43c6 resetConnectionCallbacks() util function
Summary: In preparation for split callbacks

Reviewed By: mjoras, lnicco

Differential Revision: D30398849

fbshipit-source-id: 684c289283d0b06b5935fc1b8ab2dcbd126ec0ce
2021-08-25 16:15:42 -07:00
Hani Damlaj
bc72dbddcb Refactor Callback Handling
Summary: - Refactor callback handling into individual functions.

Reviewed By: mjoras

Differential Revision: D29919788

fbshipit-source-id: 64eaea4dcac9220fc86a6dbe53dfed3dcfb7cea7
2021-07-27 13:54:31 -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
Matt Joras
003f012cb7 TODO comment cleanup.
Summary:
These are either no longer relevant, are unlikely to be done, or are spculative enough that they don't deserve code space.

Hope here is to make our search for TODOs higher signal.

Reviewed By: lnicco

Differential Revision: D29769792

fbshipit-source-id: 7cfa62cdc15e72d8b7b0cd5dbb5913ea3ca3dc5a
2021-07-20 10:27:32 -07:00
Xintong Hu
02c50615a4 Support setting cmsg per accepted socket
Summary:
For each `QuicServerTransport` created by `QuicServerWorker`, we are able to set the `cmsg`s to be sent whenever there's a write.

With this we can set things like TOS/SO_MARK per connection

Reviewed By: bschlinker

Differential Revision: D29313608

fbshipit-source-id: d60c97f65681086ae1079b6b95beade95158ec59
2021-07-16 13:35:48 -07:00
Matt Joras
07af79fc65 Don't remove stream from readable if the read callback isn't set.
Summary: This probably never made much sense as a policy. The application can reasonably expect to be able to set a read callback after the stream first becomes readable.

Reviewed By: afrind

Differential Revision: D29563483

fbshipit-source-id: 215a6aed130108248a0b4cbc36c02c8da70bf721
2021-07-08 10:30:23 -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
Luca Niccolini
7fa3a9fc8e schedule write to send datagrams
Summary: invoke updateWriteLooper to make sure a datagram can be sent when it's the only thing to send

Reviewed By: mjoras

Differential Revision: D29416414

fbshipit-source-id: 77cbfc655415b589839bc8e642720498b45ceb85
2021-06-28 11:39:55 -07:00
Joseph Beshay
db4121c5f6 Allow receiver to get/set receive window on unidirectional stream
Summary: Remove a check that only allowed getting and setting the receive window on writable streams. This had prevented a receiver from getting/setting the receive window of a unidirectional stream initiated by the peer.

Reviewed By: mjoras

Differential Revision: D29366097

fbshipit-source-id: 3bc5cba826663b3499c19fe26bdd9a070682e533
2021-06-25 14:04:46 -07:00
Luca Niccolini
99110ccf83 consider max packet header and datagram frame payload
Summary:
make getDatagramSizeLimit return the maximum datagram payload size that the
peer can accept.
This is currently the most conservative length, considering the maximum length
of a QUIC short header packet and a datagram frame header

Reviewed By: mjoras

Differential Revision: D28784866

fbshipit-source-id: cce8944a77f6f7b2d3535758c3c29ad88382710f
2021-06-13 21:13:19 -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
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
Andres Suarez
d85b99cf0e Apply clang-format
Reviewed By: igorsugak

Differential Revision: D28477071

fbshipit-source-id: e844e0fad2f5599fd27e0fd113a328031cb63aa7
2021-05-20 21:25:23 -07:00
Brandon Schlinker
040b68c22d Fix removeObserver and removeAcceptObserver
Summary: When multiple observers attached and one is removed, removal code can end up calling `observerDetach` on the wrong observer. Simplified and fixed removal logic and added new tests.

Reviewed By: yangchi

Differential Revision: D27033221

fbshipit-source-id: d200fd2243a678890758b2652b61d16887f073dd
2021-05-13 12:51:21 -07:00
Luca Niccolini
026568e692 max_datagram_frame_size transport setting
Summary:
conditionally enable datagram support and communicate it to the peer via max_datagram_frame_size transport setting

https://quicwg.org/datagram/draft-ietf-quic-datagram.html#name-transport-parameter

Reviewed By: mjoras

Differential Revision: D27385012

fbshipit-source-id: 8c61765b6e044105409b0c638a8d6d16319ca21b
2021-05-11 08:24:03 -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
Yang Chi
38c903ba2f Remove all QUIC_TRACEs
Summary: no longer used

Reviewed By: lnicco

Differential Revision: D28141008

fbshipit-source-id: 870d6574cc1657914a08f1ef5ee581cfef96aad1
2021-05-10 12:46:08 -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
Sridhar Srinivasan
3a4783713a Use separate flags to enable app data sent callbacks
Summary:
Previously we were using a single flag appDataSentEvents to enable 3 callbacks
(startWritingFromAppLimited, packetsWritten and appRateLimited). This commit
creates separate flags to enable each of these callbacks, we have use-cases
where Observers might want only packetsWritten events and not the others.

Also, this commit refactors the logic to deliver these 3 callbacks to all
observers into a separate method so they can be unit tested easily.

Reviewed By: bschlinker

Differential Revision: D27925011

fbshipit-source-id: 7f7436dfc3d50c3abcb8ec121b221d20e30b0c4b
2021-05-02 23:07:47 -07:00
Alan Frindell
5a0451760a error peek callbacks on connection closure
Summary: This was missed when peekError was added

Reviewed By: mjoras, lnicco

Differential Revision: D27973063

fbshipit-source-id: dbf1112a4ce6822401ba5125de853fe922acd85e
2021-04-26 16:45:51 -07:00
Sridhar Srinivasan
967b240bc9 Disallow non-consecutive duplicate byte event registrations
Summary:
As per design, we are not supposed to honor duplicate byte event registrations. Duplicate is defined by a registration for the same <stream ID, stream offset, callback*> tuple twice.
Currently, there is a bug where-in we can register the same byte event a second time *if* there is another byte event for a higher offset that is registered in-between, for the same stream.
Example Sequence that triggers the bug:
1. Registration for Stream ID =10, offset = 50, callback = A. This will be successful.
2. Registration for Stream ID = 10, offset = 55, callback = <doesn't matter>. This will be successful.
3. Registration for Stream ID = 10, offset = 50, callback = A. This is a duplicate of #1. This *should not* be honored, but it was being honored (this was the bug).

This commit fixes the bug, #3 will return INVALID_OPERATION.

Reviewed By: bschlinker, lnicco

Differential Revision: D27946237

fbshipit-source-id: f9751ac90159284f86a285e5e0ebb23b83041d2a
2021-04-26 11:24:42 -07:00
Sridhar Srinivasan
834ea800cb Revert the fix for duplicate byte event registrations
Summary:
Diff D27846813 (98b5e2aa8f) introduced a fix for a corner case in the ByteEventRegistration logic where-in it was possible to register a byte event for the same stream ID, offset and ByteEvent type as long as they were not consecutive registrations. If there was a different byte event registration for the same stream ID in-between, then duplicates were being allowed.
However, that fix causes an unexpected crash in HQSession::dropConnectionSync().

This commit reverts the fix for duplicate byte event registrations until we are able to find the root cause for the crash and come up with a better fix. Note that we are still able to catch duplicate registrations as long as they are consecutive registrations for the same <stream ID, offset, callback>. With this fix reverted, we will not be able to catch non-consecutive duplicate registrations.

Reviewed By: bschlinker

Differential Revision: D27903179

fbshipit-source-id: b4da3128d5ba14fc764e1768fd27982553968997
2021-04-21 02:24:25 -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
Sridhar Srinivasan
98b5e2aa8f Fix bug in registerByteEvent
Summary:
When registerByteEvent is called for a particular stream ID and offset, it is
possible that the byte event has already occurred in the past. In this case, we
schedule a lambda to be executed in the *next* iteration of the event loop, to
deliver the byte event to the callback.

There are 2 bugs in the current implementation of runEvbAsync which executes
the scheduled lambda.
1. It is possible that multiple recipients register for the same byte event on
the same stream ID and offset. If one of the recipients is already delivered
the byte event, then there is a possibility that the lambda can redeliver the
same notification a second time, which is not desirable.

2. There is a race condition where-in between the time the lambda was scheduled to
the time the lambda was excecuted, it is possible that the byte event gets
delivered when we process callbacks on receiving network data. In this
situation, there is a bug in the lambda where-in if there is another byte event
registered for any other offset for the same stream ID (regardless of the
callback), we will falsely deliver the byte event that was requested, resulting
in double delivery of the same byte event.

This commit fixes both bugs by checking that the requested byte event still
exists in the ByteEventDetail deque (comparing the offset as well as callback),
before erasing and delivering it.

Reviewed By: bschlinker

Differential Revision: D27846813

fbshipit-source-id: 099b79af2580fba5561ec33c4be45a8cf84c39e8
2021-04-20 15:22:21 -07:00
Matt Joras
19339ef38f Add quic version to transport summary.
Summary: The kitchen sink must grow. Nice to know when the conn ends what the version was.

Reviewed By: lnicco

Differential Revision: D27868680

fbshipit-source-id: 2770ed2c647d76affbb52597a5a2a6720eabfe66
2021-04-19 17:58:35 -07:00
Matt Joras
98298496a2 Add some more info to transport summary qlog
Summary: Same as before!

Reviewed By: lnicco

Differential Revision: D27785992

fbshipit-source-id: 0160fb1572c8afc3dbbcf1dac50fc73ddbfbad83
2021-04-14 20:05:53 -07:00
Chetan Ambekar
cd754c2499 Revert D27768829: Add some more info to transport summary qlog
Differential Revision:
D27768829 (3ed777d04f)

Original commit changeset: 43cbf88f38ce

fbshipit-source-id: 4c678ebccbb7c9c33b1c7ab9ed98f6bdbc9c7e49
2021-04-14 18:45:06 -07:00
Matt Joras
3ed777d04f Add some more info to transport summary qlog
Summary: Specifically interested in seeing whether 0RTT was used, writable bytes, and conn flow control.

Reviewed By: yangchi

Differential Revision: D27768829

fbshipit-source-id: 43cbf88f38ce56065cad785344dedc279a0af7d1
2021-04-14 18:08:13 -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
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
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