mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
introduce separate tracing calls for sent long and short header packets
This commit is contained in:
parent
9e5f92b561
commit
24be84cd00
14 changed files with 127 additions and 61 deletions
|
@ -16,16 +16,13 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
sentHeaders []*logging.ExtendedHeader
|
||||
sentHeaders []*logging.ShortHeader
|
||||
receivedHeaders []*logging.ShortHeader
|
||||
)
|
||||
|
||||
func countKeyPhases() (sent, received int) {
|
||||
lastKeyPhase := protocol.KeyPhaseOne
|
||||
for _, hdr := range sentHeaders {
|
||||
if hdr.IsLongHeader {
|
||||
continue
|
||||
}
|
||||
if hdr.KeyPhase != lastKeyPhase {
|
||||
sent++
|
||||
lastKeyPhase = hdr.KeyPhase
|
||||
|
@ -45,7 +42,7 @@ type keyUpdateConnTracer struct {
|
|||
logging.NullConnectionTracer
|
||||
}
|
||||
|
||||
func (t *keyUpdateConnTracer) SentPacket(hdr *logging.ExtendedHeader, size logging.ByteCount, ack *logging.AckFrame, frames []logging.Frame) {
|
||||
func (t *keyUpdateConnTracer) SentShortHeaderPacket(hdr *logging.ShortHeader, _ logging.ByteCount, _ *logging.AckFrame, _ []logging.Frame) {
|
||||
sentHeaders = append(sentHeaders, hdr)
|
||||
}
|
||||
|
||||
|
|
|
@ -358,9 +358,9 @@ type shortHeaderPacket struct {
|
|||
|
||||
type packetTracer struct {
|
||||
logging.NullConnectionTracer
|
||||
closed chan struct{}
|
||||
rcvdShortHdr []shortHeaderPacket
|
||||
sent, rcvdLongHdr []packet
|
||||
closed chan struct{}
|
||||
sentShortHdr, rcvdShortHdr []shortHeaderPacket
|
||||
rcvdLongHdr []packet
|
||||
}
|
||||
|
||||
func newPacketTracer() *packetTracer {
|
||||
|
@ -375,16 +375,18 @@ func (t *packetTracer) ReceivedShortHeaderPacket(hdr *logging.ShortHeader, _ log
|
|||
t.rcvdShortHdr = append(t.rcvdShortHdr, shortHeaderPacket{time: time.Now(), hdr: hdr, frames: frames})
|
||||
}
|
||||
|
||||
func (t *packetTracer) SentPacket(hdr *logging.ExtendedHeader, _ logging.ByteCount, ack *wire.AckFrame, frames []logging.Frame) {
|
||||
func (t *packetTracer) SentShortHeaderPacket(hdr *logging.ShortHeader, _ logging.ByteCount, ack *wire.AckFrame, frames []logging.Frame) {
|
||||
if ack != nil {
|
||||
frames = append(frames, ack)
|
||||
}
|
||||
t.sent = append(t.sent, packet{time: time.Now(), hdr: hdr, frames: frames})
|
||||
t.sentShortHdr = append(t.sentShortHdr, shortHeaderPacket{time: time.Now(), hdr: hdr, frames: frames})
|
||||
}
|
||||
|
||||
func (t *packetTracer) Close() { close(t.closed) }
|
||||
func (t *packetTracer) getSentPackets() []packet {
|
||||
|
||||
func (t *packetTracer) getSentShortHeaderPackets() []shortHeaderPacket {
|
||||
<-t.closed
|
||||
return t.sent
|
||||
return t.sentShortHdr
|
||||
}
|
||||
|
||||
func (t *packetTracer) getRcvdLongHeaderPackets() []packet {
|
||||
|
|
|
@ -213,7 +213,7 @@ var _ = Describe("Timeout tests", func() {
|
|||
}()
|
||||
Eventually(done, 2*idleTimeout).Should(BeClosed())
|
||||
var lastAckElicitingPacketSentAt time.Time
|
||||
for _, p := range tr.getSentPackets() {
|
||||
for _, p := range tr.getSentShortHeaderPackets() {
|
||||
var hasAckElicitingFrame bool
|
||||
for _, f := range p.frames {
|
||||
if _, ok := f.(*logging.AckFrame); ok {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue