mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
This reverts commit 641b7aee384f9490e747abd1c61a4b987018de4a.
This commit is contained in:
parent
54b50e3d52
commit
3169212046
@ -74,13 +74,6 @@ func (s *FileSet) Drop(device protocol.DeviceID) {
|
||||
// announced from the remote is newer than our current sequence
|
||||
// number.
|
||||
s.meta.resetAll(device)
|
||||
// Also reset the index ID, as we do want a full index retransfer
|
||||
// if we ever reconnect, regardless of if the index ID changed.
|
||||
if err := s.db.setIndexID(device[:], []byte(s.folder), 0); backend.IsClosed(err) {
|
||||
return
|
||||
} else if err != nil {
|
||||
fatalError(err, opStr, s.db)
|
||||
}
|
||||
}
|
||||
|
||||
t, err := s.db.newReadWriteTransaction()
|
||||
|
@ -1741,6 +1741,22 @@ func TestIgnoreLocalChanged(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Dropping the index ID on Drop is bad, because Drop gets called when receiving
|
||||
// an Index (as opposed to an IndexUpdate), and we don't want to loose the index
|
||||
// ID when that happens.
|
||||
func TestNoIndexIDResetOnDrop(t *testing.T) {
|
||||
ldb := db.NewLowlevel(backend.OpenMemory())
|
||||
defer ldb.Close()
|
||||
|
||||
s := db.NewFileSet("test", fs.NewFilesystem(fs.FilesystemTypeFake, ""), ldb)
|
||||
|
||||
s.SetIndexID(remoteDevice0, 1)
|
||||
s.Drop(remoteDevice0)
|
||||
if got := s.IndexID(remoteDevice0); got != 1 {
|
||||
t.Errorf("Expected unchanged (%v), got %v", 1, got)
|
||||
}
|
||||
}
|
||||
|
||||
func replace(fs *db.FileSet, device protocol.DeviceID, files []protocol.FileInfo) {
|
||||
fs.Drop(device)
|
||||
fs.Update(device, files)
|
||||
|
Loading…
x
Reference in New Issue
Block a user