use the logging.Null{Connection}Tracer in integration tests

This commit is contained in:
Marten Seemann 2022-08-27 13:09:34 +03:00
parent c29276ef67
commit cd87a64e1e
3 changed files with 4 additions and 46 deletions

View file

@ -50,7 +50,7 @@ func (c *tokenStore) Pop(key string) *quic.ClientToken {
} }
type versionNegotiationTracer struct { type versionNegotiationTracer struct {
connTracer logging.NullConnectionTracer
loggedVersions bool loggedVersions bool
receivedVersionNegotiation bool receivedVersionNegotiation bool

View file

@ -45,7 +45,7 @@ func countKeyPhases() (sent, received int) {
} }
type keyUpdateConnTracer struct { type keyUpdateConnTracer struct {
connTracer logging.NullConnectionTracer
} }
func (t *keyUpdateConnTracer) SentPacket(hdr *logging.ExtendedHeader, size logging.ByteCount, ack *logging.AckFrame, frames []logging.Frame) { func (t *keyUpdateConnTracer) SentPacket(hdr *logging.ExtendedHeader, size logging.ByteCount, ack *logging.AckFrame, frames []logging.Frame) {

View file

@ -15,7 +15,6 @@ import (
"log" "log"
"math/big" "math/big"
mrand "math/rand" mrand "math/rand"
"net"
"os" "os"
"runtime/pprof" "runtime/pprof"
"strconv" "strconv"
@ -328,6 +327,7 @@ func scaleDuration(d time.Duration) time.Duration {
} }
type tracer struct { type tracer struct {
logging.NullTracer
createNewConnTracer func() logging.ConnectionTracer createNewConnTracer func() logging.ConnectionTracer
} }
@ -340,48 +340,6 @@ func newTracer(c func() logging.ConnectionTracer) logging.Tracer {
func (t *tracer) TracerForConnection(context.Context, logging.Perspective, logging.ConnectionID) logging.ConnectionTracer { func (t *tracer) TracerForConnection(context.Context, logging.Perspective, logging.ConnectionID) logging.ConnectionTracer {
return t.createNewConnTracer() return t.createNewConnTracer()
} }
func (t *tracer) SentPacket(net.Addr, *logging.Header, logging.ByteCount, []logging.Frame) {}
func (t *tracer) DroppedPacket(net.Addr, logging.PacketType, logging.ByteCount, logging.PacketDropReason) {
}
type connTracer struct{}
var _ logging.ConnectionTracer = &connTracer{}
func (t *connTracer) StartedConnection(local, remote net.Addr, srcConnID, destConnID logging.ConnectionID) {
}
func (t *connTracer) NegotiatedVersion(chosen logging.VersionNumber, clientVersions, serverVersions []logging.VersionNumber) {
}
func (t *connTracer) ClosedConnection(error) {}
func (t *connTracer) SentTransportParameters(*logging.TransportParameters) {}
func (t *connTracer) ReceivedTransportParameters(*logging.TransportParameters) {}
func (t *connTracer) RestoredTransportParameters(*logging.TransportParameters) {}
func (t *connTracer) SentPacket(hdr *logging.ExtendedHeader, size logging.ByteCount, ack *logging.AckFrame, frames []logging.Frame) {
}
func (t *connTracer) ReceivedVersionNegotiationPacket(*logging.Header, []logging.VersionNumber) {}
func (t *connTracer) ReceivedRetry(*logging.Header) {}
func (t *connTracer) ReceivedPacket(hdr *logging.ExtendedHeader, size logging.ByteCount, frames []logging.Frame) {
}
func (t *connTracer) BufferedPacket(logging.PacketType) {}
func (t *connTracer) DroppedPacket(logging.PacketType, logging.ByteCount, logging.PacketDropReason) {}
func (t *connTracer) UpdatedMetrics(rttStats *logging.RTTStats, cwnd, bytesInFlight logging.ByteCount, packetsInFlight int) {
}
func (t *connTracer) AcknowledgedPacket(logging.EncryptionLevel, logging.PacketNumber) {}
func (t *connTracer) LostPacket(logging.EncryptionLevel, logging.PacketNumber, logging.PacketLossReason) {
}
func (t *connTracer) UpdatedCongestionState(logging.CongestionState) {}
func (t *connTracer) UpdatedPTOCount(value uint32) {}
func (t *connTracer) UpdatedKeyFromTLS(logging.EncryptionLevel, logging.Perspective) {}
func (t *connTracer) UpdatedKey(generation logging.KeyPhase, remote bool) {}
func (t *connTracer) DroppedEncryptionLevel(logging.EncryptionLevel) {}
func (t *connTracer) DroppedKey(logging.KeyPhase) {}
func (t *connTracer) SetLossTimer(logging.TimerType, logging.EncryptionLevel, time.Time) {}
func (t *connTracer) LossTimerExpired(logging.TimerType, logging.EncryptionLevel) {}
func (t *connTracer) LossTimerCanceled() {}
func (t *connTracer) Debug(string, string) {}
func (t *connTracer) Close() {}
type packet struct { type packet struct {
time time.Time time time.Time
@ -390,7 +348,7 @@ type packet struct {
} }
type packetTracer struct { type packetTracer struct {
connTracer logging.NullConnectionTracer
closed chan struct{} closed chan struct{}
sent, rcvd []packet sent, rcvd []packet
} }