optimize hasOutstandingCryptoPackets in sentPacketHandler

This commit is contained in:
Marten Seemann 2021-07-13 11:56:21 -04:00
parent 746358cf83
commit 6279d6b556

View file

@ -483,14 +483,13 @@ func (h *sentPacketHandler) getPTOTimeAndSpace() (pto time.Time, encLevel protoc
}
func (h *sentPacketHandler) hasOutstandingCryptoPackets() bool {
var hasInitial, hasHandshake bool
if h.initialPackets != nil {
hasInitial = h.initialPackets.history.HasOutstandingPackets()
if h.initialPackets != nil && h.initialPackets.history.HasOutstandingPackets() {
return true
}
if h.handshakePackets != nil {
hasHandshake = h.handshakePackets.history.HasOutstandingPackets()
if h.handshakePackets != nil && h.handshakePackets.history.HasOutstandingPackets() {
return true
}
return hasInitial || hasHandshake
return false
}
func (h *sentPacketHandler) hasOutstandingPackets() bool {