From fdc17127b09f618e7f567cccb3d21c4c8682e16e Mon Sep 17 00:00:00 2001 From: xtaci Date: Tue, 6 Sep 2016 16:46:31 +0800 Subject: [PATCH] metalinter --- crypt.go | 4 +--- kcp.go | 16 +++++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crypt.go b/crypt.go index 6b24d826..df85278f 100644 --- a/crypt.go +++ b/crypt.go @@ -256,9 +256,7 @@ func (c *SimpleXORBlockCrypt) Encrypt(dst, src []byte) { xorBytes(dst, src, c.xo func (c *SimpleXORBlockCrypt) Decrypt(dst, src []byte) { xorBytes(dst, src, c.xortbl) } // NoneBlockCrypt simple returns the plaintext -type NoneBlockCrypt struct { - xortbl []byte -} +type NoneBlockCrypt struct{} // NewNoneBlockCrypt initate by the given key func NewNoneBlockCrypt(key []byte) (BlockCrypt, error) { diff --git a/kcp.go b/kcp.go index 52c52881..78ccf263 100644 --- a/kcp.go +++ b/kcp.go @@ -134,7 +134,7 @@ func NewSegment(size int) *Segment { type KCP struct { conv, mtu, mss, state uint32 snd_una, snd_nxt, rcv_nxt uint32 - ts_recent, ts_lastack, ssthresh uint32 + ssthresh uint32 rx_rttval, rx_srtt, rx_rto, rx_minrto uint32 snd_wnd, rcv_wnd, rmt_wnd, cwnd, probe uint32 current, interval, ts_flush, xmit uint32 @@ -142,6 +142,9 @@ type KCP struct { ts_probe, probe_wait uint32 dead_link, incr uint32 + fastresend int32 + nocwnd, stream int32 + snd_queue []Segment rcv_queue []Segment snd_buf []Segment @@ -149,18 +152,17 @@ type KCP struct { acklist ACKList - buffer []byte - fastresend int32 - nocwnd, stream int32 - logmask int32 - output Output + buffer []byte + output Output } +// ACK packet to return type ACK struct { sn uint32 ts uint32 } +// ACKList is heapified type ACKList []ACK func (l ACKList) Len() int { return len(l) } @@ -348,7 +350,7 @@ func (kcp *KCP) Send(buffer []byte) int { // https://tools.ietf.org/html/rfc6298 func (kcp *KCP) update_ack(rtt int32) { - var rto uint32 = 0 + var rto uint32 if kcp.rx_srtt == 0 { kcp.rx_srtt = uint32(rtt) kcp.rx_rttval = uint32(rtt) / 2