Skip to content

Commit ac06578

Browse files
committed
gbn: update processACK & processNACK docs
1 parent 84023fc commit ac06578

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.
@@ -206,8 +208,10 @@ func (q *queue) processNACK(seq uint8) (bool, bool) {
206208
var bumped bool
207209

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

0 commit comments

Comments
 (0)