fix several linter warnings and misspellings

This commit is contained in:
Marten Seemann 2016-05-02 16:33:32 +07:00
parent ce57f008e4
commit ad467ade58
9 changed files with 12 additions and 7 deletions

View file

@ -12,7 +12,7 @@ func (e *EntropyAccumulator) Add(packetNumber protocol.PacketNumber, entropyFlag
}
}
// Add the contribution of the entropy flag of a given packet number
// Substract the contribution of the entropy flag of a given packet number
func (e *EntropyAccumulator) Substract(packetNumber protocol.PacketNumber, entropyFlag bool) {
e.Add(packetNumber, entropyFlag)
}

View file

@ -25,6 +25,7 @@ type ReceivedPacketHandler interface {
DequeueAckFrame() *frames.AckFrame
}
// StopWaitingManager manages StopWaitings for sent packets
type StopWaitingManager interface {
RegisterPacketForRetransmission(packet *Packet)
GetStopWaitingFrame() *frames.StopWaitingFrame

View file

@ -21,8 +21,9 @@ type Packet struct {
sendTime time.Time
}
// GetStreamFramesForRetransmission gets all the streamframes for retransmission
func (p *Packet) GetStreamFramesForRetransmission() []*frames.StreamFrame {
streamFrames := make([]*frames.StreamFrame, 0)
var streamFrames []*frames.StreamFrame
for _, frame := range p.Frames {
if streamFrame, isStreamFrame := frame.(*frames.StreamFrame); isStreamFrame {
streamFrames = append(streamFrames, streamFrame)
@ -31,8 +32,9 @@ func (p *Packet) GetStreamFramesForRetransmission() []*frames.StreamFrame {
return streamFrames
}
// GetControlFramesForRetransmission gets all the control frames for retransmission
func (p *Packet) GetControlFramesForRetransmission() []frames.Frame {
controlFrames := make([]frames.Frame, 0)
var controlFrames []frames.Frame
for _, frame := range p.Frames {
// omit ACKs
if _, isStreamFrame := frame.(*frames.StreamFrame); isStreamFrame {

View file

@ -7,6 +7,7 @@ import (
"github.com/lucas-clemente/quic-go/protocol"
)
// ErrDuplicatePacket occurres when a duplicate packet is received
var ErrDuplicatePacket = errors.New("ReceivedPacketHandler: Duplicate Packet")
type receivedPacketHandler struct {

View file

@ -20,7 +20,7 @@ func NewStopWaitingManager() StopWaitingManager {
}
}
// RegisterPacketForRetransmission prepares the StopWaitingFrame, if neccessary
// RegisterPacketForRetransmission prepares the StopWaitingFrame, if necessary
func (h *stopWaitingManager) RegisterPacketForRetransmission(packet *Packet) {
if h.currentStopWaitingFrame == nil || h.currentStopWaitingFrame.LeastUnacked <= packet.PacketNumber { // <= because for StopWaitingFrames LeastUnacked = packet.PacketNumber + 1
h.currentStopWaitingFrame = &frames.StopWaitingFrame{

View file

@ -188,7 +188,7 @@ func ParseAckFrame(r *bytes.Reader) (*AckFrame, error) {
}
// Invalid NACK Handling:
// NACKs contain a lot of offsets that require substractions of PacketNumbers. If an ACK contains invalid data, it is possible to underflow the uint64 used to store the PacketNumber
// NACKs contain a lot of offsets that require subtractions of PacketNumbers. If an ACK contains invalid data, it is possible to underflow the uint64 used to store the PacketNumber
// TODO: handle uint64 overflows
if hasNACK {
var numRanges uint8

View file

@ -13,7 +13,7 @@ func (n *NackRange) Len() uint64 {
return uint64(n.LastPacketNumber) - uint64(n.FirstPacketNumber)
}
// IsInRange checks if a packetNumber is contained in a NACK range
// ContainsPacketNumber checks if a packetNumber is contained in a NACK range
func (n *NackRange) ContainsPacketNumber(packetNumber protocol.PacketNumber) bool {
if packetNumber >= n.FirstPacketNumber && packetNumber <= n.LastPacketNumber {
return true

View file

@ -11,6 +11,7 @@ import (
"github.com/lucas-clemente/quic-go/protocol"
)
// PacketHandler handles packets
type PacketHandler interface {
HandlePacket(addr interface{}, publicHeader *PublicHeader, r *bytes.Reader)
Run()

View file

@ -17,7 +17,7 @@ type stream struct {
session streamHandler
streamID protocol.StreamID
// The chan of unordered stream frames. A nil in this channel is sent by the
// session if an error occured, in this case, remoteErr is filled before.
// session if an error occurred, in this case, remoteErr is filled before.
streamFrames chan *frames.StreamFrame
currentFrame *frames.StreamFrame
readPosInFrame int