mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 20:57:36 +03:00
move the 0-RTT queue to a separate file
This commit is contained in:
parent
19c6a1b252
commit
feb94286a5
2 changed files with 34 additions and 27 deletions
|
@ -22,33 +22,6 @@ import (
|
||||||
"github.com/lucas-clemente/quic-go/logging"
|
"github.com/lucas-clemente/quic-go/logging"
|
||||||
)
|
)
|
||||||
|
|
||||||
type zeroRTTQueue struct {
|
|
||||||
queue []*receivedPacket
|
|
||||||
retireTimer *time.Timer
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ packetHandler = &zeroRTTQueue{}
|
|
||||||
|
|
||||||
func (h *zeroRTTQueue) handlePacket(p *receivedPacket) {
|
|
||||||
if len(h.queue) < protocol.Max0RTTQueueLen {
|
|
||||||
h.queue = append(h.queue, p)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (h *zeroRTTQueue) shutdown() {}
|
|
||||||
func (h *zeroRTTQueue) destroy(error) {}
|
|
||||||
func (h *zeroRTTQueue) getPerspective() protocol.Perspective { return protocol.PerspectiveClient }
|
|
||||||
func (h *zeroRTTQueue) EnqueueAll(sess packetHandler) {
|
|
||||||
for _, p := range h.queue {
|
|
||||||
sess.handlePacket(p)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *zeroRTTQueue) Clear() {
|
|
||||||
for _, p := range h.queue {
|
|
||||||
p.buffer.Release()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// rawConn is a connection that allow reading of a receivedPacket.
|
// rawConn is a connection that allow reading of a receivedPacket.
|
||||||
type rawConn interface {
|
type rawConn interface {
|
||||||
ReadPacket() (*receivedPacket, error)
|
ReadPacket() (*receivedPacket, error)
|
||||||
|
|
34
zero_rtt_queue.go
Normal file
34
zero_rtt_queue.go
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
package quic
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||||
|
)
|
||||||
|
|
||||||
|
type zeroRTTQueue struct {
|
||||||
|
queue []*receivedPacket
|
||||||
|
retireTimer *time.Timer
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ packetHandler = &zeroRTTQueue{}
|
||||||
|
|
||||||
|
func (h *zeroRTTQueue) handlePacket(p *receivedPacket) {
|
||||||
|
if len(h.queue) < protocol.Max0RTTQueueLen {
|
||||||
|
h.queue = append(h.queue, p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (h *zeroRTTQueue) shutdown() {}
|
||||||
|
func (h *zeroRTTQueue) destroy(error) {}
|
||||||
|
func (h *zeroRTTQueue) getPerspective() protocol.Perspective { return protocol.PerspectiveClient }
|
||||||
|
func (h *zeroRTTQueue) EnqueueAll(sess packetHandler) {
|
||||||
|
for _, p := range h.queue {
|
||||||
|
sess.handlePacket(p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *zeroRTTQueue) Clear() {
|
||||||
|
for _, p := range h.queue {
|
||||||
|
p.buffer.Release()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue