lib/model: Locking in the request test

This commit is contained in:
Jakob Borg
2016-11-30 13:11:06 +01:00
parent 913a85c571
commit e4db86836b
2 changed files with 6 additions and 0 deletions

View File

@@ -253,6 +253,8 @@ func (f *fakeConnection) Option(string) string {
}
func (f *fakeConnection) Index(folder string, fs []protocol.FileInfo) error {
f.mut.Lock()
defer f.mut.Unlock()
if f.indexFn != nil {
f.indexFn(folder, fs)
}
@@ -260,6 +262,8 @@ func (f *fakeConnection) Index(folder string, fs []protocol.FileInfo) error {
}
func (f *fakeConnection) IndexUpdate(folder string, fs []protocol.FileInfo) error {
f.mut.Lock()
defer f.mut.Unlock()
if f.indexFn != nil {
f.indexFn(folder, fs)
}