mirror of
https://github.com/xtaci/kcp-go.git
synced 2024-04-21 12:32:15 +00:00
fix spelling
This commit is contained in:
@@ -19,7 +19,7 @@ const (
|
||||
type (
|
||||
// FEC defines forward error correction for packets
|
||||
FEC struct {
|
||||
rx []fecPacket // ordered rx queue
|
||||
rx []fecPacket // ordered receive queue
|
||||
rxlimit int // queue size limit
|
||||
dataShards int
|
||||
parityShards int
|
||||
@@ -73,7 +73,7 @@ func (fec *FEC) decode(data []byte) fecPacket {
|
||||
pkt.seqid = binary.LittleEndian.Uint32(data)
|
||||
pkt.flag = binary.LittleEndian.Uint16(data[4:])
|
||||
pkt.ts = currentMs()
|
||||
// alloc & copy
|
||||
// allocate memory & copy
|
||||
buf := fec.xmitBuf.Get().([]byte)
|
||||
xorBytes(buf, buf, buf)
|
||||
copy(buf, data[6:])
|
||||
@@ -213,7 +213,7 @@ func (fec *FEC) input(pkt fecPacket) (recovered [][]byte) {
|
||||
}
|
||||
}
|
||||
|
||||
// keep rxlen
|
||||
// keep rxlimit
|
||||
if len(fec.rx) > fec.rxlimit {
|
||||
fec.xmitBuf.Put(fec.rx[0].data) // free
|
||||
fec.rx = fec.rx[1:]
|
||||
|
||||
@@ -79,7 +79,7 @@ func newUDPSession(conv uint32, dataShards, parityShards int, l *Listener, conn
|
||||
sess.xmitBuf.New = func() interface{} {
|
||||
return make([]byte, mtuLimit)
|
||||
}
|
||||
// caculate header size
|
||||
// calculate header size
|
||||
if sess.block != nil {
|
||||
sess.headerSize += cryptHeaderSize
|
||||
}
|
||||
@@ -307,7 +307,7 @@ func (s *UDPSession) SetDSCP(tos int) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
if err := ipv4.NewConn(s.conn).SetTOS(tos << 2); err != nil {
|
||||
log.Println("set tos:", err)
|
||||
log.Println("dscp:", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -730,7 +730,7 @@ func ListenWithOptions(laddr string, block BlockCrypt, dataShards, parityShards
|
||||
return make([]byte, mtuLimit)
|
||||
}
|
||||
|
||||
// caculate header size
|
||||
// calculate header size
|
||||
if l.block != nil {
|
||||
l.headerSize += cryptHeaderSize
|
||||
}
|
||||
@@ -742,12 +742,12 @@ func ListenWithOptions(laddr string, block BlockCrypt, dataShards, parityShards
|
||||
return l, nil
|
||||
}
|
||||
|
||||
// Dial connects to the remote address raddr on the network "udp"
|
||||
// Dial connects to the remote address "raddr" on the network "udp"
|
||||
func Dial(raddr string) (*UDPSession, error) {
|
||||
return DialWithOptions(raddr, nil, 10, 3)
|
||||
}
|
||||
|
||||
// DialWithOptions connects to the remote address raddr on the network "udp" with packet encryption
|
||||
// DialWithOptions connects to the remote address "raddr" on the network "udp" with packet encryption
|
||||
func DialWithOptions(raddr string, block BlockCrypt, dataShards, parityShards int) (*UDPSession, error) {
|
||||
udpaddr, err := net.ResolveUDPAddr("udp", raddr)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user