mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 20:57:36 +03:00
new: uquic
This commit is contained in:
parent
95f3eaaa66
commit
ea40752ca3
25 changed files with 1420 additions and 686 deletions
30
internal/ackhandler/u_sent_packet_handler.go
Normal file
30
internal/ackhandler/u_sent_packet_handler.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package ackhandler
|
||||
|
||||
import "github.com/quic-go/quic-go/internal/protocol"
|
||||
|
||||
type uSentPacketHandler struct {
|
||||
*sentPacketHandler
|
||||
|
||||
initialPacketNumberLength protocol.PacketNumberLen // [UQUIC]
|
||||
}
|
||||
|
||||
func (h *uSentPacketHandler) PeekPacketNumber(encLevel protocol.EncryptionLevel) (protocol.PacketNumber, protocol.PacketNumberLen) {
|
||||
pnSpace := h.getPacketNumberSpace(encLevel)
|
||||
pn := pnSpace.pns.Peek()
|
||||
// See section 17.1 of RFC 9000.
|
||||
|
||||
// [UQUIC] Otherwise it kinda breaks PN length mimicry.
|
||||
if encLevel == protocol.EncryptionInitial && h.initialPacketNumberLength != 0 {
|
||||
return pn, h.initialPacketNumberLength
|
||||
}
|
||||
// [/UQUIC]
|
||||
|
||||
return pn, protocol.GetPacketNumberLengthForHeader(pn, pnSpace.largestAcked)
|
||||
}
|
||||
|
||||
// [UQUIC]
|
||||
func SetInitialPacketNumberLength(h SentPacketHandler, pnLen protocol.PacketNumberLen) {
|
||||
if sph, ok := h.(*uSentPacketHandler); ok {
|
||||
sph.initialPacketNumberLength = pnLen
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue