Skip to content

Commit 82af2e2

Browse files
committed
gbn: increase NACK wait time by 2X
1 parent f1db4ed commit 82af2e2

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

gbn/gbn_conn.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,19 @@ func (g *GoBackNConn) receivePacketsForever() error { // nolint:gocyclo
553553

554554
// If we recently sent a NACK for the same
555555
// sequence number then back off.
556-
if lastNackSeq == g.recvSeq &&
557-
time.Since(lastNackTime) <
558-
g.cfg.resendTimeout {
556+
// We wait 2 times the resendTimeout before
557+
// sending a new nack, as this case is likely
558+
// hit if the sender is currently resending
559+
// the queue, and therefore the threads that
560+
// are resending the queue is likely busy with
561+
// the resend, and therefore won't react to the
562+
// NACK we send here in time.
563+
sinceSent := time.Since(lastNackTime)
564+
recentlySent := sinceSent <
565+
g.cfg.resendTimeout*2
566+
567+
if lastNackSeq == g.recvSeq && recentlySent {
568+
g.log.Tracef("Recently sent NACK")
559569

560570
continue
561571
}

0 commit comments

Comments
 (0)