add tracing for sent and received packets

This commit is contained in:
Marten Seemann
2019-04-05 10:55:31 +09:00
parent 8926531f7e
commit 267d11ee66
12 changed files with 314 additions and 0 deletions

View File

@@ -39,6 +39,9 @@ type SentPacketHandler interface {
GetAlarmTimeout() time.Time
OnAlarm() error
// report some congestion statistics. For tracing only.
GetStats() *State
}
// ReceivedPacketHandler handles ACKs needed to send for incoming packets
@@ -50,3 +53,12 @@ type ReceivedPacketHandler interface {
GetAlarmTimeout() time.Time
GetAckFrame(protocol.EncryptionLevel) *wire.AckFrame
}
type State struct {
MinRTT time.Duration
SmoothedRTT time.Duration
LatestRTT time.Duration
BytesInFlight protocol.ByteCount
CongestionWindow protocol.ByteCount
}