forked from quic-go/quic-go
accept NACKs, WINDOW_UPDATEs and BLOCKEDs, but don't handle them yet
This commit is contained in:
@@ -2,6 +2,7 @@ package frames
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/protocol"
|
||||
"github.com/lucas-clemente/quic-go/utils"
|
||||
@@ -36,8 +37,9 @@ func ParseAckFrame(r *bytes.Reader) (*AckFrame, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
hasNACK := false
|
||||
if typeByte&0x20 == 0x20 {
|
||||
panic("NACK ranges not yet implemented.")
|
||||
hasNACK = true
|
||||
}
|
||||
if typeByte&0x10 == 0x10 {
|
||||
panic("truncated ACKs not yet implemented.")
|
||||
@@ -94,11 +96,27 @@ func ParseAckFrame(r *bytes.Reader) (*AckFrame, error) {
|
||||
return nil, err
|
||||
}
|
||||
// Time Since Previous Timestamp
|
||||
_, err := utils.ReadUint16(r)
|
||||
_, err = utils.ReadUint16(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if hasNACK {
|
||||
fmt.Println("NACK not implemented yet!")
|
||||
var numRanges uint8
|
||||
numRanges, err = r.ReadByte()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p := make([]byte, largestObservedLen+1)
|
||||
for i := uint8(0); i < numRanges; i++ {
|
||||
_, err := r.Read(p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return frame, nil
|
||||
}
|
||||
|
||||
14
session.go
14
session.go
@@ -105,9 +105,9 @@ func (s *Session) HandlePacket(addr *net.UDPAddr, publicHeaderBinary []byte, pub
|
||||
err = nil
|
||||
if typeByte&0x80 == 0x80 {
|
||||
err = s.handleStreamFrame(r)
|
||||
} else if typeByte == 0x40 {
|
||||
} else if typeByte&0xca == 0x40 {
|
||||
err = s.handleAckFrame(r)
|
||||
} else if typeByte&0xE0 == 0x20 {
|
||||
} else if typeByte&0xe0 == 0x20 {
|
||||
err = errors.New("unimplemented: CONGESTION_FEEDBACK")
|
||||
} else {
|
||||
switch typeByte {
|
||||
@@ -120,9 +120,15 @@ func (s *Session) HandlePacket(addr *net.UDPAddr, publicHeaderBinary []byte, pub
|
||||
case 0x03:
|
||||
err = errors.New("unimplemented: GOAWAY")
|
||||
case 0x04:
|
||||
err = errors.New("unimplemented: WINDOW_UPDATE")
|
||||
// err = errors.New("unimplemented: WINDOW_UPDATE")
|
||||
fmt.Println("unimplemented: WINDOW_UPDATE")
|
||||
p := make([]byte, 1+4+8)
|
||||
_, err = r.Read(p)
|
||||
case 0x05:
|
||||
err = errors.New("unimplemented: BLOCKED")
|
||||
// err = errors.New("unimplemented: BLOCKED")
|
||||
fmt.Println("unimplemented: BLOCKED")
|
||||
p := make([]byte, 1+4)
|
||||
_, err = r.Read(p)
|
||||
case 0x06:
|
||||
err = s.handleStopWaitingFrame(r, publicHeader)
|
||||
case 0x07:
|
||||
|
||||
Reference in New Issue
Block a user