Skip to content
Snippets Groups Projects
Commit 2cbfd270 authored by Lukas Braun's avatar Lukas Braun
Browse files

fix off-by-one in lookahead code

The Lookahead var should indicate how often the counter is incremented
before an offer is finally declared invalid, *not* the total number of
checks (aka window size).
I.e. for Lookahead=0, check only against the current counter instead of
not at all.
parent 02ec822a
No related branches found
No related tags found
No related merge requests found
......@@ -190,7 +190,7 @@ func check_offer(db *sql.DB, remote string, name string, offer string) (bool, er
return false, err
} else { err_panic(err) }
for i := uint64(0); i < cfg.Lookahead; i++ {
for i := uint64(0); i <= cfg.Lookahead; i++ {
debugf("[%v] checking for match (offset %v)", remote, i)
// .Check increments .Counter if successfull
// otherwise do it explicitly
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment