From 4e719791b514d20335eaf76bfbf8f06e11f130c2 Mon Sep 17 00:00:00 2001 From: xtaci Date: Thu, 30 Jun 2016 12:20:55 +0800 Subject: [PATCH] fix spelling --- fec.go | 6 +++--- sess.go | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fec.go b/fec.go index b8c4693..4a0a53b 100644 --- a/fec.go +++ b/fec.go @@ -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:] diff --git a/sess.go b/sess.go index d6aaadc..b39c7f1 100644 --- a/sess.go +++ b/sess.go @@ -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 {