reduce calls to Debugf when not debugging to reduce slice allocs

ref #129
This commit is contained in:
Lucas Clemente
2016-06-04 15:13:46 +02:00
parent 0f941214b4
commit 6a46465092
5 changed files with 84 additions and 17 deletions

View File

@@ -198,7 +198,9 @@ func (h *sentPacketHandler) ReceivedAck(ackFrame *frames.AckFrame) error {
timeDelta := time.Now().Sub(h.packetHistory[h.LargestObserved].sendTime)
// TODO: Don't always update RTT
h.rttStats.UpdateRTT(timeDelta, ackFrame.DelayTime, time.Now())
utils.Debugf("\tEstimated RTT: %dms", h.rttStats.SmoothedRTT()/time.Millisecond)
if utils.Debug() {
utils.Debugf("\tEstimated RTT: %dms", h.rttStats.SmoothedRTT()/time.Millisecond)
}
var ackedPackets congestion.PacketVector
var lostPackets congestion.PacketVector