mirror of
https://github.com/xtaci/kcp-go.git
synced 2026-10-21 08:58:37 +00:00
add loc
This commit is contained in:
@@ -814,12 +814,14 @@ func (l *Listener) packetInput(data []byte, addr net.Addr) {
|
|||||||
convRecovered := false
|
convRecovered := false
|
||||||
fecFlag := binary.LittleEndian.Uint16(data[4:])
|
fecFlag := binary.LittleEndian.Uint16(data[4:])
|
||||||
if fecFlag == typeData || fecFlag == typeParity { // 16bit kcp cmd [81-84] and frg [0-255] will not overlap with FEC type 0x00f1 0x00f2
|
if fecFlag == typeData || fecFlag == typeParity { // 16bit kcp cmd [81-84] and frg [0-255] will not overlap with FEC type 0x00f1 0x00f2
|
||||||
|
// packet with FEC
|
||||||
if fecFlag == typeData && len(data) >= fecHeaderSizePlus2+IKCP_OVERHEAD {
|
if fecFlag == typeData && len(data) >= fecHeaderSizePlus2+IKCP_OVERHEAD {
|
||||||
conv = binary.LittleEndian.Uint32(data[fecHeaderSizePlus2:])
|
conv = binary.LittleEndian.Uint32(data[fecHeaderSizePlus2:])
|
||||||
sn = binary.LittleEndian.Uint32(data[fecHeaderSizePlus2+IKCP_SN_OFFSET:])
|
sn = binary.LittleEndian.Uint32(data[fecHeaderSizePlus2+IKCP_SN_OFFSET:])
|
||||||
convRecovered = true
|
convRecovered = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// packet without FEC
|
||||||
conv = binary.LittleEndian.Uint32(data)
|
conv = binary.LittleEndian.Uint32(data)
|
||||||
sn = binary.LittleEndian.Uint32(data[IKCP_SN_OFFSET:])
|
sn = binary.LittleEndian.Uint32(data[IKCP_SN_OFFSET:])
|
||||||
convRecovered = true
|
convRecovered = true
|
||||||
|
|||||||
Reference in New Issue
Block a user