2017-12-12 02:51:45 +00:00
|
|
|
package ackhandler
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2018-01-03 19:19:49 +00:00
|
|
|
"github.com/lucas-clemente/quic-go/internal/protocol"
|
|
|
|
"github.com/lucas-clemente/quic-go/internal/wire"
|
2017-12-12 02:51:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// A Packet is a packet
|
|
|
|
// +gen linkedlist
|
|
|
|
type Packet struct {
|
|
|
|
PacketNumber protocol.PacketNumber
|
2018-01-03 19:19:49 +00:00
|
|
|
Frames []wire.Frame
|
2017-12-12 02:51:45 +00:00
|
|
|
Length protocol.ByteCount
|
|
|
|
EncryptionLevel protocol.EncryptionLevel
|
|
|
|
|
2018-01-20 18:07:01 +00:00
|
|
|
largestAcked protocol.PacketNumber // if the packet contains an ACK, the LargestAcked value of that ACK
|
|
|
|
sendTime time.Time
|
2017-12-12 02:51:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetFramesForRetransmission gets all the frames for retransmission
|
2018-01-03 19:19:49 +00:00
|
|
|
func (p *Packet) GetFramesForRetransmission() []wire.Frame {
|
|
|
|
var fs []wire.Frame
|
2017-12-12 02:51:45 +00:00
|
|
|
for _, frame := range p.Frames {
|
|
|
|
switch frame.(type) {
|
2018-01-03 19:19:49 +00:00
|
|
|
case *wire.AckFrame:
|
2017-12-12 02:51:45 +00:00
|
|
|
continue
|
2018-01-03 19:19:49 +00:00
|
|
|
case *wire.StopWaitingFrame:
|
2017-12-12 02:51:45 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
fs = append(fs, frame)
|
|
|
|
}
|
|
|
|
return fs
|
|
|
|
}
|