Skip to content

Commit

Permalink
lib/model: Prevent infinite index sending loop (fixes #9407) (#9458)
Browse files Browse the repository at this point in the history
Explanation of what/why in a code comment.

Fixes #9407
  • Loading branch information
imsodin committed Mar 10, 2024
1 parent 2ab2488 commit 73cc555
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/model/indexhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,13 @@ func (s *indexHandler) sendIndexTo(ctx context.Context, fset *db.FileSet) error

err = batch.Flush()

// True if there was nothing to be sent
if f.Sequence == 0 {
return err
}
// Use the sequence of the snapshot we iterated as a starting point for the
// next run. Previously we used the sequence of the last file we sent,
// however it's possible that a higher sequence exists, just doesn't need to
// be sent (e.g. in a receive-only folder, when a local change was
// reverted). No point trying to send nothing again.
s.prevSequence = snap.Sequence(protocol.LocalDeviceID)

s.prevSequence = f.Sequence
return err
}

Expand Down

0 comments on commit 73cc555

Please sign in to comment.