forked from quic-go/quic-go
retransmit lost packets, send StopWaiting frames
This commit is contained in:
@@ -15,3 +15,30 @@ type Packet struct {
|
||||
MissingReports uint8
|
||||
Retransmitted bool // has this Packet ever been retransmitted
|
||||
}
|
||||
|
||||
func (p *Packet) GetStreamFramesForRetransmission() []*frames.StreamFrame {
|
||||
streamFrames := make([]*frames.StreamFrame, 0)
|
||||
for _, frame := range p.Frames {
|
||||
if streamFrame, isStreamFrame := frame.(*frames.StreamFrame); isStreamFrame {
|
||||
streamFrames = append(streamFrames, streamFrame)
|
||||
}
|
||||
}
|
||||
return streamFrames
|
||||
}
|
||||
|
||||
func (p *Packet) GetControlFramesForRetransmission() []frames.Frame {
|
||||
controlFrames := make([]frames.Frame, 0)
|
||||
for _, frame := range p.Frames {
|
||||
// omit ACKs
|
||||
if _, isStreamFrame := frame.(*frames.StreamFrame); isStreamFrame {
|
||||
continue
|
||||
}
|
||||
|
||||
_, isAck := frame.(*frames.AckFrame)
|
||||
_, isStopWaiting := frame.(*frames.StopWaitingFrame)
|
||||
if !isAck && !isStopWaiting {
|
||||
controlFrames = append(controlFrames, frame)
|
||||
}
|
||||
}
|
||||
return controlFrames
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user