Skip to content

Commit 4c3528c

Browse files
gbn: update processACK & processNACK docs
1 parent 6967ad3 commit 4c3528c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

gbn/queue.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ func (q *queue) resend() error {
133133
return nil
134134
}
135135

136-
// processACK processes an incoming ACK of a given sequence number.
136+
// processACK processes an incoming ACK of a given sequence number. The function
137+
// returns true if the passed seq is an ACK for a packet we have sent but not
138+
// yet received an ACK for.
137139
func (q *queue) processACK(seq uint8) bool {
138140

139141
// If our queue is empty, an ACK should not have any effect.
@@ -204,8 +206,10 @@ func (q *queue) processNACK(seq uint8) (bool, bool) {
204206
q.cfg.log.Tracef("Received NACK %d", seq)
205207

206208
// If the NACK is the same as sequenceTop, it probably means that queue
207-
// was sent successfully, but we just missed the necessary ACKs. So we
208-
// can empty the queue here by bumping the base and we dont need to
209+
// was sent successfully, but due to latency we timed out and resent the
210+
// queue before we received the ACKs for the sent packages.
211+
// Alternatively, we might have just missed the necessary ACKs. So we
212+
// can empty the queue here by bumping the base and we don't need to
209213
// trigger a resend.
210214
if seq == q.sequenceTop {
211215
q.sequenceBase = q.sequenceTop

0 commit comments

Comments
 (0)