Skip to content

Commit

Permalink
gbn: increase NACK wait time by 2X
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorTigerstrom committed Dec 7, 2023
1 parent 0ab4af7 commit 150bc1e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions gbn/gbn_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,19 @@ func (g *GoBackNConn) receivePacketsForever() error { // nolint:gocyclo

// If we recently sent a NACK for the same
// sequence number then back off.
if lastNackSeq == g.recvSeq &&
time.Since(lastNackTime) <
g.cfg.resendTimeout {
// We wait 2 times the resendTimeout before
// sending a new nack, as this case is likely
// hit if the sender is currently resending
// the queue, and therefore the threads that
// are resending the queue is likely busy with
// the resend, and therefore won't react to the
// NACK we send here in time.
sinceSent := time.Since(lastNackTime)
recentlySent := sinceSent <
g.cfg.resendTimeout*2 //nolint:gomnd

if lastNackSeq == g.recvSeq && recentlySent {
g.log.Tracef("Recently sent NACK")

continue
}
Expand Down

0 comments on commit 150bc1e

Please sign in to comment.