mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-16 18:41:59 -07:00
No need to hold a write lock in Override
This commit is contained in:
parent
e6f04ed238
commit
db3e3ade80
@ -858,8 +858,10 @@ func (m *Model) State(repo string) string {
|
|||||||
func (m *Model) Override(repo string) {
|
func (m *Model) Override(repo string) {
|
||||||
fs := m.NeedFilesRepo(repo)
|
fs := m.NeedFilesRepo(repo)
|
||||||
|
|
||||||
m.rmut.Lock()
|
m.rmut.RLock()
|
||||||
r := m.repoFiles[repo]
|
r := m.repoFiles[repo]
|
||||||
|
m.rmut.RUnlock()
|
||||||
|
|
||||||
for i := range fs {
|
for i := range fs {
|
||||||
f := &fs[i]
|
f := &fs[i]
|
||||||
h := r.Get(cid.LocalID, f.Name)
|
h := r.Get(cid.LocalID, f.Name)
|
||||||
@ -873,7 +875,6 @@ func (m *Model) Override(repo string) {
|
|||||||
}
|
}
|
||||||
f.Version = lamport.Default.Tick(f.Version)
|
f.Version = lamport.Default.Tick(f.Version)
|
||||||
}
|
}
|
||||||
m.rmut.Unlock()
|
|
||||||
|
|
||||||
r.Update(cid.LocalID, fs)
|
r.Update(cid.LocalID, fs)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user