mirror of
https://github.com/xtaci/kcp-go.git
synced 2024-04-21 12:32:15 +00:00
rename typeFEC->typeParity
This commit is contained in:
@@ -11,7 +11,7 @@ const (
|
||||
fecHeaderSize = 6
|
||||
fecHeaderSizePlus2 = fecHeaderSize + 2 // plus 2B data size
|
||||
typeData = 0xf1
|
||||
typeFEC = 0xf2
|
||||
typeParity = 0xf2
|
||||
)
|
||||
|
||||
// fecPacket is a decoded FEC packet
|
||||
@@ -298,7 +298,7 @@ func (enc *fecEncoder) markData(data []byte) {
|
||||
|
||||
func (enc *fecEncoder) markParity(data []byte) {
|
||||
binary.LittleEndian.PutUint32(data, enc.next)
|
||||
binary.LittleEndian.PutUint16(data[4:], typeFEC)
|
||||
binary.LittleEndian.PutUint16(data[4:], typeParity)
|
||||
// sequence wrap will only happen at parity shard
|
||||
enc.next = (enc.next + 1) % enc.paws
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ func BenchmarkFECDecode(b *testing.B) {
|
||||
pkt := make([]byte, payLoad)
|
||||
binary.LittleEndian.PutUint32(pkt, uint32(i))
|
||||
if i%(dataSize+paritySize) >= dataSize {
|
||||
binary.LittleEndian.PutUint16(pkt[4:], typeFEC)
|
||||
binary.LittleEndian.PutUint16(pkt[4:], typeParity)
|
||||
} else {
|
||||
binary.LittleEndian.PutUint16(pkt[4:], typeData)
|
||||
}
|
||||
|
||||
@@ -554,8 +554,8 @@ func (s *UDPSession) kcpInput(data []byte) {
|
||||
if s.fecDecoder != nil {
|
||||
if len(data) > fecHeaderSize { // must be larger than fec header size
|
||||
f := fecPacket(data)
|
||||
if f.flag() == typeData || f.flag() == typeFEC { // header check
|
||||
if f.flag() == typeFEC {
|
||||
if f.flag() == typeData || f.flag() == typeParity { // header check
|
||||
if f.flag() == typeParity {
|
||||
fecParityShards++
|
||||
}
|
||||
recovers := s.fecDecoder.decode(f)
|
||||
|
||||
Reference in New Issue
Block a user