fix some linter warnings

This commit is contained in:
Lucas Clemente
2016-08-23 12:24:33 +02:00
parent d1d53beaa8
commit 126db938d0
7 changed files with 10 additions and 11 deletions

View File

@@ -159,12 +159,11 @@ func ParseAckFrame(r *bytes.Reader, version protocol.VersionNumber) (*AckFrame,
return nil, ErrInvalidAckRanges
}
var numTimestampByte byte
numTimestampByte, err = r.ReadByte()
var numTimestamp byte
numTimestamp, err = r.ReadByte()
if err != nil {
return nil, err
}
numTimestamp := uint8(numTimestampByte)
if numTimestamp > 0 {
// Delta Largest acked
@@ -309,7 +308,7 @@ func (f *AckFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
gapWritten = 0xFF
}
b.WriteByte(uint8(gapWritten))
b.WriteByte(gapWritten)
switch missingSequenceNumberDeltaLen {
case protocol.PacketNumberLen1:
b.WriteByte(uint8(lengthWritten))
@@ -318,7 +317,7 @@ func (f *AckFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
case protocol.PacketNumberLen4:
utils.WriteUint32(b, uint32(lengthWritten))
case protocol.PacketNumberLen6:
utils.WriteUint48(b, uint64(lengthWritten))
utils.WriteUint48(b, lengthWritten)
}
numRangesWritten++

View File

@@ -129,7 +129,7 @@ func (h *ConnectionParametersManager) GetSHLOMap() map[Tag][]byte {
cfcw := bytes.NewBuffer([]byte{})
utils.WriteUint32(cfcw, uint32(h.GetReceiveConnectionFlowControlWindow()))
mspc := bytes.NewBuffer([]byte{})
utils.WriteUint32(mspc, uint32(h.GetMaxStreamsPerConnection()))
utils.WriteUint32(mspc, h.GetMaxStreamsPerConnection())
icsl := bytes.NewBuffer([]byte{})
utils.WriteUint32(icsl, uint32(h.GetIdleConnectionStateLifetime()/time.Second))

View File

@@ -154,7 +154,7 @@ var _ = Describe("ConnectionsParameterManager", func() {
})
Context("idle connection state lifetime", func() {
It("has initial idle conneciton state lifetime", func() {
It("has initial idle connection state lifetime", func() {
Expect(cpm.GetIdleConnectionStateLifetime()).To(Equal(protocol.InitialIdleConnectionStateLifetime))
})

View File

@@ -39,7 +39,7 @@ func ParseHandshakeMessage(r utils.ReadStream) (Tag, map[Tag][]byte, error) {
var dataStart uint32
for indexPos := 0; indexPos < int(nPairs)*8; indexPos += 8 {
tag := Tag(binary.LittleEndian.Uint32(index[indexPos : indexPos+4]))
dataEnd := uint32(binary.LittleEndian.Uint32(index[indexPos+4 : indexPos+8]))
dataEnd := binary.LittleEndian.Uint32(index[indexPos+4 : indexPos+8])
dataLen := dataEnd - dataStart
if dataLen > protocol.CryptoParameterMaxLength {

View File

@@ -62,5 +62,5 @@ const DefaultRetransmissionTime = 500 * time.Millisecond
// MinRetransmissionTime is the minimum RTO time
const MinRetransmissionTime = 200 * time.Millisecond
// ClientHelloMinimumSize is the minimum size the server expectes an inchoate CHLO to have.
// ClientHelloMinimumSize is the minimum size the server expects an inchoate CHLO to have.
const ClientHelloMinimumSize = 1024

View File

@@ -23,7 +23,7 @@ var (
func (i ErrorCode) String() string {
switch {
case 1 <= i && i <= 14:
i -= 1
i--
return _ErrorCode_name_0[_ErrorCode_index_0[i]:_ErrorCode_index_0[i+1]]
case 16 <= i && i <= 20:
i -= 16

View File

@@ -167,7 +167,7 @@ func WriteUint16(b *bytes.Buffer, i uint16) {
func RandomBit() (bool, error) {
b := make([]byte, 1)
_, err := rand.Read(b)
return uint8(b[0])%2 == 0, err
return b[0]%2 == 0, err
}
// Uint32Slice attaches the methods of sort.Interface to []uint32, sorting in increasing order.