Skip to content

Commit

Permalink
tracker: clean-up MaybeUpdate
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Kalinnikov <[email protected]>
  • Loading branch information
pav-kv committed Feb 15, 2024
1 parent 79a64f4 commit 457bb8e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tracker/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,13 @@ func (pr *Progress) UpdateOnEntriesSend(entries int, bytes uint64) {
// index acked by it. The method returns false if the given n index comes from
// an outdated message. Otherwise it updates the progress and returns true.
func (pr *Progress) MaybeUpdate(n uint64) bool {
var updated bool
if pr.Match < n {
pr.Match = n
updated = true
pr.MsgAppFlowPaused = false
if n <= pr.Match {
return false
}
pr.Next = max(pr.Next, n+1)
return updated
pr.Match = n
pr.Next = max(pr.Next, n+1) // invariant: Match < Next
pr.MsgAppFlowPaused = false
return true
}

// MaybeDecrTo adjusts the Progress to the receipt of a MsgApp rejection. The
Expand Down

0 comments on commit 457bb8e

Please sign in to comment.