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

Count cumulative # of egress packets for a stream

Summary:
There are situations where application needs to know how many packets were transmitted for a stream on certain byte range. This diff provides *some* level of that information, by adding the `cumulativeTxedPackets` field in `StreamLike`, which stores the number of egress packets that contain new STREAM frame(s) for a stream.

~~To prevent double-counting, I added a fast set of stream ids.~~

Application could rely on other callbacks (e.g. ByteEventCallback or DeliveryCallback) to get notified, and use `getStreamTransportInfo` to get `packetsTxed` for a stream.

Reviewed By: bschlinker, mjoras

Differential Revision: D23361789

fbshipit-source-id: 6624ddcbe9cf62c628f936eda2a39d0fc2781636
This commit is contained in:
Xiaoting Tang
2020-09-01 15:49:10 -07:00
committed by Facebook GitHub Bot
parent 820f102401
commit 3fac7d21f4
7 changed files with 165 additions and 2 deletions

View File

@@ -433,6 +433,10 @@ bool handleStreamWritten(
PacketNumberSpace packetNumberSpace) {
// Handle new data first
if (frameOffset == stream.currentWriteOffset) {
// Count packet. It's based on the assumption that schedluing scheme will
// only writes one STREAM frame for a stream in a packet. If that doesn't
// hold, we need to avoid double-counting.
stream.numPacketsTxWithNewData++;
handleNewStreamDataWritten(
conn, stream, frameLen, frameFin, packetNum, packetNumberSpace);
return true;